I'm using Apple's provided AC_QuickTime.js to generate the object tag for embedding a quicktime object. I then assign that to a div's innerHTML property. This is done in the global scope as the page loads due to errors encountered on doing it in the window load event. Finally in the window load event I call play on the object (acquired via document.embeds).
If this is done as the root page, it works as expected. If this is done in the IFrame as I need to, then an error occurs Error calling method on NPObject!
.
I thought maybe this was a timing issue, so I attempted just calling the Play() via a form button with no change. I then tried using a document.write within the div itself just to see if the object wasn't getting loaded soon enough, with no change. Finally I tried statically inserting the object markup into the div, and that worked.
My thought is that I'm just inserting this dynamically in an incorrect manner and I'm looking for thoughts what the correct manner would be.
Thanks in advance!
My code looks something like the following:
Event.observe(window, 'load', init);
var quicktime = $('quicktime');
quicktime.innerHTML = QT_GenerateOBJECTText(
'stream0',
'100%', '100%',
'',
'obj#id', 'stream0',
'emb#NAME', 'stream0',
'EnableJavaScript', 'True',
'AUTOPLAY', 'False',
'SCALE', 'Aspect',
'CONTROLLER', 'False',
'TYPE', 'video/quicktime',
'POSTDOMEVENTS', 'True',
'SHOWLOGO', 'False',
'QTSRC', 'rtsp://url');
function init() {
document.embeds[0].Play();
}
Markup:
...
<body>
<div id="quicktime" style="width: 100%; padding: 0px; margin 0px;"></div>
</body>
...