Hi! I have the following problem and it would be nice if you could help me .
I have embedded the windows media player plugin to my site. The user can choose from a selct menu which video to play and on changing the select menu, the video should start to play.
The media player plugin:
The select menu:
The javascript function (please read comments):
Do you have an idea, how i can get the video starting?
Thanks for your help!
Conrad
I have embedded the windows media player plugin to my site. The user can choose from a selct menu which video to play and on changing the select menu, the video should start to play.
The media player plugin:
Code:
<OBJECT id='mediaPlayer1'
classid='CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95'
codebase='[URL unfurl="true"]http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701'[/URL]
standby='Loading Microsoft Windows Media Player components...' type='application/x-oleobject'>
<param name='fileName' value="">
<param name='animationatStart' value='true'>
<param name='transparentatStart' value='true'>
<param name='autoStart' value="true">
<param name='showControls' value="true">
<param name='ShowStatusBar' value="true">
<param name='loop' value="false">
<param name='autosize' value="1">
<EMBED type='application/x-mplayer2' pluginspage='[URL unfurl="true"]http://microsoft.com/windows/mediaplayer/en/download/'[/URL] id='mediaPlayer2' src="" Name='MediaPlayer2' ShowControls=1 ShowDisplay=0 ShowStatusBar=1 width="350" height="350" bgcolor='darkblue'> </EMBED>
</OBJECT>
Code:
<select name="videos" id="goToVideo" size="1" onChange="showVideo(this,'Please select a video!')">
<option>- - select video - -</option>
<option value="videos/video1.avi">video1</option>
...
</select>
Code:
<script language="javascript">
function showVideo(selObj, noselectionWarning){
var newIndex = selObj.selectedIndex;
if ( newIndex == 0 ) {
alert(noselectionWarning);
} else {
// for Internet explorer -> THIS WORKS! Video
// starts automatically:
document.getElementById('mediaPlayer1').fileName = selObj.options[newIndex].value;
// YET NOT for Firefox, i can set the source, and the
// autostart attribute, yet the video does not start
// automatically:
document.getElementById('mediaPlayer2').src = selObj.options[newIndex].value;
document.getElementById('mediaPlayer2').autostart = true;
}
</script>
Thanks for your help!
Conrad