Page 1 of 1

play item (n) in playlist / javascript

Posted: 13 Sep 2006 20:24
by loesje
hello everyone,

can anybody show me the javascript-code to play a certain file in a playlist?


I have the index in the playlist (n)
I also have the name (file)

Since it seems a little trouble to do, I thought of a trick replacing file with file, and playing it ...

I tried: vlc.addTarget(file,null,8,n);

which as far as I know would replace some file with "file" and play it,
but it doesn't exactly; it keeps inserting, in stead of replacing.

I also tried "10" in stead of "8", and that did nada at all.
"12" appends, and "9" ... inserts also!


I have vlc embedded as object in IE6 and use it to see locally stored video in a local html page.

Can anybody help? I'd be glad! :)

Posted: 14 Sep 2006 10:34
by karlar
What i did was to clear the playlist and make a new one with current item on top.

channel_index = the item that you wont to play
chan_code= the path to item
base_url = yes the base url (part of the path to item)
vlc = the vlc object

Code: Select all

document.vlc.playlistClear(); var targetURL=""; for (var j = channel_index; j < chan_code.length; j++) { targetURL = base_url + chan_code[j]; document.vlc.addTarget(targetURL, options, 1, -666); } for(var j = 0; j < channel_index; j++) { targetURL =base_url + chan_code[j]; document.vlc.addTarget(targetURL, options, 1, -666); }
hope you can use it

Posted: 14 Sep 2006 19:43
by loesje
it works, thanks a lot!! :shock: