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

Changing src displays poster and/or initial frames from new src #59

Open
ddemoss222 opened this issue Mar 24, 2020 · 1 comment
Open

Comments

@ddemoss222
Copy link

An example showing this behavior found at 1moreclub.com/embedtest. This issue seems to reproduce regardless of browser.

Basically when partly through the video and attempting to change src, the frame changes from the frame displayed at the current part of playback, and reverts to the beginning of the video. then it skips again back to where it should be once it's loaded.

Is it possible to keep the displayed frame from jumping around? I had opened a ticket about an unrelated issue on the videojs github and they told me that seeking logic is handled by the quality selector plugin, so here I am.

I am not certain that this is an issue, but it's definitely not behavior as I would expect it to, so if this is an error or if there are known workarounds/adjustments please let me know!

Thanks.

@jthomerson
Copy link
Member

I'm not sure how much control we'll have over this. There are lots of bugs and inconsistencies in various browser implementations when we change source and need to seek. You can poke around in the code to see if you can find any solutions. Be sure to look at the logic already in these places:

https://github.com/silvermine/videojs-quality-selector/blob/06b18e4a17900128e33e55e64be9f1ce7043a683/src/js/util/SafeSeek.js

function changeQuality(event, newSource) {
var sources = player.currentSources(),
currentTime = player.currentTime(),
isPaused = player.paused(),
selectedSource;
// Clear out any previously selected sources (see: #11)
_.each(sources, function(source) {
source.selected = false;
});
selectedSource = _.findWhere(sources, { src: newSource.src });
// Note: `_.findWhere` returns a reference to an object. Thus the
// following updates the original object in `sources`.
selectedSource.selected = true;
if (player._qualitySelectorSafeSeek) {
player._qualitySelectorSafeSeek.onQualitySelectionChange();
}
player.src(sources);
player.ready(function() {
if (!player._qualitySelectorSafeSeek || player._qualitySelectorSafeSeek.hasFinished()) {
// Either we don't have a pending seek action or the one that we have is no
// longer applicable. This block must be within a `player.ready` callback
// because the call to `player.src` above is asynchronous, and so not
// having it within this `ready` callback would cause the SourceInterceptor
// to execute after this block instead of before.
//
// We save the `currentTime` within the SafeSeek instance because if
// multiple QUALITY_REQUESTED events are received before the SafeSeek
// operation finishes, the player's `currentTime` will be `0` if the
// player's `src` is updated but the player's `currentTime` has not yet
// been set by the SafeSeek operation.
player._qualitySelectorSafeSeek = new SafeSeek(player, currentTime);
}
if (!isPaused) {
player.play();
}
});
}

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

No branches or pull requests

2 participants