Skip to content
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

there's no canplay or canplaythrough for Youtube? #600

Open
onigetoc opened this issue Dec 4, 2022 · 0 comments
Open

there's no canplay or canplaythrough for Youtube? #600

onigetoc opened this issue Dec 4, 2022 · 0 comments

Comments

@onigetoc
Copy link

onigetoc commented Dec 4, 2022

I did a promise for my videojs to play mp4 video and Youtube video.

But when you load anc change a video from mp4 then another one from Youtube in the same player. the promise may trigger to fast before the Youtube video is loaded that the spinner keep running without the video never being played.

I did it with a 'loadedmetadata' but it work only once.

I do not want to destroy the player and recreate a new one.
Because i found out the if you play multiple youtube videos one after the others they load faster. it slower if you recreate each time a new player. If i load a mp4 video in between, the first Youtube video after a mp4 will be slower because i guess that video js create a new iframe. but the problem is that my promise will trigger to fast and the video will never start.

I searched and wander if i can only destroy the events listener when i change the video provider (standard video like mp4 to a Youtube one)
I.E. destroy the loadedmetadata event and reload it when a new video provider change and the loadedmetadata will be destroyed.
Player.on('loadedmetadata', function () {...

I found a Youtube api player who check and create a canplay event state.

this.readyHandler = function() { this.canplay = true; this.previousTime = this.player.getCurrentTime(); this.trigger('videoStatus', this.player.getCurrentTime(), this.player.getDuration(), 'canplay'); }.bind(this);

To resume. The same video player will play mp4 and Youtube video, i made a promise to load video one page change like the Youtube website to make video like a autoplay, but on Youtube is only a ajax page loading. player the video thumbnail create a promise to autoplay the video in a ajax page.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant