Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

videojs currentTime() #324

Open
me-vlad opened this issue Jun 25, 2015 · 5 comments
Open

videojs currentTime() #324

me-vlad opened this issue Jun 25, 2015 · 5 comments

Comments

@me-vlad
Copy link
Contributor

me-vlad commented Jun 25, 2015

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
Copy link
Owner

mangui commented Jun 26, 2015

@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
Copy link
Contributor Author

me-vlad commented Jun 26, 2015

@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
Copy link
Owner

mangui commented Jun 26, 2015

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
Copy link
Contributor Author

me-vlad commented Jun 26, 2015

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
Copy link
Owner

mangui commented Jun 26, 2015

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants