# MovieStim

## visual MovieStim

Movie Stimulus.

## Constructor

#### new MovieStim(options, movie)

Source:
  - visual/MovieStim.js, line 26
To Do:
  - autoPlay does not work for the moment.

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---

`options`

Object

###### Properties

Name | Type | Description
--- | --- | ---
`name` | String | the name used when logging messages from this stimulus
`win` | module:core.Window | the associated Window

`movie` | string | HTMLVideoElement | module:visual.Camera |  |  | the name of a movie resource or of a HTMLVideoElement or of a Camera component
`options.units` | string | <optional> | `"norm"` | the units of the stimulus (e.g. for size, position, vertices)
`options.pos` | Array.<number> | <optional> | `[0, 0]` | the position of the center of the stimulus
`options.units` | string | <optional> | `'norm'` | the units of the stimulus vertices, size and position
`options.ori` | number | <optional> | `0.0` | the orientation (in degrees)
`options.size` | number | <optional> |  | the size of the rendered image (the size of the image will be used if size is not specified)
`options.color` | Color | <optional> | `Color('white')` | the background color
`options.opacity` | number | <optional> | `1.0` | the opacity
`options.contrast` | number | <optional> | `1.0` | the contrast
`options.interpolate` | boolean | <optional> | `false` | whether or not the image is interpolated
`options.flipHoriz` | boolean | <optional> | `false` | whether or not to flip horizontally
`options.flipVert` | boolean | <optional> | `false` | whether or not to flip vertically
`options.loop` | boolean | <optional> | `false` | whether or not to loop the movie
`options.volume` | number | <optional> | `1.0` | the volume of the audio track (must be between 0.0 and 1.0)
`options.noAudio` | boolean | <optional> | `false` | whether or not to play the audio
`options.autoPlay` | boolean | <optional> | `true` | whether or not to autoplay the video
`options.autoDraw` | boolean | <optional> | `false` | whether or not the stimulus should be automatically drawn on every frame flip
`options.autoLog` | boolean | <optional> | `false` | whether or not to log

### Extends

- VisualStim

### Methods

#### (protected) _estimateBoundingBox()

Source:
  - visual/MovieStim.js, line 319

Estimate the bounding box.

#### (protected) _getDisplaySize() → {Array.<number>}

Source:
  - visual/MovieStim.js, line 420

Get the size of the display image, which is either that of the ImageStim or that of the image it contains.

##### Returns:

the size of the displayed image

Type
  Array.<number>

#### (protected) _updateIfNeeded()

Source:
  - visual/MovieStim.js, line 340

Update the stimulus, if necessary.

#### pause(logopt)

Source:
  - visual/MovieStim.js, line 255

Pause the movie.

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`log` | boolean | <optional> | `false` | whether of not to log

#### play(logopt)

Source:
  - visual/MovieStim.js, line 230

Start playing the movie.

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`log` | boolean | <optional> | `false` | whether of not to log

#### reset(logopt)

Source:
  - visual/MovieStim.js, line 218

Reset the stimulus.

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`log` | boolean | <optional> | `false` | whether of not to log

#### seek(timePoint, logopt)

Source:
  - visual/MovieStim.js, line 281

Jump to a specific timepoint

Note: seek is experimental and does not work on all browsers at the moment.

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`timePoint` | number |  |  | the timepoint to which to jump (in second)
`log` | boolean | <optional> | `false` | whether of not to log

#### setMovie(movie, logopt)

Source:
  - visual/MovieStim.js, line 142

Setter for the movie attribute.

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`movie` | string | HTMLVideoElement | module:visual.Camera |  |  | the name of a movie resource or of a HTMLVideoElement or of a Camera component
`log` | boolean | <optional> | `false` | whether of not to log

#### stop(logopt)

Source:
  - visual/MovieStim.js, line 266

Stop the movie and reset to 0s.

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`log` | boolean | <optional> | `false` | whether of not to log