vlc.playlist.play() undefined... why??

All you've ever wanted to know about the ActiveX, Mozilla plugins, the web interface and various PHP extensions
SteveRicketts
Blank Cone
Blank Cone
Posts: 53
Joined: 29 May 2008 00:10

vlc.playlist.play() undefined... why??

Postby SteveRicketts » 19 Mar 2011 17:54

I'm trying to use VLC in a web page and it's working on FF/Linux but not IE/Windows. I'm using 1.1.7 and have Javascript access to the VLC object. In the script debugger I can get information on the VLC object (MRL, playlist.isPlaying, playlist.itemCount, input.length,position,rate,etc. but when I add the vlc.playlist.play() it says undefined. What's up with that?? How do I fix?

sr

SteveRicketts
Blank Cone
Blank Cone
Posts: 53
Joined: 29 May 2008 00:10

Re: vlc.playlist.play() undefined... why??

Postby SteveRicketts » 20 Mar 2011 12:24

That was a stupid question. The debugger is showing undefined because vlc.playlist.play() doesn't return a value. I've been working to try and get this working so long without any luck, I was grasping at straws. I'm trying to create vlc in the onload event so I can calculate the best width/height. I just get a black window but nothing plays. If anyone sees why the following code won't work in Windows/IE (it does in Linux/Firefox), I'd appreciate a tip.

function makeVLC(theURL) {
document.getElementById('divVideo').innerHTML = '';
var s='';
s = '<object id="VLCIE" classid="clsid:9BE31822-FDAD-461B-AD51-BE1D1C159921" '
s = s + 'codebase="http://downloads.videolan.org/pub/video ... /axvlc.cab"'
s = s + 'version="VideoLAN.VLCPlugin.2" '
s = s + 'width="' + vidWidth + '" height="' + vidHeight + '" '
s = s + 'events="True">'
s = s + '<param name="MRL" value="' + theURL + '"/>'
s = s + '<param name="ShowDisplay" value="true" />'
s = s + '<param name="autoLoop" value="true"/>'
s = s + '<param name="autoPlay" value="true"/>'
s = s + '<embed type="application/x-vlc-plugin" '
s = s + 'width="' + vidWidth + '" height="' + vidHeight + '" '
s = s + 'autoplay="yes" loop="yes" '
s = s + 'id="VLC" '
s = s + 'pluginspage="http://www.videolan.org" version="VideoLAN.VLCPlugin.2" '
s = s + 'target="' + theURL + '" '
s = s + '>'
s = s + '</embed>'
s = s + '</object>'
document.getElementById('divVideo').innerHTML = s;
}

jack.ting
Blank Cone
Blank Cone
Posts: 35
Joined: 19 Jan 2011 04:04

Re: vlc.playlist.play() undefined... why??

Postby jack.ting » 21 Mar 2011 08:04

Hi, SteveRicketts:

My javascript can fine work with IE and FF.
I use document.write() to create the VLC instance.
And on the onload event of the web page, add items to playlist (by vlc.playlist.add()),
then start to play them by register a SetTimeout().

Code: Select all

function WriteVLC(str, xsz, ysz) { // for netscape plugin if (navigator.plugins && navigator.mimeTypes && navigator.mimeTypes.length) document.write('<object type="application/x-vlc-plugin" version="VideoLAN.VLCPlugin.2" pluginspage="http://www.videolan.org"'); else // for IE ActiveX document.write('<object classid="clsid:9BE31822-FDAD-461B-AD51-BE1D1C159921" codebase="http://download.videolan.org/pub/videolan/vlc/0.8.6c/win32/axvlc.cab"'); document.writeln(' id="'+str+'" name="'+str+'" width='+xsz+' height='+ysz+' events="true">'); // OK, But I'll change the MRL later. // document.writeln('\t<param name="MRL" value="" />'); // Bug??, cannot work with IE // document.writeln('\t<param name="volume" value="0" />'); // document.writeln('\t<param name="autoplay" value="no" />'); // document.writeln('\t<param name="loop" value="yes" />'); document.writeln('</object>'); }
on web page (you need to init. the scr.Hi, scr.W1, scr.W2)

Code: Select all

<tr> <td class=main><script type="text/javascript">WriteVLC("vlc0", scr.W1, scr.Hi);</script></td> <td class=main><script type="text/javascript">WriteVLC("vlc1", scr.W2, scr.Hi);</script></td></tr>


Return to “Web and scripting”

Who is online

Users browsing this forum: No registered users and 4 guests