mangui / flashls

HLS Flash Plugin/Player (Chromeless,OSMF,FlowPlayer,mediaelement.js,video.js,Clappr)
http://www.flashls.org
Mozilla Public License 2.0
751 stars 264 forks source link

videojs currentTime() #324

Open me-vlad opened 9 years ago

me-vlad commented 9 years ago

VideoJS with flashls returns current chunk time from currentTime() (https://github.com/videojs/video.js/blob/master/docs/api/vjs.Player.md#currenttime-seconds-) instread of live stream playing time. How we can get playing time from flashls+videojs?

mangui commented 9 years ago

@me-vlad you would have to change this line https://github.com/mangui/video-js-swf/blob/master/src/com/videojs/providers/HLSProvider.as#L106 and replace it by _position = event.mediatime.position+event.mediatime+live_sliding_main;

me-vlad commented 9 years ago

@mangui , thanks, it works with _position = event.mediatime.position+event.mediatime.live_sliding_main;

May be it will be reasonable to include this fix to your repo?

mangui commented 9 years ago

the pb is that not all the timelines will be seekable if you do so. i.e. after some time, position 0 will not be seekable anymore after first live playlist sliding. the purpose of returning the media position relative to the live playlist is that you can still seek to every position.

me-vlad commented 9 years ago

I think we can check that stream is live from stream duration.

          /**
          * Add live_sliding_main to get videojs currentTime() function work
          * Live stream has _duration = Infinity
          */
          if(_duration = Infinity) {
            _position = event.mediatime.position+event.mediatime.live_sliding_main;
          } else {
            _position = event.mediatime.position;
          }

Another solution - boolean option in flashls config, something like 'hls_live': true

mangui commented 9 years ago

there is already a hls.type getter to know whether stream is live or vod. and anyway... live_sliding_main can only be non null for live streams.