Playlist stops after each playlist item and doesn't loop

All you've ever wanted to know about the ActiveX, Mozilla plugins, the web interface and various PHP extensions
mreichbaum
New Cone
New Cone
Posts: 3
Joined: 29 Sep 2010 10:21

Playlist stops after each playlist item and doesn't loop

Postby mreichbaum » 11 Nov 2010 13:33

hi,
i am using the vlc firefox plugin 1.1.4 and want some movies played looped in a playlist.
the problem is the movie stops playing after each playlist item and the playlist also doesn't loop at the end.

here is the code:

Code: Select all

<embed type="application/x-vlc-plugin" pluginspage="http://www.videolan.org" version="VideoLAN.VLCPlugin.2" width="640" height="480" loop="true" id="vlc"> </embed> <script> var vlc = document.getElementById("vlc"); vlc.playlist.add('http://localhost/movies/bla.mp4', "bla"); vlc.playlist.add('http://localhost/movies/bla.mp4', "bla"); vlc.playlist.play(); </script>
any ideas??

thanks,
marc

ettin
New Cone
New Cone
Posts: 2
Joined: 06 Jan 2011 05:44

Re: Playlist stops after each playlist item and doesn't loop

Postby ettin » 06 Jan 2011 06:35

ive not been able to get looping to work at all, even on a per item basis. Doesnt work in html5 either, or the stock flashplayer, must be some sort of conspiracy...

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

Re: Playlist stops after each playlist item and doesn't loop

Postby jack.ting » 20 Jan 2011 08:02

I've the same trouble on XP sp3, IE8 with VLC 1.1.5, too.

With the following script, I can restart the "current" playlist item "manually" (by hook this function on a button), but can not backward to the 1st item.
It work no matter the status of the player is paused, playing or ended.

Code: Select all

