Dynamically change embedded video src in IE/Chrome (works in Firefox)

Posted by macca1 on Stack Overflow See other posts from Stack Overflow or by macca1
Published on 2010-06-06T17:49:07Z Indexed on 2010/06/06 17:52 UTC
Read the original article Hit count: 168

Filed under:
|
|
|

I'm trying to dynamically change an embedded video on a page. It's working in Firefox but for some reason it's not working in IE and Chrome (strange combination). Here's the HTML:

   <object id="viewer" width="575" height="344">
        <param name="wmode" value="transparent" />
        <param name="movie" value="http://www.youtube.com/v/Lmn94kn08Lw&hl=en&fs=1&color1=0x006699&color2=0x54abd6&rel=0" />
        <param name="allowFullScreen" value="true" />
        <embed id="embeddedPlayer" src="http://www.youtube.com/v/Lmn94kn08Lw&hl=en&fs=1&color1=0x006699&color2=0x54abd6&rel=0" type="application/x-shockwave-flash" allowfullscreen="true" width="575" height="344" wmode="transparent"></embed>
    </object>

And here's my javascript code. A link is clicked to change the video:

        $("#video a").click(
            function() {
                var videoAddress = $(this).attr("href");
                $("#embeddedPlayer").attr("src", videoAddress);
                return false; // stop the default link so it just reloads in the video player
            }
        );

Like I said the videos are changing perfectly in Firefox but in IE and Chrome nothing happens. Any ideas?

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about jQuery