Skip to content
This repository has been archived by the owner on Jan 12, 2019. It is now read-only.

Seek to seekable start when before the seekable window #1260

Merged
merged 3 commits into from
Sep 20, 2017

Conversation

forbesjo
Copy link
Contributor

@forbesjo forbesjo commented Sep 19, 2017

Description

Seek to seekable start when before the seekable window

Specific Changes proposed

Instead of seeking to live when doing a bad seek (for example if the seekable shifts while scrubbing) we'll snap to the beginning of the live window.

Requirements Checklist

  • Feature implemented / Bug fixed
  • If necessary, more likely in a feature request than a bug fix
    • Unit Tests updated or fixed
  • Reviewed by Two Core Contributors

let seekableEnd = seekable.end(seekable.length - 1);

// sync to live point (if VOD, our seekable was updated and we're simply adjusting)
this.logger_(`Trying to seek outside of seekable at time ${currentTime} with ` +
Copy link
Contributor

Choose a reason for hiding this comment

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

Since the much of this is the same, maybe just set a seekTime variable and do the log/seek at the end if it was set

let seekTime = NaN;
if (after) seekTime = seekable.end;
if (before) seekTime = seekable.start + 0.1;
if (!isNaN(seekTime)) log; setCurrentTime(seekTime);

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep will do

@mjneil
Copy link
Contributor

mjneil commented Sep 20, 2017

Github won't let me comment on the line because no changes were made, but line 468 of playback-watcher.test.js test description is 'seeks to live point if we try to seek outside of seekable' which is not quite true anymore since it may seek to the start of the window depending on where you are trying to seek

Reworded test
let currentTime = this.tech_.currentTime();
const seeking = this.tech_.seeking();
const seekable = this.seekable();
const seekableStart = seekable.start(0);
Copy link
Contributor

Choose a reason for hiding this comment

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

seekable can have a length of 0, in which case this will error. Both beforeSeekableWindow_ and afterSeekableWindow_ check the length and return false if it is 0, so you could not create these const here and just access seekable.start(0) if you get into the appropriate if block. Otherwise you will have to check the length here as well

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll move these down to their appropriate if blocks

this.outsideOfSeekableWindow_(seekable, currentTime)) {
let seekableEnd = seekable.end(seekable.length - 1);
if (seeking && this.afterSeekableWindow_(seekable, currentTime)) {
const seekableStart = seekable.start(0);
Copy link
Contributor

Choose a reason for hiding this comment

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

you switched up seekableStart and seekableEnd

Copy link
Contributor Author

Choose a reason for hiding this comment

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

doh

Copy link
Contributor Author

Choose a reason for hiding this comment

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

At least the tests caught it

@forbesjo forbesjo merged commit 7fb8820 into videojs:master Sep 20, 2017
@forbesjo forbesjo deleted the fix/return-of-the-live-window branch September 20, 2017 18:40
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants