-
Notifications
You must be signed in to change notification settings - Fork 7.5k
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
5.0: Consider adding "sourcechange" event #2382
Comments
I think you'll find that the Let us know if that makes sense and matches your use case. Thanks. |
I will look into the Setting the handler before the player is ready works, but in that case my |
Ah, I see. Well, hopefully, the |
Loadstart does not work if preload = none on the video element i guess? We currently have at least some failing tests in that case if I switch to the loadstart event. |
Yes, you're right. In the |
So we are creating a quality switching plugin. When a user switches a quality while still playing or when the video is loaded, we want to seek to the time of the old source. We use this source change event to start listening for duration changed events so we know when we can seek. I'm also using the event to update my quality switching UI to determine if I should show the UI and what quality is currently active |
So |
I guess that #2326 is indeed related. I will check tomorrow if |
OK However the Flash tech only emits the event when the data is actually loaded, so it seems. Is it possible to also emit it there after the source changes? |
I don't love that the loadstart event fires twice for html5 in your case, but I guess it's better than nothing. We must be calling load() again somewhere. I created some tests just to verify how the video element is working in browsers. The states aren't consistent but the event firing is at least. And if you call load() on an element where loadstart was already fired, it will fire it again. Flash is another issue, and we need to make it line up with how HTML5 works. We have a previous discussion around handing loadstart in the player, and we may want to try to finish that for 5.0. |
I indeed found the same, that both setting the source and calling load emits I hope we can at least find some solution i can use instead of "inventing" my own source change event. |
For 5.0 we switched ready() to always execute listeners asynchronously, but for most internal use cases we would prefer the ready function to execute immediately if the component is already ready. Fixes videojs#2326 Related: videojs#2382, videojs#1667, videojs#2188
In the Brightcove Player, we need a way to detect that we are changing away from a video (e.g. in a playlist). The |
Anyone who liked this thread should chime in on #4660. |
This is addressed by #4660! |
I do not understand, it says "merged to master", but no such event in docs "sourceChange"
|
No need to ping multiple issues. It's generally best to open a new issue rather than replying on an old closed issue. |
@gkatsev okay, thank you. |
Our video.js based project allows to switch sources and to detect when a source has been switched we overwrote the
player.src
method to emit asourcechange
event.However, we want this event to only trigger as soon as it is guaranteed that
player.src()
will return the new source.Because setting the source using
player.src(...)
is done in aplayer.ready()
block, this is cumbersome for us.Currently we have code like the following:
It would be really useful if video.js itself could emit something like this
sourcechange
event as soon asplayer.src()
would return the new source, i.e. as soon as thetechSet('src')
is performed.Is this something that could be added?
The text was updated successfully, but these errors were encountered: