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
Uncaught TypeError: this.pluginApi.setSrc is not a function #1759
Comments
i got the same probleme today with some diging i answered myself |
@scotepi Is this still an issue? |
This is still an issue in 2.22.0. It occurs at line 754 of mediaelement-and-player.js when pluginType is 'youtube':
This fails because 'this.pluginApi' is a YT.Player which doesn't have a setSrc method. It will need to be replaced with some code like this to work:
Or alternatively delete the exisiting player and create a new one. There'll be a similar issue at line 760. |
Thanks for your comments. I'll check the code above with YouTube and native player to make sure everything is fine and I'll add it to the core method. Thanks! |
I've been playing around some more with this and one issue is that loadVideoById from the YouTube API will autoplay regardless of the current state of the player. This seems undesirable. I implemented an event-based solution to this and then struck another issue where removeEventListener does not seem to be functional on the YouTube API. Anyway, I do have a working solution which autoplays the video if the current video is playing, or loads the video in a paused state if it's not:
|
@dazweeja I created a PR based on your comments; please test it and let me know if it works for you |
Closing issue since fix has been merged |
When changing the src of a YouTube video with player.setSrc() there is an error that it is not a function.
The text was updated successfully, but these errors were encountered: