MediaRecorder element

Recording media streams requires hosting your experiment on a secure domain (https). You can set up your project on either the PCIbex Farm or the original Ibex Farm, but you will need your own server to save the collected samples.

Introduced in PennController 1.8, MediaRecorder elements let you collect audio and/or video samples after requesting access to a recording device. Note that browser support is limited, with Firefox desktop and Chrome desktop having the best support.

Creation:

newMediaRecorder("recorder", "audio")

If you don’t specify any parameter when creating the element, it will record an audio+video stream by default.

If print is called, a feedback media player will be added to the page besides a Record button.

In order to collect recordings, you need to

  1. upload a PHP file on a server where you can store an archive of the sample files. See the page How to collect audio and/or video samples for instructions.
  2. initiate the recorder before creating a MediaRecorder element, by adding to your sequence a special initialization trial using InitiateRecorder and specifying the URL of your PHP file, e.g.

[js try=”data”]InitiateRecorder(“http://myserver/saveRecordings.php”);

newTrial(
newMediaRecorder(“recorder”, “audio”)
.print()
,
newButton(“send”, “Click here to send your recording.”)
.print()
.wait()
);[/js]

Commands

[yadawiki-list category=”NonTest command,MediaRecorder element”]

Tests

[yadawiki-list category=”Test command,MediaRecorder element”]