Incorrect Input.Length from .ts file?

All you've ever wanted to know about the ActiveX, Mozilla plugins, the web interface and various PHP extensions
Beardless2
Cone that earned his stripes
Cone that earned his stripes
Posts: 125
Joined: 02 Feb 2007 09:53

Incorrect Input.Length from .ts file?

Postby Beardless2 » 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?

Anatoly_B
Blank Cone
Blank Cone
Posts: 14
Joined: 20 Aug 2008 03:30

Re: Incorrect Input.Length from .ts file?

Postby Anatoly_B » 07 Jan 2009 20:44

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...

Beardless2
Cone that earned his stripes
Cone that earned his stripes
Posts: 125
Joined: 02 Feb 2007 09:53

Re: Incorrect Input.Length from .ts file?

Postby Beardless2 » 08 Jan 2009 09:35

thank you

zhizhongYu
Blank Cone
Blank Cone
Posts: 14
Joined: 03 Nov 2008 03:54

Re: Incorrect Input.Length from .ts file?

Postby zhizhongYu » 23 Apr 2009 03:17

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?

Anatoly_B
Blank Cone
Blank Cone
Posts: 14
Joined: 20 Aug 2008 03:30

Re: Incorrect Input.Length from .ts file?

Postby Anatoly_B » 23 Apr 2009 18:29

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%...


Return to “Web and scripting”

Who is online

Users browsing this forum: No registered users and 4 guests