DXR will be turned off on Tuesday, December 29th. It will redirect to Searchfox.
See the announcement on Discourse.

DXR is a code search and navigation tool aimed at making sense of large projects. It supports full-text and regex searches as well as structural queries.

Mercurial (c68fe15a81fc)

VCS Links

Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125
<!DOCTYPE HTML>
<html>
<head>
  <title>Test MediaRecorder Record Timeslice</title>
  <script src="/tests/SimpleTest/SimpleTest.js"></script>
  <script src="/tests/SimpleTest/SimpleTest.js"></script>
  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
  <script type="text/javascript" src="manifest.js"></script>
</head>
<body>
<pre id="test">
<pre id="test">
<script class="testbody" type="text/javascript">
var manager = new MediaTestManager;

/**
 * Starts a test on every media recorder file included to check that a stream
 * Starts a test on every media recorder file included to check that a stream
 * derived from the file can be recorded with a timeslice provided
 */
function startTest(test, token) {
  var element = document.createElement('audio');
  var expectedMimeType = test.type;
  var expectedMimeType = test.type;

  element.token = token;
  manager.started(token);

  element.src = test.name;
  element.test = test;
  element.test = test;
  element.preload = "auto";

  // Set up MediaRecorder once loadedmetadata fires and tracks are available.
  element.onloadedmetadata = function() {
    element.onloadedmetadata = null;

    const stream = element.mozCaptureStream();
    const stream = element.mozCaptureStream();
    const mediaRecorder =
      new MediaRecorder(stream, {mimeType: expectedMimeType});

    mediaRecorder.onerror = function () {
      ok(false, 'Unexpected onerror callback fired');
      ok(false, 'Unexpected onerror callback fired');
    };

    mediaRecorder.onwarning = function () {
      ok(false, 'Unexpected onwarning callback fired');
    };
    };

    mediaRecorder.onstop = function () {
      ok(false, 'Unexpected onstop callback fired');
    };


    var dataAvailableCount = 0;
    var onDataAvailableFirst = false;

    // This handler fires every 250ms to generate a blob.
    mediaRecorder.ondataavailable = function (evt) {
      info('ondataavailable fired');
      info('ondataavailable fired');
      dataAvailableCount++;

      ok(evt instanceof BlobEvent,
         'Events fired from ondataavailable should be BlobEvent');
         'Events fired from ondataavailable should be BlobEvent');
      is(evt.type, 'dataavailable',
         'Event type should dataavailable');
      ok(evt.data.size >= 0,
         'Blob data size received is greater than or equal to zero');


      is(evt.data.type, expectedMimeType,
         'Blob data received should have type = ' + expectedMimeType);
      is(mediaRecorder.mimeType, expectedMimeType,
         'Mime type in ondataavailable = ' + mediaRecorder.mimeType);


      // We'll stop recording upon the 1st blob being received
      if (dataAvailableCount === 1) {
        mediaRecorder.onstop = function (event) {
          info('onstop fired');


          if (!onDataAvailableFirst) {
            ok(false, 'onstop unexpectedly fired before ondataavailable');
          }
          element.pause();
          manager.finished(token);
          manager.finished(token);
        };

        mediaRecorder.stop();
        is(mediaRecorder.state, 'inactive',
           'Media recorder is inactive after being stopped');
           'Media recorder is inactive after being stopped');
        is(mediaRecorder.stream, stream,
           'Media recorder stream = element stream post recording');

      } else if (dataAvailableCount === 2) {
        // Ensure we've received at least two ondataavailable events before onstop
        // Ensure we've received at least two ondataavailable events before onstop
        onDataAvailableFirst = true;
      }
    };

    mediaRecorder.start(1);
    mediaRecorder.start(1);
    element.play();
    is(mediaRecorder.state, 'recording', 'Media recorder should be recording');
    is(mediaRecorder.stream, stream,
       'Media recorder stream = element stream at the start of recording');
  };
  };
}

manager.runTests(gMediaRecorderTests, startTest);
</script>
</pre>
</pre>
</body>
</html>