Skip to content

Commit

Permalink
Merge pull request #92 from bbc/seek-without-readystate-check
Browse files Browse the repository at this point in the history
Add seekWithoutReadyStateCheck override property
  • Loading branch information
jlks authored Jun 24, 2024
2 parents aaf36bf + 9ab9c45 commit 7c7e55f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/core/Settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -773,6 +773,8 @@ import Events from './events/Events';
* Overwrite the manifest segments base information timescale attributes with the timescale set in initialization segments
* @property {boolean} [enableManifestTimescaleMismatchFix=false]
* Defines the delay in milliseconds between two consecutive checks for events to be fired.
* @property {boolean} [seekWithoutReadyStateCheck=false]
* This allows a seek by setting currentTime regardless of the loadedmetadata event being emitted
* @property {boolean} [parseInbandPrft=false]
* Set to true if dash.js should parse inband prft boxes (ProducerReferenceTime) and trigger events.
* @property {module:Settings~Metrics} metrics Metric settings
Expand Down Expand Up @@ -898,6 +900,7 @@ function Settings() {
enableManifestDurationMismatchFix: true,
parseInbandPrft: false,
enableManifestTimescaleMismatchFix: false,
seekWithoutReadyStateCheck: false,
capabilities: {
filterUnsupportedEssentialProperties: true,
useMediaCapabilitiesApi: false
Expand Down
9 changes: 8 additions & 1 deletion src/streaming/models/VideoModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,14 @@ function VideoModel() {
removeEventListener(setCurrentTimeReadyStateFunction.event, setCurrentTimeReadyStateFunction.func);
}
_currentTime = currentTime;
setCurrentTimeReadyStateFunction = waitForReadyState(Constants.VIDEO_ELEMENT_READY_STATES.HAVE_METADATA, () => {

let elementReadyStateEvent = Constants.VIDEO_ELEMENT_READY_STATES.HAVE_METADATA;

if (settings.get().streaming.seekWithoutReadyStateCheck) {
elementReadyStateEvent = Constants.VIDEO_ELEMENT_READY_STATES.HAVE_NOTHING;
}

setCurrentTimeReadyStateFunction = waitForReadyState(elementReadyStateEvent, () => {
if (!element) {
return;
}
Expand Down

0 comments on commit 7c7e55f

Please sign in to comment.