Auto merge of #23774 - sreeise:media_fragment_parser, r=ferjm

Media fragment parser

<!-- Please describe your changes on the following line: -->
Media fragment parser for audio and video.

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: -->
- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [X] These changes fix #22366 (GitHub issue number if applicable)

<!-- Either: -->
- [X] There are tests for these changes OR
- [ ] These changes do not require tests because ___

<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/23774)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2019-07-23 05:00:01 -04:00 committed by GitHub
commit fdbb317d7a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 464 additions and 11 deletions

View file

@ -0,0 +1,48 @@
<!doctype html>
<meta charset="utf-8">
<title>Video should seek to time specified in media fragment syntax</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/media.js"></script>
<div id="log"></div>
<video id="video"></video>
<script>
async_test(function () {
let video = document.getElementById("video");
video.src = getVideoURI('/media/movie_5') + "#t=4,7";
video.load();
this.step_timeout(function () {
assert_equals(video.currentTime, 4.0);
video.src = getVideoURI('/media/movie_5') + "#t=%6Ept:3";
video.load();
this.step_timeout(function () {
assert_true(video.src.endsWith("t=%6Ept:3"));
assert_equals(video.currentTime, 3.0);
video.src = getVideoURI('/media/movie_5') + "#t=00:00:01.00";
video.load();
this.step_timeout(function () {
assert_true(video.src.endsWith("t=00:00:01.00"));
assert_equals(video.currentTime, 1.0);
video.src = getVideoURI('/media/movie_5') + "#u=12&t=3";
video.load();
this.step_timeout(function () {
assert_true(video.src.endsWith("#u=12&t=3"));
assert_equals(video.currentTime, 3.0);
video.src = getVideoURI('/media/movie_5') + "#t=npt%3A3";
video.load();
this.step_timeout(function () {
assert_true(video.src.endsWith("t=npt%3A3"));
assert_equals(video.currentTime, 3.0);
this.done();
}, 1000);
}, 1000);
}, 1000);
}, 1000);
}, 1000);
});
</script>