shaka-project / shaka-player

JavaScript player library / DASH & HLS client / MSE-EME player
Apache License 2.0
7.08k stars 1.33k forks source link

Seeking to video end in Firefox and Safari crashes Shaka #1967

Closed mehtmehtsen closed 5 years ago

mehtmehtsen commented 5 years ago

When I seek past the end in FF or Safari, the progress bar disappears and the video doesn't seek or play anymore.

Have you read the FAQ and checked for duplicate open issues? There's a similar issue (#1363), but that was blamed on a (fixed) Safari Bug. This happens in Firefox also.

What version of Shaka Player are you using? 2.5.1

Can you reproduce the issue with our latest release version? Yip

Can you reproduce the issue with the latest code from master? Didn't try

Are you using the demo app or your own custom app? Problem happens in both

If custom app, can you reproduce the issue using our demo app? Yes

What browser and OS are you using? Firefox 67 (recent versions of Mac OS, Windows, Fedora, Android) Safari 12.1.1 (recent version of Mac OS)

Could not reproduce either in Chrome or the Microsoft Browsers (no, not even in IE11 ^^)

What did you do? Begin playing the stream Seek to (or past) the very end. Try a few times, move mouse back and forth.

What did you expect to happen? That the last frame is displayed and the player stops, but keeps its functionality

What actually happens? The progress bar disappears, errors are displayed in console:

Assertion failed: duration must be > 0 presentation_timeline.js:127:16 Failed to move playhead from 0 to -1 video_wrapper.js:278:17 (Firefox)

[Error] Unhandled Promise Rejection: shaka.util.Error { "severity": 2, "category": 3, "code": 3015, "data": [ { "line": 714, "column": 36, "sourceURL": "https://shaka-player-demo.appspot.com/lib/media/media_source_engine.js" } ], "handled": false, "message": "Shaka Error MEDIA.MEDIA_SOURCE_OPERATION_THREW (InvalidStateError: The object is in an invalid state.)", "stack": "Error@https://shaka-player-demo.appspot.com/lib/util/error.js:88:22\nhttps://shaka-player-demo.appspot.com/lib/media/media_source_engine.js:1006:48\n[native code]\npromiseReactionJob@[native code]" } (anonymous function) promiseReactionJob (Safari)

joeyparrish commented 5 years ago

I'm running Shaka Player v2.5.1 from appspot in Firefox 67 on Ubuntu 16.04, and I can't reproduce the issue with the "Angel One" or "Sintel" clips. I have tried seeking with the mouse, I've tried dragging the seek bar back and forth around the end, and I've tried video.currentTime = video.duration and video.currentTime = video.duration + 1 in the debugger.

Can you provide more specific repro instructions? Thanks!

mehtmehtsen commented 5 years ago

I just tried Firefox 67 in a Ubuntu 18.04.2 VM and can reproduce the problem. Everything is freshly installed, the browser doesn't have any extensions. I took a screen recording: https://youtu.be/2zGAwvd-750 Hope that helps to reproduce.

joeyparrish commented 5 years ago

Ah, I see. Well, that's not Shaka Player crashing. Shaka seems to still be functioning when that happens, doesn't it?

I'll look into the source of the error message, but unless I'm mistaken, it doesn't seem to be breaking anything.

mehtmehtsen commented 5 years ago

Hey Joey, do you maybe have an insight into what exactly it is that is crashing then? As this happens in (at least) Safari and Firefox, and to my knowledge only when using Shaka, I'm not sure where to begin investigating. Thanks a lot for looking into it further. Marius

joeyparrish commented 5 years ago

I'm not sure what you mean by "crash". The player is still functioning, isn't it?

If you're referring to the error message, then I haven't yet figured out what causes it or how to fix it. Sorry for the delay!

mehtmehtsen commented 5 years ago

Actually no, the player does not work anymore. The play button and the progress bar disappear completely, and clicking the video or the play/pause-button in the middle of the video does nothing. I can slide the volume slider around, but of course without a video there's no sound. Even when I hide the shaka divs via the dev tools, right click the video itself and select 'show controls', the native play button only makes a loading circle appear, while the video appears to have a length of 0:00:

Screenshot (11)

I don't mind the delay, on the contrary I'm happy someone is looking into it. :-)

joeyparrish commented 5 years ago

Then I am not getting the same results as you. Sorry about that!

In my testing, I see the error messages you pointed to, but I do not see the player stop working. I will look into the error message anyway, but I expect they are misleading and may not be part of the problem you're seeing.

mehtmehtsen commented 5 years ago

So you seem to be the lucky one who is on a system where it's working. :-) Or maybe you can actually reproduce the problem if you try some more. In the video I recorded you can see it takes some time, but at other times it happens pretty quick. Did you notice the error message Assertion failed: duration must be > 0 (presentation_timeline.js:127:16) in my video? Maybe that is more relevant to the issue.

TheModMaker commented 5 years ago

I was able to reproduce occasionally. You need to drag the slider past the end to get it. It appears to be a browser bug where the MediaSource.duration value has been reset to 0 for some reason, even though we didn't change it. I can add a fix to ignore this case.