kiqkinas
asked on
Controlling embedded quicktime
I have developed several popup players. One embeds Windows Media Player (WMP) and uses javascript to contol it. another embeds Apple Quicktime (QT) and is suposed to work with JavaScript as well however it does not work.
Why doesn't the Quicktime player below work with JavaScript?
Working WMP exampe:
<OBJECT ID="Player"
classid="CLSID:22D6f312-B0 F6-11D0-94 AB-0080C74 C7E95"
standby="Loading Windows® Media Player components..."
type="application/x-oleobj ect"
width="320" height="45" VIEWASTEXT>
<PARAM NAME="ShowStatusBar" VALUE="false">
<PARAM NAME="ShowControls" VALUE="true">
<PARAM NAME='ShowDisplay' VALUE="false">
<PARAM NAME='Volume' VALUE='0'>
<PARAM NAME="ShowTracker" VALUE="true">
<PARAM NAME="EnableTracker" VALUE="true">
<PARAM NAME="ShowPositionControls " VALUE="true">
<PARAM NAME="EnablePositionContro ls" VALUE="true">
</OBJECT>
<script language="javascript">
// The asx file is a url pointer to the real .mp3 to enable streaming.
Player.FileName="http://www.mysite.com/audio/asx/100101.asx";
Player.play();
</script>
Non-working QT exampe:
<object classid="clsid:02BF25D5-8C 17-4B23-BC 80-D3488AB DDC6B"
codebase="http://www.apple.com/qtactivex/qtplugin.cab"
width="320" height="16" id="qtPlayer">
<param name="src" value="">
<param name="AUTOPLAY" value="true">
<param name="CONTROLLER" value="true">
<param name="volume" value="100">
<embed width="320" height="16"
src=""
pluginspace="http://www.apple.com/quicktime/download/"
type="audio/mpeg3"
autoplay="true"
controller="true"
volume="100"
enablejavascript="true"
name="qtPlayer">
</object>
<script language="javascript">
//QT only seems to work of I directly set the url to the mp3 file in src=
qtPlayer.src="http://www.mysite.com/audio/mp3/100101.mp3"
qtPlayer.play();
</script>
Why doesn't the Quicktime player below work with JavaScript?
Working WMP exampe:
<OBJECT ID="Player"
classid="CLSID:22D6f312-B0
standby="Loading Windows® Media Player components..."
type="application/x-oleobj
width="320" height="45" VIEWASTEXT>
<PARAM NAME="ShowStatusBar" VALUE="false">
<PARAM NAME="ShowControls" VALUE="true">
<PARAM NAME='ShowDisplay' VALUE="false">
<PARAM NAME='Volume' VALUE='0'>
<PARAM NAME="ShowTracker" VALUE="true">
<PARAM NAME="EnableTracker" VALUE="true">
<PARAM NAME="ShowPositionControls
<PARAM NAME="EnablePositionContro
</OBJECT>
<script language="javascript">
// The asx file is a url pointer to the real .mp3 to enable streaming.
Player.FileName="http://www.mysite.com/audio/asx/100101.asx";
Player.play();
</script>
Non-working QT exampe:
<object classid="clsid:02BF25D5-8C
codebase="http://www.apple.com/qtactivex/qtplugin.cab"
width="320" height="16" id="qtPlayer">
<param name="src" value="">
<param name="AUTOPLAY" value="true">
<param name="CONTROLLER" value="true">
<param name="volume" value="100">
<embed width="320" height="16"
src=""
pluginspace="http://www.apple.com/quicktime/download/"
type="audio/mpeg3"
autoplay="true"
controller="true"
volume="100"
enablejavascript="true"
name="qtPlayer">
</object>
<script language="javascript">
//QT only seems to work of I directly set the url to the mp3 file in src=
qtPlayer.src="http://www.mysite.com/audio/mp3/100101.mp3"
qtPlayer.play();
</script>
ASKER
No, it didn't but thanks anyway. Neither does document.qtPlayer.Play() or a dozen other variations I tried. Strange thing is the code below does work but I still can modify the src= through script.
<a href="javascript: document.qtPlayer.Play()"> Play</a>
I don't understand why it doesnt work but I remebered a brute force workaround. I just put the entire object into the javascript, modified the src= as required and set autoplay="true".
<script language="javascript">
var url="http://www.mysite.com/audio/smil/" + qs["code"] + ".mp3";
document.write('<object classid="clsid:02BF25D5-8C 17-4B23-BC 80-D3488AB DDC6B" ' +
' codebase="http://www.apple.com/qtactivex/qtplugin.cab" ' +
' width="320" height="16" id="Player"> ' +
' <param name="src" value="' + url + '"> ' +
' <param name="AUTOPLAY" value="true"> ' +
' <param name="CONTROLLER" value="true"> ' +
' <param name="volume" value="100"> ' +
' <param name="enablejavascript" value="true"> ' +
' <embed width="320" height="16" ' +
' src="' + url + '" ' +
' pluginspace="http://www.apple.com/quicktime/download/" ' +
' type="audio/mpeg3" ' +
' autoplay="true" ' +
' controller="true" ' +
' volume="100" ' +
' enablejavascript="true" ' +
' name="Player"> ' +
'</object> ');
</script>
<a href="javascript: document.qtPlayer.Play()">
I don't understand why it doesnt work but I remebered a brute force workaround. I just put the entire object into the javascript, modified the src= as required and set autoplay="true".
<script language="javascript">
var url="http://www.mysite.com/audio/smil/" + qs["code"] + ".mp3";
document.write('<object classid="clsid:02BF25D5-8C
' codebase="http://www.apple.com/qtactivex/qtplugin.cab" ' +
' width="320" height="16" id="Player"> ' +
' <param name="src" value="' + url + '"> ' +
' <param name="AUTOPLAY" value="true"> ' +
' <param name="CONTROLLER" value="true"> ' +
' <param name="volume" value="100"> ' +
' <param name="enablejavascript" value="true"> ' +
' <embed width="320" height="16" ' +
' src="' + url + '" ' +
' pluginspace="http://www.apple.com/quicktime/download/" ' +
' type="audio/mpeg3" ' +
' autoplay="true" ' +
' controller="true" ' +
' volume="100" ' +
' enablejavascript="true" ' +
' name="Player"> ' +
'</object> ');
</script>
If you havent allready i suggest you checkout some links on this page.
http://developer.apple.com/documentation/QuickTime/REF/QT41_HTML/QT41WhatsNew-72.html
This might also be of intresst.
http://developer.apple.com/documentation/QuickTime/REF/QT41_HTML/QT41WhatsNew-80.html
Let us know how it goes.
http://developer.apple.com/documentation/QuickTime/REF/QT41_HTML/QT41WhatsNew-72.html
This might also be of intresst.
http://developer.apple.com/documentation/QuickTime/REF/QT41_HTML/QT41WhatsNew-80.html
Let us know how it goes.
ASKER
Yes, I saw these. That's where I got the code to turn the player on and off however there doesn't appear to be a way to change the src= parameter with script. Thanks
ASKER
Comment for EE. I havn't abandoned this. I'm just waiting for a better answer. If this shows up on your radar as an old question, please close it and return the points.
If anyone else out there knows how to get this portion of the quicktime code to work, please post a solution.
<script language="javascript">
// QT plugin only seems to work if I directly set the url to the mp3 file (as in src="some_url")
qtPlayer.src="http://www.mysite.com/audio/mp3/100101.mp3" // Does not work. Why?
//QT plugin will only play if I use a link ( <a href="javascript: document.qtPlayer.Play()"> Play</a> )
qtPlayer.play(); // Does not work. Why?
</script>
If anyone else out there knows how to get this portion of the quicktime code to work, please post a solution.
<script language="javascript">
// QT plugin only seems to work if I directly set the url to the mp3 file (as in src="some_url")
qtPlayer.src="http://www.mysite.com/audio/mp3/100101.mp3" // Does not work. Why?
//QT plugin will only play if I use a link ( <a href="javascript: document.qtPlayer.Play()">
qtPlayer.play(); // Does not work. Why?
</script>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
qtPlayer.SetTarget("http://www.mysite.com/audio/mp3/100101.mp3");
qtPlayer.Play();