/**
* Runs through each available state transition test by running all
* available operations on a media recorder object. Then, we report
* back if the test was expected through an exception or not.
*
* @param {MediaStream} testStream the media stream used for media recorder
* operation tests
*/
function runStateTransitionTests(testStream) {
for (const operationTest of operationTests) { var mediaRecorder = new MediaRecorder(testStream); var operationsString = operationTest.operations.toString();
try {
for (const operation of operationTest.operations) {
if (operationTest.timeSlice && operation === 'start') {
operationsString += ' with timeslice ' + operationTest.timeSlice;
mediaRecorder[operation](operationTest.timeSlice);
} else {
mediaRecorder[operation]();
}
}
ok(operationTest.isValid, `${operationsString} should succeed`);
} catch (err) {
if (operationTest.isValid) {
ok(false, `${operationsString} failed unexpectedly with ${err.name}`);
} else {
is(err.name, "InvalidStateError",
`${operationsString} expected to fail with InvalidStateError`);
}
}
}
}
/**
* Starts a test on every media recorder file included to check that various
* state transition flows that can happen in the media recorder object throw
* exceptions when they are expected to and vice versa.
*/
function startTest(test, token) { var element = document.createElement('audio');
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.