...

View Full Version : Browser/script compatibility problems



grobar
05-26-2005, 01:37 PM
Hello everyone. I have been pouring over this script for a long time, and simply can not get it to work in netscape/FF.

http://24.222.30.107/devroot/meida/index.asp

It works just fine in IE, and behaves in the exact manner I would like.

The problem with the mozilla browsers, is that the .js scripting does not work, thus, no filename gets fed in to the player, nor do the buttons work.

here is the code along with the two .js includes:


<table class="movieinnertable" cellpadding="0" cellspacing="0">
<tr>
<td class="tdmovieinnertable1">&nbsp;</td>

<td class="tdmovieinnertable2">
<object id="mediaPlayer" classid="CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95" codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701" standby="Loading Microsoft Windows Media Player components..." type="application/x-oleobject" width="320" height="240" >
<param name="fileName" value=""/>
<param name="animationatStart" value="0"/>
<param name="transparentatStart" value="0"/>
<param name="autoStart" value="-1"/>
<param name="showControls" value="0"/>
<param name="AudioStream" value="-1"/>
<param name="AutoSize" value="0"/>
<param name="AllowScan" value="-1"/>
<param name="AllowChangeDisplaySize" value="-1"/>
<param name="AutoRewind" value="-1"/>
<param name="Balance" value="0"/>
<param name="BaseURL" value=""/>
<param name="BufferingTime" value="5"/>
<param name="CaptioningID" value=""/>
<param name="ClickToPlay" value="-1"/>
<param name="CursorType" value="0"/>
<param name="CurrentPosition" value="-1"/>
<param name="CurrentMarker" value="0"/>
<param name="DefaultFrame" value=""/>
<param name="DisplayBackColor" value="0"/>
<param name="DisplayForeColor" value="16777215"/>
<param name="DisplayMode" value="0"/>
<param name="DisplaySize" value="4"/>
<param name="Enabled" value="-1"/>
<param name="EnableContextMenu" value="-1"/>
<param name="EnablePositionControls" value="-1"/>
<param name="EnableFullScreenControls" value="0"/>
<param name="EnableTracker" value="-1"/>
<param name="InvokeURLs" value="-1"/>
<param name="Language" value="-1"/>
<param name="Mute" value="0"/>
<param name="PlayCount" value="1"/>
<param name="PreviewMode" value="0"/>
<param name="Rate" value="1"/>
<param name="SAMILang" value=""/>
<param name="SAMIStyle" value=""/>
<param name="SAMIFileName" value=""/>
<param name="SelectionStart" value="-1"/>
<param name="SelectionEnd" value="-1"/>
<param name="SendOpenStateChangeEvents" value="-1"/>
<param name="SendWarningEvents" value="-1"/>
<param name="SendErrorEvents" value="-1"/>
<param name="SendKeyboardEvents" value="0"/>
<param name="SendMouseClickEvents" value="0"/>
<param name="SendMouseMoveEvents" value="0"/>
<param name="SendPlayStateChangeEvents" value="-1"/>
<param name="ShowCaptioning" value="0"/>
<param name="ShowAudioControls" value="-1"/>
<param name="ShowDisplay" value="0"/>
<param name="ShowGotoBar" value="0"/>
<param name="ShowPositionControls" value="-1"/>
<param name="ShowStatusBar" value="0"/>
<param name="ShowTracker" value="-1"/>
<param name="VideoBorderWidth" value="0"/>
<param name="VideoBorderColor" value="0"/>
<param name="VideoBorder3D" value="0"/>
<param name="Volume" value="-440"/>
<param name="WindowlessVideo" value="0"/>

<embed type="application/x-mplayer2"
pluginspage="http://www.microsoft.com/windows/windowsmedia/en/download/plugin.asp"
src=""
name="MediaPlayer"
autoplay="true"
showcontrols="1"
showstatusbar="0"
showgotobar="0"
width="320"
height="240">
</embed></object>
</td>
<td class="tdmovieinnertable3">&nbsp;</td>
</tr>
<tr>
<td class="tdmovieinnertable4" colspan="3">

