Page 1 of 1

Mozilla Plugin Acting Strange (may be Javascript Issues)

Posted: 03 Feb 2006 17:40
by NeppyMan
I'm working on using the VLC plugin to embed a streaming video viewer. I'm using PHP to handle browser detection (to decide between the ActiveX and FF plugins), and I'm running into a brick wall. This is the code from a test HTML page that I used to see if the FF plugin work work:

Code: Select all

<EMBED TYPE="application/x-vlc-plugin" NAME="stream" AUTOPLAY="yes" LOOP="no" WIDTH="320" HEIGHT="240" TARGET="http://127.0.0.1:8800/" /> <br /> <INPUT TYPE="button" value="Start Stream" onclick='document.stream.play();'> <INPUT TYPE="button" value="Stop Stream" onclick='document.stream.stop();'><br /> (double-click video image to go to full-screen playback, double-click returns)<br />
This works just fine. The PHP file I use outputs the following on FF:

Code: Select all

<TABLE BORDER="2" BGCOLOR="#000000"><TR><TD HEIGHT="480" WIDTH="720"> <EMBED TYPE="application/x-vlc-plugin" NAME="stream" AUTOPLAY="yes" LOOP="no" WIDTH="720" HEIGHT="480" TARGET="http://127.0.0.1:8800/" /> </TD></TR></TABLE><TABLE BORDER="2" BGCOLOR="#AAAAAA"><TR ALIGN="center"><CENTER> <TD><INPUT TYPE="button" VALUE="Play Stream" onclick="document.stream.play();"></TD> <TD><INPUT TYPE="button" VALUE="Stop Playing" onclick="document.stream.stop();"></TD> <TD>Mute<INPUT TYPE="checkbox" VALUE="Mute" onclick="document.stream.mute();"></TD> <TD>Volume</TD><TD>0<INPUT TYPE="radio" NAME="volume" VALUE="0" onclick="document.stream.set_volume(0);"></TD> <TD>25<INPUT TYPE="radio" NAME="volume" VALUE="25" onclick="document.stream.set_volume(50);"></TD> <TD>50<INPUT TYPE="radio" NAME="volume" VALUE="50" onclick="document.stream.set_volume(100);" CHECKED></TD> <TD>75<INPUT TYPE="radio" NAME="volume" VALUE="75" onclick="document.stream.set_volume(150);"></TD> <TD>100<INPUT TYPE="radio" NAME="volume" VALUE="100" onclick="document.stream.set_volume(200);"></TD> </TR></TABLE>
This doesn't work, and FF's Javascript console says that document.stream.play doesn't exist. As far as I can tell, the two snippets are absolutely identical. Now, for IE, the Start and Stop buttons don't throw errors, but the mute and volume controls do (and don't work).

Like the title says, I suspect this is a Javascript error on my part, but I'm not sure. Also, I'm sure people would like to see some examples of how to use the FF plugin in action. I can post the IE code too, if people would like, and even the PHP browser stuff. I'm looking mostly for a second pair of eyes here. :wink:

Posted: 04 Feb 2006 17:08
by tonsofpcs
What happens if you don't put it inside of a table?

Posted: 06 Feb 2006 17:11
by NeppyMan
After further testing, it seems to be a very strange error, although I still haven't figured it out. When the PHP file renders, the output doesn't work properly (it throws the Javascript function not found error). Interestingly enough, if the HTML (as received by the browser) is copied and pasted into an HTML file... it works perfectly. This is mind-boggling. The code above will work perfectly (table or otherwise) in an HTML file (so feel free to yoink it if you want).

I'd love to know why FF (and IE) render a .PHP file different from an .HTML file... especially when everything - including the HTML headers - are identical. Blargh.

Posted: 08 Feb 2006 00:11
by tonsofpcs
Can you post the two files (or samples of this effect) at ftp://streams.videolan.org/incoming ?

Posted: 01 Mar 2006 01:38
by ken
or place the embed command in a valid table, the DOM only allows table descriptor tags inside the table tag [CAPTION?, (COL*|COLGROUP*), THEAD?, TFOOT?, TBODY+]. you might want to fix the html and see if that helps. I wouldn't be surprised if Javascript can't find your embed tag in the DOM and as such the "stream" property isn't recognized.