I'd like to change the source swf file of a YouTube video. The video is an <embed>
element.
How it's built:
<embed width="640" id="movie_player-flash" height="390"
tabindex="0" type="application/x-shockwave-flash"
src="http://s.ytimg.com/yt/swfbin/watch_as3-vfl07wZSq.swf" flasvars="...">
(An example may be found on Google's YouTube channel)
I left out some attributes and the content of flashvars
as it is a long string with settings, does this affect the video at all?
What I've tried:
I tried by simply changing the
src
attribute, but that doesn't affect anything:document.getElementById('movie_player-flash').src = url;
I also tried to clone the original, change the source and re-append it. And again: nothing:
var player = document.getElementById('movie_player-flash'); var playerClone = player.cloneNode(true); playerClone.setAttribute('src', url); player.parentNode.replaceChild(playerClone, player);
Does anybody know how to accomplish changing the video source?