Link to home
Start Free TrialLog in
Avatar of kiqkinas
kiqkinasFlag for United States of America

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-B0F6-11D0-94AB-0080C74C7E95"
  standby="Loading Windows® Media Player components..."
  type="application/x-oleobject"
  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="EnablePositionControls" 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-8C17-4B23-BC80-D3488ABDDC6B"
  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>
Avatar of wfRGB
wfRGB

Does this work?

qtPlayer.SetTarget("http://www.mysite.com/audio/mp3/100101.mp3");
qtPlayer.Play();
Avatar of kiqkinas

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-8C17-4B23-BC80-D3488ABDDC6B" ' +
'  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.
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
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>
ASKER CERTIFIED SOLUTION
Avatar of wfRGB
wfRGB

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial