Incorrect Input.Length from .ts file?
Posted: 23 Dec 2008 14:12
The VLC.Input.Length always returns zero for .ts video files using 0.9.8a and v2 of the plugin - does anyone else have this issue?
Discussion and support for VLC media player and friends
http://forum.videolan.org/
Code: Select all
var playStartTime;
var myCurentTime;
var tsFileLength;
var myPlayListItem;
function Play(uri, name, options) {
//my be after playList clear and waiting...
PlayListItem=vlc.playlist.add(uri, name, options);
setTimeout("PlayStart()",350);
}
function PlayStart(){
vlc.playlist.playItem(myPlayListItem);
var tStart=new Date();
playStartTime=tStart.getTime();
myCurentTime=0;
}
function VLCTimer(){
........
if(vlc.input.length){ // good file
tsFileLength=vlc.input.length;
}else{ // .st file or streem
tsFileLength=0; // default/unavailable
if(vlc.input.position>0.1){ // if time after start is low, precision of tsFileLength will be wery poor...
var tCurent=new Date();
myCurentTime=tCurent.getTime()-playStartTime;
tsFileLength=myCurentTime/vlc.input.position;
}
}
if(tsFileLength){
HTMLonPageIndicator.innerHTML=formatTime(tsFileLength);
}else{
HTMLonPageIndicator.innerHTML="Length unavailable";
}
}
setInterval("VLCTimer",1000);