-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Seek after load does not work #1298
Comments
You could try something like this, which doesn't rely on the const startTime = 60; // some start time in seconds
player.load(manifestUri).then(function() {
const end = player.seekRange().end;
if (startTime < end) {
player.getMediaElement().currentTime = startTime;
}
}); Does this help? |
Hey @joeyparrish thanks for the super fast response! That was a good idea but unfortunately it doesn't work in 2.1.8, the start doesn't get set correctly. Assuming I upgrade to the latest version, do you see any problems with my original code or is there a better way? Edit: apparently the original way I posted is not working, and setting currentTime doesnt seem to be a good approach. Here I am setting the |
If you can, upgrading is rarely a bad idea. At the very least, try the most recent bugfix release from the v2.2 branch, v2.2.10. Otherwise, you should try the very latest, which is currently v2.3.2. It could be that some of these approaches fail because of bugs we've already fixed in newer releases, so I suggest you try an upgrade before we go further. Upgrade guides can be found here: https://shaka-player-demo.appspot.com/docs/api/tutorial-upgrade.html If upgrading your entire project is going to be too time-consuming for you right now, you could always just try building a very simple demo on top of the latest release using the sample code you posted above. That should be cheap and easy, and will tell you whether your approach makes sense and whether an upgrade will help with this particular issue. |
Hey @joeyparrish, definitely will look into upgrading, but even that doesn't work entirely. I linked a codepen above in my edit which has the latest v2.3.2 and a demo example of what I am trying to do. In my codepen, tried changing I have also tried not setting |
Seeking during the 'streaming' event doesn't work because we haven't put opt_startTime into effect yet. I would expect that seeking after load() resolves would still work, but it doesn't. Delaying the seek another 100ms after load() resolves works on my workstation, but that is not a good fix. It is surprising that we override a seek that occurs after load() is resolved, so I'll go ahead and mark this as a bug. I'm not sure exactly what is causing it, though. |
This should work after the fix is commited: const startTime = 500;
player.load(asset.manifestUri, startTime).then(function() {
const end = player.seekRange().end;
if (startTime > end) {
player.getMediaElement().currentTime = 0.1;
}
}); |
Fixing the seek after load not working issue where our customer wants to start the video from a certain time when playback. Deleted earlySeekTimer. Backported to v2.3.x Closes #1298. Change-Id: Ifa293c20c1baf76193948e3b5a7778a2f262222e
Fix cherry-picked to v2.3.5. |
Fixing the seek after load not working issue where our customer wants to start the video from a certain time when playback. Deleted earlySeekTimer. Closes shaka-project#1298. Change-Id: Ifa293c20c1baf76193948e3b5a7778a2f262222e
Have you read the FAQ and checked for duplicate open issues?:
Yes
What version of Shaka Player are you using?:
2.1.8
I am currently using shaka player for streaming DASH, and would like to make it so the playback starts at a certain time. From the docs I see
player.load
supportsopt_startTime
, however with the version of shaka player I have, if theopt_startTime
is a time that is longer than the video, the player throws an error and fails to load. I noticed around 2.2.8, the stream starts at END_TIME - 1 instead of throwing an error.I was wondering what the best way would be to to detect that the start time is out of bounds, and start at t=0 rather than t=END_TIME - 1? This is an example of what I am currently thinking (involves upgrading of shaka player to 2.2.5 for streaming event support):
The above seems to work, but I am not sure if there is a better solution. Also, if there is some solution that would involve me not upgrading shaka player that would be great.
The text was updated successfully, but these errors were encountered: