Mozilla Plugin Playlist undefined

All you've ever wanted to know about the ActiveX, Mozilla plugins, the web interface and various PHP extensions
sdankeny
New Cone
New Cone
Posts: 2
Joined: 02 Sep 2011 05:23

Mozilla Plugin Playlist undefined

Postby sdankeny » 02 Sep 2011 06:16

I am trying to create an embedded video player on a webpage. What happens sometimes is that my playlist is undefined and causes the video player to crash.

I am using Firefox 7 beta and VLC version 1.1.11. Here are two examples of the code I am writing:

Example 1:

Code: Select all

<html> <head> <title>I JUST WANT TO REDUCE CACHING!!!</title> <script> function start() { // start video player var vlc = document.getElementById('video1'); //vlc.playlist.items.clear(); var options = new Array(":rtsp-caching=100"); var id = vlc.playlist.add("file:///D:/Profiles/p63151/Desktop/movie4.mpg", "fancy name", null); vlc.playlist.playItem(id); } function stop() { // stop playing file var vlc = document.getElementById('video1'); vlc.playlist.stop(); } </script> </head> <body onload="start()"> <h1>VLC Plugin - Attempt to add in file caching to 100 ms...</h1> <embed type="application/x-vlc-plugin" version="VideoLAN.VLCPlugin.2" name="video1" id="video1" autoplay="yes" loop="no" width="352" height="240" target="file:///D:/Profiles/p63151/Desktop/movie4.mpg" /> <br /> <a href="javascript:start();">Play Video 1</a> <a href="javascript:stop();">Stop Video 1</a> </body> </html>
Example 2:

Code: Select all

<html> <head><title>page</title></head> <body> <script> function StartVideo(id) { // do stuff var options = new Array(":rtsp-caching=150"); var baseUrl = "rtsp://192.168.113.15/video?"; var vlcControl = document.getElementById("video" + id); if (vlcControl.playlist != null) { console.debug(vlcControl.playlist); } else { console.debug("playlist is undefined..."); } var plId = vlcControl.playlist.add("file:///movie4.mpg", "fancy-name", options); vlcControl.playlist.playItem(plId); } $(function () { // do stuff StartVideo(0); }); </script> <div id="tabs" class="ui-tabs ui-widget ui-widget-content ui-corner-all"> <ul id="list" class="ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all ui-sortable"> <li class="ui-state-default ui-corner-top ui-tabs-selected ui-state-active"><a href="#video-tab-0">Source 1</a></li> <li class="ui-state-default ui-corner-top"><a href="#video-tab-1">Source 2</a></li> </ul> <div id="video-tab-0" class="ui-tabs-panel ui-widget-content ui-corner-bottom"> <embed id="video0" width="352" height="288" type="application/x-vlc-plugin" name="video0" autoplay="yes" loop="no" target="file:///movie4.mpg"> </div> <div id="video-tab-1" class="ui-tabs-panel ui-widget-content ui-corner-bottom ui-tabs-hide"> <embed id="video1" width="352" height="288" type="application/x-vlc-plugin" name="video1" autoplay="yes" loop="no" target="file:///movie4.mpg"> </div> </div> </body> </html>
I am not sure what I am doing wrong. Are there any other people out there having similar problems or am I doing something completely wrong?

Thanks,

sdankeny

sheeraz
New Cone
New Cone
Posts: 2
Joined: 29 Sep 2011 09:48

Re: Mozilla Plugin Playlist undefined

Postby sheeraz » 29 Sep 2011 10:24

Thanks in advance my friend.. I am new to the forum and know very basic HTML..

Kinldy if you can send me the detailed code I want to play video on my webpage. The videos are lying in the same folder. I want to have play pause and stop control of video and it should show the select play list some where in the page..

I am using the below code to run the single video.. The play list a.xspf is lying the same root folder..




<div align="center">ABC Service
<table>
<tr> <td>
<embed type="application/x-vlc-plugin" pluginspage="http://www.videolan.org" version="VideoLAN.VLCPlugin.2"
width="593"
height="412"
autoplay="no"
id="vlc"
target="2.avi"></embed>
<div id="info">
</div>
<input type="button" class="sed1" onclick="else_r();" size='30' value="Play list" /></td>
<td>
<script type="text/javascript">

var vlc = document.getElementById("vlc");
if(vlc){
document.getElementById("info").innerHTML = "Ready";
} else {
document.getElementById("info").innerHTML = "Not Ready";
}
function mute(){
vlc.audio.toggleMute();
}
function play(){
vlc.playlist.play();
intval = setInterval(uptime, 250);
}
function stop(){
clearInterval(intval);
vlc.playlist.stop();

}
function pause(){
vlc.playlist.togglePause();
}
function c_time(){
return eval(vlc.input.time / 1000);
}
function seek(value){
var vlc = document.getElementById("vlc");
//alert(value);
vlc.input.time = eval(value*1000)
//return true;
}
function backof(value){
var vlc = document.getElementById("vlc");
vlc.input.time = vlc.input.time - eval(value*1000);
//alert(vlc.input.state);
//return true;
}

function uptime(){
document.getElementById("nowt").innerHTML = eval(vlc.input.time/1000);
}
function else_r(){
oi = document.getElementById("txtout");
oi.value = '';
oi.value += vlc.versionInfo() +"\n";
oi.value += "VLC position " + vlc.input.position +"\n";
oi.value += "VLC length " + vlc.input.length +"\n";
oi.value += "VLC rate " + vlc.input.rate +"\n";
oi.value += "VLC is Playing " + vlc.playlist.isPlaying +"\n";
}
</script>
<input type="button" onclick='play();' value="Play" />
<input type="button" onclick='pause();' value="Pause" />
<input type="button" onclick='stop();' value="Stop" />
<input type="button" onclick='document.getElementById("info").innerHTML = c_time();' value="Time" />
<input type="button" onclick='mute();' value="Mute" />
<div>
<input id="seekto" type="text" size="4" value="10" />
<input type="button" class="sed1" onclick="seek(document.getElementById('seekto').value);" size='30' value="Seek (sec)" />
<input id="backof" type="text" size="4" value="5" />
<input type="button" class="sed1" onclick="backof(document.getElementById('backof').value);" size='30' value="Back of (sec)" />
</div>
<div id="nowt">
</div>
</td></tr>
</table>
</div>


Return to “Web and scripting”

Who is online

Users browsing this forum: No registered users and 8 guests