Closed Bug 896884 Opened 11 years ago Closed 9 years ago

Implement MediaSource.duration

Categories

(Core :: Audio/Video, defect, P2)

defect

Tracking

()

RESOLVED FIXED

People

(Reporter: kinetik, Assigned: jya)

References

(Blocks 1 open bug)

Details

From the first 30 tests in bug 881514, the following are failing due to requiring support for MediaSource.duration:

 - DurationAfterAppendAudio/DurationAfterAppendVideo
 - MediaElementEvents
I would love to see this implemented, but I lack C++ skills (and the time to learn), so I've put up a bounty on Bountysource: https://www.bountysource.com/issues/3143216-implement-mediasource-duration
Blocks: 1062733
No longer blocks: 1062733
Stuff still to do here:

Complete the TODOs listed in MediaSource::DurationChange, verify what else may be missing against the current version of the spec, and write a mochitest.
And ensure test 42 linked from bug 881514 passes.
I would like to have a deeper look at this bug, if you need some help to fix it, of course.

So, if I'm right, this is partly implemented, but some usecases are missing right? (mainly the ones described in the TODO in MediaSource.cpp, about duration changes).

Is there some tests already written for this? (comment 3 suggests so, but I wasn't able to find to which tests they refer, so I'm wondering if they are in the tree and if so, where they are located).
Flags: needinfo?(kinetik)
(In reply to Arnaud Bienner from comment #4)
> I would like to have a deeper look at this bug, if you need some help to fix
> it, of course.

Nobody is working on it right now, your help would be most welcome.

> So, if I'm right, this is partly implemented, but some usecases are missing
> right? (mainly the ones described in the TODO in MediaSource.cpp, about
> duration changes).

Right, and anything else that the tests might reveal.

> Is there some tests already written for this? (comment 3 suggests so, but I
> wasn't able to find to which tests they refer, so I'm wondering if they are
> in the tree and if so, where they are located).

The existing tests are located in content/media/mediasource/test, but there are no local tests for MediaSource.duration yet.  Comment 3 refers to the duration test hosted at http://yt-dash-mse-test.commondatastorage.googleapis.com/unit-tests/main.html.  There's also a test suite from the W3C's Web Platform Tests being imported -- the details covering that are in bug 996368 (and elsewhere that I'm not aware of) -- the tests in question are located in testing/web-platform/tests/media-source but have not yet been reviewed or enabled.
Flags: needinfo?(kinetik)
I wanted to have a deeper look but things are less clearer to me than I expected.
About the TODO in MediaSource.cpp, I'm not sure what the first one refers to and how I can test this [1]. About the second one [2], I'm still not sure what is missing: I slightly modified test_MediaSource.html and durationChanged event is fired as expected, and element's duration is updated accordingly, which seems to be the expected "HTMLMediaElement duration change algorithm" [3]. However, I don't know how to test the last part of the algorithm described i.e. duration changed to a smaller time, so we need to ensure we seek to max(currentPosition, newDuration). I believe I should force the duration to some value, but I'm not sure it is possible to do this in javascript, in the test (at least, I didn't managed to).

About http://yt-dash-mse-test.commondatastorage.googleapis.com/unit-tests/main.html DurationAfterAppendAudio/DurationAfterAppendVideo are working; MediaElementEvents is partially working (starts by then stops and timeout).

Well, maybe I should at least get more familiar with MSE before trying to dig again into that bug.

[1]: http://lxr.mozilla.org/mozilla-central/source/content/media/mediasource/MediaSource.cpp#472
[2]: http://lxr.mozilla.org/mozilla-central/source/content/media/mediasource/MediaSource.cpp#473
[3]: www.w3.org/TR/html5/embedded-content-0.html#durationChange
Depends on: 1097375
I'm implementing part of this in bug 1097375 to get the dashif player working.
Blocks: MSE
this has been fixed a while ago. The last dependency is bug 1130948.

I'll close this bug as soon as it lands
Assignee: nobody → jyavenard
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.