Class: Camera

visual.Camera(options)

new Camera(options)

This manager handles the recording of video signal.

Parameters:
Name Type Description
options Object
Properties
Name Type Attributes Default Description
win module:core.Window the associated Window
format string <optional>
'video/webm;codecs=vp9' the video format
showDialog boolean <optional>
false whether or not to open a dialog box to inform the participant to wait for the camera to be initialised
dialogMsg string <optional>
"Please wait a few moments while the camera initialises" default message informing the participant to wait for the camera to initialise
clock Clock <optional>
an optional clock
autoLog boolean <optional>
false whether or not to log
Source:
To Do:
  • add video constraints as parameter

Methods

(protected) _onChange()

Callback for changes to the recording settings.

Changes to the settings require the recording to stop and be re-started.

Source:

(protected) _prepareRecording()

Prepare the recording.
Source:

download(filename)

Offer the audio recording to the participant as a video file to download.
Parameters:
Name Type Description
filename string the filename of the video file
Source:

flush() → {Promise}

Submit a request to flush the recording.
Source:
Returns:
promise fulfilled when the data has actually been made available
Type
Promise

getRecording(tag, flushopt)

Get the current video recording as a VideoClip in the given format.
Parameters:
Name Type Attributes Default Description
tag string an optional tag for the video clip
flush boolean <optional>
false whether or not to first flush the recording
Source:

getStream() → {MediaStream}

Get the underlying video stream.
Source:
Returns:
the video stream
Type
MediaStream

getVideo() → {HTMLVideoElement}

Get a video element pointing to the Camera stream.
Source:
Returns:
a video element
Type
HTMLVideoElement

isReady() → {boolean}

Query whether or not the camera is ready to record.
Source:
Returns:
whether or not the camera is ready to record
Type
boolean

pause() → {Promise}

Submit a request to pause the recording.
Source:
Returns:
promise fulfilled when the recording actually paused
Type
Promise

resume(options) → {Promise}

Submit a request to resume the recording.

resume has no effect if the recording was not previously paused.

Parameters:
Name Type Description
options Object
Properties
Name Type Attributes Default Description
clear boolean <optional>
false whether or not to empty the video buffer before resuming the recording
Source:
Returns:
promise fulfilled when the recording actually resumed
Type
Promise

start() → {Promise}

Submit a request to start the recording.
Source:
Returns:
promise fulfilled when the recording actually started
Type
Promise

stop(options) → {Promise}

Submit a request to stop the recording.
Parameters:
Name Type Description
options Object
Properties
Name Type Attributes Description
filename string <optional>
the name of the file to which the video recording will be saved
Source:
Returns:
promise fulfilled when the recording actually stopped, and the recorded data was made available
Type
Promise

upload(@param)

Upload the video recording to the pavlovia server.
Parameters:
Name Type Attributes Default Description
@param Object options
options.tag string an optional tag for the video file
options.waitForCompletion boolean <optional>
false whether or not to wait for completion before returning
options.showDialog boolean <optional>
false whether or not to open a dialog box to inform the participant to wait for the data to be uploaded to the server
options.dialogMsg string <optional>
"" default message informing the participant to wait for the data to be uploaded to the server
Source: