-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Defer setting currentTIme until something is in buffer #101
Comments
More info logged to the console from a local build of v1.3.0-debug:
|
The call stack looks like: setting a breakpoint at app.onPlayerError_ app.js:892, stepping up the call stack to shaka.player.Player.prototype.load player.js:313:
lib/player/stream_video_source.js:1113 is setting a break point there, This is equivalent to |
Interesting. Thanks for investigating, Nick! I'm confused about one point. Is the problem that we're setting currentTime too early (while the HTMLVideoElement is in the wrong state) or that we're setting currentTime to the exact same value that it already has? I ask because in your PR, the subject is "defer assigning", but it seems to be checking the value instead of changing the timing. |
This seems to be the case, but I work in blissful ignorance a few levels up from the media stack so I'm not really sure why this is considered an error in Firefox. Maybe "defer" is not the right term, feel free to reword the commit message manually. Also, I'm not sure if this breaks seeking; I would guess not, since that conditional predicate should be true. It would be better to have the predicate be |
Yeah, I'm concerned #103 isn't the right fix. If it's a state issue, then some aspect of that state should be involved in the fix. #103 only really fixes the problem if it's a matter of Firefox not permitting you to set currentTime to the same value it already has, which sounds like wacky behavior to me. I tend to think Firefox's implementation is smarter than that. There are some streams which do not start at 0. I don't have a sample off-hand, but if you try something like this: this.video.currentTime = streamStartTime + 1; And it still throws an error, it's definitely a state problem and #103 isn't the right fix. If that does somehow fix it, we just need to reword the commit message in #103 and merge it. |
Ah, I just ran across something that may be relevant. See the change in stream_video_source.js in blinkbox/shaka-player@79a80f0. It may be that Firefox and IE11 both dislike how/when we set currentTime. You may want to try the same tweak in stream_video_source.js that Blinkbox is using for IE. @jonoward: Can you offer us any insight on this? Is IE's behavior similar to the Firefox behavior described in this issue? |
Ah yes we had this exact issue in IE - it doesn't like certain operations being called before the video has metadata (calling msSetMediaKeys had the same issue). Our change was to set currentTime within a handler for loadedmetadata. But to be really robust, you could first check if videoElement.readyState is > 0, if so, set current time immediately, else defer to loadedmetadata. Hope that helps! |
heh, funny I missed that. I'll rewrite my patch. |
Instead of
so I think |
Fixes shaka-project#101 Required for Firefox's and IE's MediaElement implementations.
Fixes shaka-project#101 Required for Firefox's and IE's MediaElement implementations.
Fixes shaka-project#101 Required for Firefox's and IE's MediaElement implementations.
defer assigning to video.currentTime Fixes #101
PR had to be reverted, so reopening this issue. |
@nickdesaulniers, I just tested with the latest nightly of Firefox, but I'm having trouble reproducing on my Linux box. The stream you mentioned in the bug report is MP4, and Firefox 42 doesn't seem to support MP4 on Linux. I tried the WebM "Angel One" test asset we have built-in, and it plays just fine on Firefox 42. Do you see this bug with all assets in general, or just with the "Tears of Steel" MPD you linked to? |
We definitely don't have WebM support in our MSE implementation. Asking in irc.mozilla.org#media about mp4/h.264/Linux support now... In 41.0a1 (2015-06-26), and 42.0a1 (2015-07-01) I continue to get the InvalidStateError, but not in 40.0a2 (2015-06-29) (where it works). |
I flipped several MSE-related flags, including one about MSE WebM. Interesting that it works in FF40. Could we perhaps raise a bug with someone at Mozilla about the behavior of FF41 and FF42? If the new behavior is more spec-correct, we could certainly revisit FF41 support in Shaka Player after confirming that this is, in fact, intended behavior for Firefox. But I'd hate to discover that we spent a lot of time and energy sweeping a bug under the rug with a workaround. Has Mozilla decided when FF with ship with MSE enabled by default? |
@nickdesaulniers and I work at Mozilla. I've forwarded this bug to our MSE developer. He has been refactoring our MSE implementation in 41–42, so regressions are not unexpected. :-) We plan to enable MSE by default in FF42 (in the Firefox Nightly channel now). |
Awesome! Looking forward to FF42, then. |
I work on Firefox's EME and media stacks. We only support EME in MP4. To get Linux MP4 support you need to have the appropriate ffmpeg packages installed and must ensure the following prefs have the following values in about:config: media.fragmented-mp4.ffmpeg.enabled=true David Dorwin pointed out that this demo also fails in Firefox because MediaKeySystemAccess.prototype.getConfiguration does not exist. Currently we haven't implemented that, and I'm not sure when we'll get to it. We support configuration discovery by providing a configuration list to navigator.requestMediaKeySystemAccess(). We support this WebIDL: Currently only the initDataType capability, audioType and videoType MediaKeySystemOptions fields are handled by our implementation. The optional fields are ignored, and we don't support any configurations that specify an audioCapability or videoCapability. |
Just to add some additional info to this thread, it seems only IE11 raises an InvalidStateError when the current time is set when video.readyState is HTMLMediaElement.HAVE_NOTHING; Edge has the same behaviour as Chrome, and allows it (assume it defers it internally, as at this point the duration is not yet known by the video element, so it shouldn't be able to set it's currentTime). Also, with the recent changes to add player.setPlaybackStartTime for initiating playback at a non zero currentTime, the invalid state error only happens if you use this method (in IE11, and I assume FF) |
This same condition should be triggered without setPlaybackStartTime if you are playing live content. Live playback starting at t=0 would be vanishingly unlikely. |
https://bugzilla.mozilla.org/show_bug.cgi?id=1217923 In the meantime, I've been successful in live streaming content using GPAC's DashCast, http-server, FF 44, and shaka-player (commenting out the line assigning to this.video.currentTime). |
We've found a way to fix it, but it will have to wait for v2.0. Experimentally, if we defer setting video.currentTime until after at least one init segment is in buffer, the latest stable FF seems to work just fine. However, since Stream.onUpdate_ uses video.currentTime to start fetching segments, we can't simply defer without making many more changes. Shaka v2.0 will be structured differently and this should not be an issue. |
Throwing an invalid state error when setting currentTime is per spec. http://dev.w3.org/html5/spec-preview/media-elements.html#offsets-into-the-media-resource Throw an InvalidStateError if there is no selected Media Resource. When the video/media element is created, and no mediasource has been created and attached it doesn't have a selected media resource yet. |
"When the video/media element is created, and no mediasource has been created and attached it doesn't have a selected media resource yet." That doesn't describe what happens in Shaka, though. MediaSource has been created and attached before setting currentTime. What we do (1.x) is set currentTime before appendBuffer(). What I am suggesting we do differently in 2.0 is set currentTime only after the first call to appendBuffer() completes. |
I filed a bug with Chromium just in case. |
Ok... I went by the first post description that did "document.createElement('video').currentTime = 0". Then you're hitting https://bugzilla.mozilla.org/show_bug.cgi?id=1188887 I had put it on a back burner, I'll bump it |
Looks like the FF bug mentioned immediately above has been closed as fixed. I haven't tested this fix myself, but since IE11 suffers the same problem, this Shaka issue will have to stay open until we can defer currentTime. |
Firefox Nightly 45 now loads the mpd from the first comment, but it does not play automatically (like it does in Chrome).
If I press the play button, the video will start, but hiccups after a couple seconds and logs the following console error:
@jyavenard: is this a problem with Firefox's MSE, the Shaka player, or the encoded media? |
I reported this autoplay and "multiple buffered ranges detected" issues in Firefox bug 1221329. |
STR:
expected: playback
actual: console error: Player Error InvalidStateError
will try posting more info with a downloaded, debug build
The text was updated successfully, but these errors were encountered: