Reputation: 4227
In mediaElementjs the setSrc method doesnt work when its using youtube plugin? This is my code
media.setSrc("http://www.youtube.com/watch?v=xxxxxxxx");
Now in the definition of setSrc the library does
this.pluginApi.setSrc(mejs.Utility.absolutizeUrl(url));
but this.pluginApi.setSrc doesnt exist when using youtube plugin and html5 player.
Upvotes: 1
Views: 839
Reputation: 176
Looking at the source for the mediaelements
flash video player (FlashMediaElement.as) you can see that it does not currently support switching what backs _mediaElement
after the constructor creates _mediaElement
as either VideoElement
or YouTubeElement
. This means that if you start the player with a youtube source:
<video width="640" height="360" id="player1" preload="none">
<source type="video/youtube" src="http://www.youtu.be/nOEw9iiopwI" />
</video>
Then, your setSrc()
call with subsequent YouTube clips will work just fine... but, you still will not be able to switch back to non-youtube videos.
Currently, the only way to switch back and forth between youtube and non-youtube is to detect the switch on your own and destroy the element that you added mediaelements
to, create a new one, then call setSrc on the new one. Not pretty, but it will get the job done.
Upvotes: 1