PDA

View Full Version : Embedding Quicktime dynamically?



iLLin
Mar 30th, 2007, 11:25 PM
Ok here is the thang, IE7 doesn't load up quicktime movies, they have to put loaded up with js. So that took me to this link:

http://www.apple.com/quicktime/tutorials/embed.html

Now yea there solution works and everything "ONLOAD" but not if I want to use it dynamically with AJAX.

Basically when the QT movie comes up, it says you need to download the latest plugin blah blah... But using the method with doc.write it works fine. Only problem is I am loading these into div tags and doc.write rewrites the whole page when called dynamically.

What I have tried so far:
Adding it to the div tag with innerHTML. //don't work

And creating elements, this is what I have now:


function insert_quicktime(src) {
var quicktime = $('quicktime');

var obj = document.createElement('object');
obj.setAttribute('classid', 'clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B');
obj.setAttribute('codebase', 'http://www.apple.com/qtactivex/qtplugin.cab');
obj.setAttribute('width', '320');
obj.setAttribute('height', '240');

var par = document.createElement('param');
par.setAttribute('src', src);
par.setAttribute('controller', 'false');
par.setAttribute('autoplay', 'true');

obj.appendChild(par);

var embed = document.createElement('embed');
embed.setAttribute('width', '320');
embed.setAttribute('height', '240');
embed.setAttribute('controller', 'false');
embed.setAttribute('autoplay', 'true');
embed.setAttribute('src', src);

obj.appendChild(embed);

quicktime.appendChild(obj);
}


Now IE7 doesn't like the line "obj.appendChild(embed);" for some reason... But even if I just append the embed to the quicktime div, it comes up with the download the plugin bs.

Anyone got any ideas?

iLLin
Mar 31st, 2007, 02:06 PM
wheres all the pros?

iLLin
Apr 1st, 2007, 05:32 AM
I really dont want to have to use iframes.... anyone got ideas?

rwedge
Apr 1st, 2007, 06:47 AM
You could write the quicktime code to a division with innerHTML
<script type="text/javascript">
<!-- /*<![CDATA[*/
function qt() {
var qt_html = '<OBJECT CLASSID="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" WIDTH="320" HEIGHT="240" '+
' CODEBASE="http://www.apple.com/qtactivex/qtplugin.cab">\n'+
'<PARAM name="SRC" VALUE="http://www.scififree.tv/unicast_mov/AFTVSciFiH264250.mov">\n'+
'<PARAM name="AUTOPLAY" VALUE="true">\n'+
'<PARAM name="CONTROLLER" VALUE="true">\n'+
'<PARAM name="SCALE" VALUE="tofit">\n'+
'<EMBED src="http://www.scififree.tv/unicast_mov/AFTVSciFiH264250.mov" height="240" '+
' width="320" scale="tofit" controller="true" autoplay="true" '+
'PLUGINSPAGE="http://www.apple.com/quicktime/download/">\n</EMBED>\n</OBJECT>';
document.getElementById('quicktime').innerHTML=qt_html;
}
/*]]>*/
// -->
</script>
<a href="javascript:qt()" title="">try it</a>
<div id="quicktime" align="center"> </div>

iLLin
Apr 1st, 2007, 02:23 PM
...
What I have tried so far:
Adding it to the div tag with innerHTML. //don't work
...


Anyone else?

rwedge
Apr 1st, 2007, 06:25 PM
It works just fine, just you may have something else in mind and are not clear about it.

iLLin
Apr 1st, 2007, 08:21 PM
Your trying to tell me that you can load a quicktime movie into IE7 dynamically and have it play? Please show me an example.

iLLin
Apr 1st, 2007, 08:23 PM
Hmm I tried yours and it worked, but mines messed up... I will mess with this some more, thanks!