<!DOCTYPE HTML>
<html>
<head>
  <title>MSE: test append of audio with similar init segments that have different track ids</title>
  <script src="/tests/SimpleTest/SimpleTest.js"></script>
  <script type="text/javascript" src="mediasource.js"></script>
  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<pre id="test">
<script class="testbody" type="text/javascript">

SimpleTest.waitForExplicitFinish();

runWithMSE(async (ms, el) => {
  el.controls = true;
  await once(ms, "sourceopen");
  ok(true, "Receive a sourceopen event");
  const audiosb = ms.addSourceBuffer("audio/mp4");
  await fetchAndLoad(audiosb, "init-trackid2", [''], ".mp4");
  await fetchAndLoad(audiosb, "segment-2.0001", [''], ".m4s");
  await fetchAndLoad(audiosb, "init-trackid3", [''], ".mp4");
  await fetchAndLoad(audiosb, "segment-3.0002", [''], ".m4s");
  is(el.buffered.length, 1, "data is buffered");
  is(el.buffered.end(0), 8, "all data got appended");
  SimpleTest.finish();
});

</script>
</pre>
</body>
</html>