function doStart(vlc) { vlc.playlist.stop(); vlc.playlist.play(); }
Also, I try to catch the "MediaPlayerEndReached" event.
and yes the event handler function triggered,
but I can not identified the event source obj, also. (I've multiple VLC obj on the same page).

In the "MediaPlayerEndReached" event handler
I try to call my doStart() function, but the system got jammed on "vlc.playlist.stop()".
I try to change the "vlc.input.time" but in vain (the time value did changed).

I'll keep trying to find out the work around solution for the loop feature.

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

Re: Playlist stops after each playlist item and doesn't loop

Postby jack.ting » 21 Jan 2011 04:57

Ok, finally it works.

The keys are:
1. use "vlc.playlist.playitem(0)" instead of "vlc.playlist.play()"
2. extend a variable to tracking which item is the current playing (or ended) item.

below is the workable example (sorry, I tested it by IE only, it's not tested for firefox)

Code: Select all

<head> <title>VLC Web Demo</title> <meta http-equiv="Content-Type" content="text/html; charset=utf8"> <link href="./demopg.css" rel=stylesheet type="text/css"> <script language="JavaScript"> var vLoc = window.location.href ; var vBase = vLoc.substr(0, vLoc.lastIndexOf("/")-1) + "Video/" ; var vlcs = new Array(); var sdata = new Array(); sdata['vlc0'] = { URL: vBase+"MOV108.MOD" } ; // Single playlist item example sdata['vlc1'] = { URL: [ // Multiple playlist items examples vBase+"MOV108.MOD", vBase+"00011.avi", vBase+"00010.avi", vBase+"MOV13F.avi", vBase+"00019.avi" ] } ; function doNext(e) { for (var i in vlcs) { if(vlcs[i].input.state == 6) { // Ended if (vlcs[i].playlist.itemCount == vlcs[i].playindex) { vlcs[i].playlist.playitem(0); vlcs[i].playindex = 1; } else { vlcs[i].playlist.next(); vlcs[i].playindex ++; } } } return false; } function LoadTarget() { for (var i in vlcs) { vlcs[i].playlist.items.clear(); vlcs[i].attachEvent('MediaPlayerEndReached', doNext); if (typeof(sdata[i].URL) == 'string') { vlcs[i].playlist.add(sdata[i].URL); } else { for (var j in sdata[i].URL) vlcs[i].playlist.add(sdata[i].URL[j]); } vlcs[i].playlist.play(); vlcs[i].playindex = 1; // Extended variable for tracking current playlist item (count from 1) } document.getElementById('btn_load').disabled = 1; document.getElementById('btn_StartAll').disabled = 0; document.getElementById('btn_PauseAll').disabled = 0; } function doStart(vlc) { vlc.playlist.stop(); vlc.playlist.playitem(0); // restart from 1st item return false; } function StartAll() { for (var i in vlcs) doStart(vlcs[i]); } function doPause(vlc) { if (vlc.playlist.isPlaying) vlc.playlist.togglePause(); else vlc.playlist.play(); return false; } function PauseAll() { for (var i in vlcs) doPause(vlcs[i]); } function WriteVLC(str, xsz, ysz) { document.write('<object classid="clsid:9BE31822-FDAD-461B-AD51-BE1D1C159921"\n'); document.write(' codebase="http://downloads.videolan.org/pub/videolan/vlc/latest/win32/axvlc.cab"\n'); document.write(' id="'+str+'" name="'+str+'" width='+xsz+' height='+ysz+' events="True">\n'); document.write('<param name="Src" value="" />\n'); document.write('<param name="AutoPlay" value="False" />\n'); document.write('<param name="AutoLoop" value="True" />\n'); document.write('<param name="Volume" value="0" />\n'); document.write('<embed type="application/x-vlc-plugin" name="'+str+'" width="'+xsz+'" height="'+ysz+'" />\n'); document.write('</object>\n'); } function fnInit() { for (var i in sdata) vlcs[i] = new Object; for (var i in vlcs) vlcs[i] = document.getElementById(i); } </script> </head> <body onload="fnInit();"> <table border=1> <tr><td class="cn"> <script language="JavaScript">WriteVLC("vlc0", 200, 150);</script> </td><td class="cn"> <script language="JavaScript">WriteVLC("vlc1", 200, 150);</script> </td><td class="cn"> <br><Input type=button id=btn_load onClick="LoadTarget();" value="Load Target"><br><br> <Input type=button id=btn_StartAll onClick="StartAll();" value="Restart All" disabled><br><br> <input type=button id=btn_PauseAll onClick="PauseAll();" value="Pause All" disabled><br><br> </td></tr> </table> </body>

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

Re: Playlist stops after each playlist item and doesn't loop

Postby jack.ting » 21 Jan 2011 05:23

Sorry, I forget to note you the restriction:
1. I do not load the media source at startup, because I got trouble to play all instances automatically, so I use a "load target" button to start playing. (It works 99%, sometime I still have to kiil the browser process and restart.)
2. You have to "Pause" then "Stop" all the playing instance before you close the browser or reload the web page, it always hangs if the media is playing.
3. Sometimes the browser process will not be terminated, even I "Pause" all the playing instance.
4. Do not "Pause" then "Stop" in one function, it still hang the system. It has to be done one by one (ie. by a "pause all" button then a "stop all" button)
And, I still don't know why??

612wharfavenue
Blank Cone
Blank Cone
Posts: 11
Joined: 10 Jan 2011 01:01

Re: Playlist stops after each playlist item and doesn't loop

Postby 612wharfavenue » 06 Feb 2011 05:18

Thanks for the effort in trying to overcome the developers mental deficiencies. Does this loop seamlessly? Ive not been able to find any players yet that can loop at all, except for html5 on FF which requires a special addon to enable it, and its not seamless by any means. Well, i guess apng will do, if only my users dont mind me taking over a stick or two of their ram.

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

Re: Playlist stops after each playlist item and doesn't loop

Postby jack.ting » 07 Feb 2011 15:56

Smoothly ?

Well, it does loop, but with a very short time (within 1 sec, sometime its not so obvious) of black screen.
Within my demo task it's enough, and it runs without crash at least for 1 hour.

P.S.
Lately, I use a timer to trigger the "load target" function. And it do work, if the timer is long enough (otherwise it will crash).
So, now my trouble is the treads did not close smoothly when the page closed. It usually close the browser window, but leave the processes keep running on the background. I've to kill it manually.


Return to “Web and scripting”

Who is online

Users browsing this forum: No registered users and 8 guests