<!--Begin Media Control Scripts & Drop-Down Selection Box-->
<script src="streamlist.js" type="text/JavaScript"></script>
<center><form name="playerCtrl" action="">
&nbsp;&nbsp;&nbsp;&nbsp;<a class="submithover"><input type="button" value="[pause]" name="playOrPause" onclick="handlePlayOrPauseClick()" class="submithover" /></a>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a class="submithover"><input type="button" value="[show controls]" name="controls" onclick="handleControlsOnOffClick()" class="submithover" /></a><br /><br />
<script src="streamchg.js" type="text/javascript"></script>
</form>
</center>
</td>
</tr>
<tr>
<td class="tdmovieinnertable5" colspan="3">
&nbsp;</td>
</tr>
</table>

HEre is the streamchg.js include:


with (document)
{
writeln('<select name="streams" onchange="change()" style="border: 0px solid #282484; color:#282484; font-family:Verdana; font-weight:normal; font-size:13px">');
for (var i = 0; i < streams.length; i++)
{
writeln('<option value="', streams[i].url, '">', streams[i].name);
}
writeln('</select>');
}

and now here is streamlist.js, which is POSSIBLY where the issues lies:



var streams = new Array();
streams[0] = new makeStream("", "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Select A Media File From The List And It Will Play&nbsp;&nbsp;&nbsp;&nbsp;");
streams[1] = new makeStream("", "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;");
streams[2] = new makeStream("", "[DRUNKEN ADVENTURES]");
streams[3] = new makeStream("media/4.wmv", "&nbsp;&nbsp;&nbsp;&nbsp;1...Impression of Carelton Skiing");
streams[4] = new makeStream("media/5.wmv", "&nbsp;&nbsp;&nbsp;&nbsp;2...Impression of Will Skiing");
streams[5] = new makeStream("media/6.wmv", "&nbsp;&nbsp;&nbsp;&nbsp;3...Cooking Burgers After The Palace");
streams[6] = new makeStream("media/7.wmv", "&nbsp;&nbsp;&nbsp;&nbsp;4...Impression of Tom Green Scuba-Diving (1)");
streams[7] = new makeStream("media/8.wmv", "&nbsp;&nbsp;&nbsp;&nbsp;5...Impression of Tom Green Scuba-Diving (2)");
streams[8] = new makeStream("media/11.wmv", "&nbsp;&nbsp;&nbsp;&nbsp;6...Jerry Likes Boys");
streams[9] = new makeStream("media/12.wmv", "&nbsp;&nbsp;&nbsp;&nbsp;7...Jerry Will Kick All of Their Asses");
streams[10] = new makeStream("media/13.wmv", "&nbsp;&nbsp;&nbsp;&nbsp;8...Scott - Dr Evil Impression");
streams[11] = new makeStream("media/14.wmv", "&nbsp;&nbsp;&nbsp;&nbsp;9...Scott - Bumble Bee Impression");


function makeStream(url, name) {
this.url = url;
this.name = name;
}
function handleControlsOnOffClick() {
if (document.mediaPlayer.showControls == true) {
document.mediaPlayer.showControls = false;
document.playerCtrl.controls.value = "[show controls]";
}
else {
document.mediaPlayer.showControls = true;
document.playerCtrl.controls.value = "[hide controls]"
}}
function handlePlayOrPauseClick(){
var state;
playerStatus = document.mediaPlayer.playState;
if (playerStatus == 6) {
document.mediaPlayer.play();
document.playerCtrl.playOrPause.value = "[pause]";
}
else if (playerStatus == 1) {
document.mediaPlayer.play();
document.playerCtrl.playOrPause.value = "[pause]";
}
else if (playerStatus == 2) {
document.mediaPlayer.pause();
document.playerCtrl.playOrPause.value = "[play]";
}
}
function changeSize(newSize) {
document.mediaPlayer.displaySize = newSize;
}
function change() {
var list = document.playerCtrl.streams;
var streamURL = list.options[list.selectedIndex].value;
document.getElementById('mediaPlayer').stop()
document.playerCtrl.playOrPause.value = "[pause]";
document.getElementById("mediaPlayer").fileName = streamURL;
document.getElementsByTagName("embed")[0].src=streamURL;

}



Any insight, or help would be appreciated! (sorry about the sloppiness of the code)

rwedge
05-26-2005, 05:42 PM
This line in streamlist.js gives an error in IE - null or not an object

document.getElementsByTagName("embed")[0].src=streamURL;

What's the [0] for?

As it is now, this line makes it work in IE

document.getElementById("mediaPlayer").fileName = streamURL;

Browsers who use the embed are out of luck.

/Bob



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum