Im having issues getting below code to convert to query and work:
The original javascript:
<script type="text/javascript">
function getFlashMovie(movieName) {
var isIE = navigator.appName.indexOf("Microsoft") != -1;
return (isIE) ? window[movieName] : document[movieName];
}
function stream() {
var active = document.getElementById("start").value == "stop";
getFlashMovie("v1stream").setProperty("src", !active ? document.getElementById('url2').value : null);
</script>
Converted and modified jquery version:
$(document).ready(function() {
alert ('before');
swfobject.getObjectById("v1stream").setProperty("src", "rtmp://localhost/mystream");
alert ('after');
});
- first snippet works 2nd not
- getting an error swfobject.getObjectById(“v1stream”) is null
- It never throws the 2nd alert ‘after’ so it crashes on getting the swfobject…
- tried all kinds of things for about an hour now, anyone knows how to fix this? thx
UPDATE:
This is the html used
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553534700"
id="v1stream" width="562" height="547"
codebase="http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab">
<param name="movie" value="/assets/im.swf"/>
<param name="quality" value="high"/>
<param name="bgcolor" value="#000000"/>
<param name="allowFullScreen" value="true"/>
<param name="allowScriptAccess" value="always"/>
<embed src="/assets/v1stream.swf" quality="high" bgcolor="#000000"
play="true" loop="false" quality="high"
allowFullScreen="true"
allowScriptAccess="always"
type="application/x-shockwave-flash"
pluginspage="http://www.adobe.com/go/getflashplayer">
</embed>
</object>
The jQuery version should be:
I’m not 100% sure this will work for you as I’m not sure what the
swfobjectscript does when you call.setProperty(), but if you just want to change an attribute on an element, you can do so with the code above.Docs:
document.ready: http://api.jquery.com/ready/.attr(): http://api.jquery.com/attr