Skip to content

Commit

Permalink
[Settings] Add enableSeekDecorrelationFix
Browse files Browse the repository at this point in the history
Allows disabling the workaround for live playback start (Dash-Industry-Forum#3750)
  • Loading branch information
lkinasiewicz committed Sep 7, 2021
1 parent 5bb6b28 commit a883dfd
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ declare namespace dashjs {
keepProtectionMediaKeys?: boolean,
},
buffer?: {
enableSeekDecorrelationFix?: boolean,
fastSwitchEnabled?: boolean,
flushBufferAtTrackSwitch?: boolean,
reuseExistingSourceBuffers?: boolean,
Expand Down
7 changes: 7 additions & 0 deletions src/core/Settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ import {HTTPRequest} from '../streaming/vo/metrics/HTTPRequest';
* keepProtectionMediaKeys: false
* },
* buffer: {
enableSeekDecorrelationFix: true,
* fastSwitchEnabled: true,
* flushBufferAtTrackSwitch: false,
* reuseExistingSourceBuffers: true,
Expand Down Expand Up @@ -239,6 +240,11 @@ import {HTTPRequest} from '../streaming/vo/metrics/HTTPRequest';

/**
* @typedef {Object} Buffer
* @property {boolean} [enableSeekDecorrelationFix=true]
* Enables a workaround for playback start on some devices, e.g. WebOS 4.9.
* It is necessary because some browsers do not support setting currentTime on video element to a value that is outside of current buffer.
*
* If you experience unexpected seeking triggered by BufferController, you can try setting this value to false.
* @property {boolean} [fastSwitchEnabled=true]
* When enabled, after an ABR up-switch in quality, instead of requesting and appending the next fragment at the end of the current buffer range it is requested and appended closer to the current time.
*
Expand Down Expand Up @@ -761,6 +767,7 @@ function Settings() {
keepProtectionMediaKeys: false
},
buffer: {
enableSeekDecorrelationFix: true,
fastSwitchEnabled: true,
flushBufferAtTrackSwitch: false,
reuseExistingSourceBuffers: true,
Expand Down
2 changes: 1 addition & 1 deletion src/streaming/controllers/BufferController.js
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ function BufferController(config) {
range = getRangeAt(seekTarget, segmentDuration);
if (!range) return;

if (Math.abs(currentTime - seekTarget) > segmentDuration) {
if (settings.get().streaming.buffer.enableSeekDecorrelationFix && Math.abs(currentTime - seekTarget) > segmentDuration) {
// If current video model time is decorrelated from seek target (and appended buffer) then seek video element
// (in case of live streams on some browsers/devices for which we can't set video element time at unavalaible range)

Expand Down

0 comments on commit a883dfd

Please sign in to comment.