Skip to content

feat: Better UI for live playback via an option#5511

Merged
gkatsev merged 58 commits into
masterfrom
feat/live-progress-control
Dec 3, 2018
Merged

feat: Better UI for live playback via an option#5511
gkatsev merged 58 commits into
masterfrom
feat/live-progress-control

Conversation

@brandonocasey

@brandonocasey brandonocasey commented Oct 17, 2018

Copy link
Copy Markdown
Contributor

Changes

All of the following is behind a new option called liveui that defaults to false:

LiveDisplay

  • Shown when vjs-live is set on the player but hidden when vjs-live and vjs-liveui are both on the player

SeekToLive

  • A new component that will show when vjs-live and vjs-liveui classes are on the player
  • Used to show when the player is at the live edge, and to indicate that the player is live
  • Can be clicked to seek to the live edge when behind.

LiveTracker

  • Handles tracking of the "live edge" and fires events when the live edge and currentTime are not in sync.
  • Handles tracking of seekable end changes so that we can keep up to date with what the live current time should be

Seek/Progress Bar

  • Show during live playback
  • Make all time tooltips show negative numbers indicating the time from live.
  • Seek within the live window
  • Keep updating all the time when live streaming, since if you pause you will fall behind the live stream.
  • Hide and show various components via live css

Comment thread sandbox/fake-live.html.example Outdated

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This fixes an issue where it would not show up as live for the first few seconds.

Comment thread sandbox/fake-live.html.example Outdated

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This makes it so that there are a few seconds before the "live" point as in a normal live stream

Comment thread src/css/components/_live.scss Outdated
Comment thread src/css/components/_progress.scss Outdated

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we show this now

Comment thread src/css/components/_progress.scss Outdated

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure if we want to hide this or fix it, basically this can make it so that the progress bar goes past the player.

Comment thread src/js/control-bar/live-display.js Outdated

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We may not know if the player is live until it is ready.

@brandonocasey brandonocasey force-pushed the feat/live-progress-control branch from ec7998c to 64950bc Compare October 17, 2018 21:22
Comment thread src/js/control-bar/live-display.js Outdated
Comment thread src/js/control-bar/live-display.js Outdated
Comment thread src/js/control-bar/progress-control/load-progress-bar.js Outdated
Comment thread src/js/control-bar/progress-control/seek-bar.js
@mister-ben

mister-ben commented Oct 18, 2018

Copy link
Copy Markdown
Contributor

The button width might have to be flexible to account for longer localised strings. Catalan 'EN DIRECTE' is the longest we currently have in the translations.

Comment thread src/js/control-bar/progress-control/load-progress-bar.js Outdated
Comment thread src/js/control-bar/progress-control/play-progress-bar.js Outdated
@gkatsev

gkatsev commented Oct 18, 2018

Copy link
Copy Markdown
Member

Is there a reason this isn't implemented as a middleware?
I think this should be enabled by default but with the ability to turn it off but there's still time to discuss.

@misteroneill

Copy link
Copy Markdown
Member

@gkatsev We discussed that a bit in our grooming call, but @brandonocasey had some uncertainty. We can discuss further on Monday when you're back. 👍

@brandonocasey brandonocasey force-pushed the feat/live-progress-control branch 2 times, most recently from c8b5bc0 to e4e7241 Compare October 19, 2018 20:40
@brandonocasey

Copy link
Copy Markdown
Contributor Author

Internally we originally though that this could be implemented as middleware, but I found several issues with that in the initial implementation. Here are the issues

  1. We would have to change currentTime internally to 0 at the live edge and negative seconds before that. This caused a bunch of issues across the board, since the UI did not know how to deal with currentTime not changing, or going negative. It would also be inconsistent with the video element API.
  2. In order to keep the progress bar within the seekable range of the video element we would have to change the duration from Infinity. Which would hide that it was a livestream. furthermore we would have to update the duration every time seekable changed which for short segment live streams could be every 2s.
  3. Even if we were to do the two things above, there would still be UI specific code for live streams, and it would probably be very similar to what we have now. For instance we would have to add support for negative time tool tips and the play progress would still have to update during pause when live streaming (so that the seek bar can decrease)

After talking about it we think that the issues do warrant this being a UI only change. As having live streams now have a finite duration and negative current times would be too far from what a video element does.

@gkatsev

gkatsev commented Nov 2, 2018

Copy link
Copy Markdown
Member

I haven't done in depth testing but a there's documentation missing.
Also, testing with a stream with a window of 5 segments of 10 seconds each, I'd have expected the progress bar to be let us seek back the full 20 seconds, at least after playing back a segment. Is this something we should talk with the playback team about?

@brandonocasey

Copy link
Copy Markdown
Contributor Author

Yeah I think we would need to talk to them about that. We can only seek back as far as seekable start, as far as I know.

@gkatsev

gkatsev commented Nov 2, 2018

Copy link
Copy Markdown
Member

Looks like the stream I was testing with had a target duration much larger than the segment size which cut into the seekable.

@brandonocasey brandonocasey force-pushed the feat/live-progress-control branch 2 times, most recently from 54fc3d3 to 1106fc9 Compare November 6, 2018 16:56

@misteroneill misteroneill left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One thought. @gkatsev thoughts on this?

Comment thread src/js/live-tracker.js Outdated
@brandonocasey brandonocasey force-pushed the feat/live-progress-control branch from be2fceb to d75e491 Compare December 3, 2018 20:07
@gkatsev gkatsev merged commit 2974ad3 into master Dec 3, 2018
@gkatsev gkatsev deleted the feat/live-progress-control branch December 3, 2018 21:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants