Mozilla Plugin Playlist undefined
Posted: 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:
Example 2:
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
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>
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>
Thanks,
sdankeny