Skip to content

Commit c760875

Browse files
authored
Enable/Disable UTC sync via settings flag (#3802)
1 parent 5965ab6 commit c760875

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

index.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,7 @@ declare namespace dashjs {
201201
enableSeekFix?: boolean
202202
},
203203
utcSynchronization?: {
204+
enabled?: boolean,
204205
useManifestDateHeaderTimeSource?: boolean,
205206
backgroundAttempts?: number,
206207
timeBetweenSyncAttempts?: number,

src/core/Settings.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ import {HTTPRequest} from '../streaming/vo/metrics/HTTPRequest';
108108
* enableSeekFix: false
109109
* },
110110
* utcSynchronization: {
111+
* enabled: true,
111112
* useManifestDateHeaderTimeSource: true,
112113
* backgroundAttempts: 2,
113114
* timeBetweenSyncAttempts: 30,
@@ -378,7 +379,8 @@ import {HTTPRequest} from '../streaming/vo/metrics/HTTPRequest';
378379

379380
/**
380381
* @typedef {Object} UtcSynchronizationSettings
381-
*
382+
* @property {boolean} [enabled=true]
383+
* Enables or disables the UTC clock synchronization
382384
* @property {boolean} [useManifestDateHeaderTimeSource=true]
383385
* Allows you to enable the use of the Date Header, if exposed with CORS, as a timing source for live edge detection.
384386
*
@@ -802,6 +804,7 @@ function Settings() {
802804
enableSeekFix: false
803805
},
804806
utcSynchronization: {
807+
enabled: true,
805808
useManifestDateHeaderTimeSource: true,
806809
backgroundAttempts: 2,
807810
timeBetweenSyncAttempts: 30,

src/streaming/controllers/TimeSyncController.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ function TimeSyncController() {
168168
* Does a synchronization in the background in case the last offset should be verified or a 404 occurs
169169
*/
170170
function _onAttemptBackgroundSync() {
171-
if (isSynchronizing || isBackgroundSynchronizing || !lastTimingSource || !lastTimingSource.value || !lastTimingSource.schemeIdUri || isNaN(lastOffset) || isNaN(settings.get().streaming.utcSynchronization.backgroundAttempts)) {
171+
if (!settings.get().streaming.utcSynchronization.enabled || isSynchronizing || isBackgroundSynchronizing || !lastTimingSource || !lastTimingSource.value || !lastTimingSource.schemeIdUri || isNaN(lastOffset) || isNaN(settings.get().streaming.utcSynchronization.backgroundAttempts)) {
172172
return;
173173
}
174174

@@ -287,7 +287,7 @@ function TimeSyncController() {
287287
*/
288288
function _shouldPerformSynchronization(isDynamic) {
289289
try {
290-
if (!isDynamic) {
290+
if (!isDynamic || !settings.get().streaming.utcSynchronization.enabled) {
291291
return false;
292292
}
293293
const timeBetweenSyncAttempts = !isNaN(internalTimeBetweenSyncAttempts) ? internalTimeBetweenSyncAttempts : DEFAULT_TIME_BETWEEN_SYNC_ATTEMPTS;

0 commit comments

Comments
 (0)