Trouble with .attr and flash
Hello everyone,
I'm having a... I'm guessing a compatibility issue with .attr. My goal is to replace a youtube video's source with another when a link is clicked.
So far it works great in Firefox 3.5+, but Chrome, IE8 and Safari aren't doing it at all.
This is my code for the player:
- <div id="vidPlay">
- <object class="vidTest" width="640" height="429">
- <param id="vidPlayParam" name="movie" value="YOUTUBE LINK 1"> </param>
- <param name="allowFullScreen" value="true"></param>
- <param name="allowscriptaccess" value="always"></param>
- <embed id="vidPlayMovie" src="YOUTUBE LINK 1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="640" height="429"></embed>
- </object>
- </div>
The controller/button:
- <div id="vidPlayCtrl">
- <a class="Ctrl" href="#vidPlay">Play 1.</a>
-
- <script type="text/javascript">
- // <![CDATA[
- $(".Ctrl").click(function () {
- $("#vidPlayParam").attr("value","YOUTUBE LINK 2");
- $("#vidPlayMovie").attr("src","YOUTUBE LINK 2");
- });
- // ]]>
- </script>
- </div>
Any help would be appreciated. Thanks.