Page 1 of 1

Incorrect Input.Length from .ts file?

Posted: 23 Dec 2008 14:12
by Beardless2
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?

Re: Incorrect Input.Length from .ts file?

Posted: 07 Jan 2009 20:44
by Anatoly_B
The .ts file will not contain the information on duration of record. This value can be received only approximately. For this purpose it is possible to divide current time from the playing start (using the system timer) by a position in a file (vlc.input.position). Unfortunately, it is applicable only in case, when bitrate is fixed...

Re: Incorrect Input.Length from .ts file?

Posted: 08 Jan 2009 09:35
by Beardless2
thank you

Re: Incorrect Input.Length from .ts file?

Posted: 23 Apr 2009 03:17
by zhizhongYu
hi,
sorry my english is very bad,now I suffered this Problem,but I don't know how to resolve,can you give me a examples?

Re: Incorrect Input.Length from .ts file?

Posted: 23 Apr 2009 18:29
by Anatoly_B
Simplified code:

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);
However, it's preferable don't use .ts files, because precision of length is 2...10%...