From de29dac896762599bfd3360f5b44e4f1a455c12e Mon Sep 17 00:00:00 2001 From: Bill Thornton Date: Thu, 9 Sep 2021 23:20:14 -0400 Subject: [PATCH 1/3] Disable sync correction by default on mobile --- src/components/syncPlay/core/PlaybackCore.js | 8 ++++--- .../syncPlay/ui/settings/SettingsEditor.js | 24 ++++++++++++------- 2 files changed, 21 insertions(+), 11 deletions(-) diff --git a/src/components/syncPlay/core/PlaybackCore.js b/src/components/syncPlay/core/PlaybackCore.js index 7003dd50e8..596393f9df 100644 --- a/src/components/syncPlay/core/PlaybackCore.js +++ b/src/components/syncPlay/core/PlaybackCore.js @@ -2,8 +2,9 @@ * Module that manages the playback of SyncPlay. * @module components/syncPlay/core/PlaybackCore */ - import { Events } from 'jellyfin-apiclient'; + +import browser from '../../../scripts/browser'; import { toBoolean, toFloat } from '../../../scripts/stringUtils'; import * as Helper from './Helper'; import { getSetting } from './Settings'; @@ -20,7 +21,8 @@ class PlaybackCore { this.playbackDiffMillis = 0; // Used for stats and remote time sync. this.syncAttempts = 0; this.lastSyncTime = new Date(); - this.enableSyncCorrection = true; // User setting to disable sync during playback. + // User setting to disable sync during playback. + this.enableSyncCorrection = !(browser.mobile || browser.iOS); this.playerIsBuffering = false; @@ -67,7 +69,7 @@ class PlaybackCore { this.useSkipToSync = toBoolean(getSetting('useSkipToSync'), true); // Whether sync correction during playback is active. - this.enableSyncCorrection = toBoolean(getSetting('enableSyncCorrection'), true); + this.enableSyncCorrection = toBoolean(getSetting('enableSyncCorrection'), !(browser.mobile || browser.iOS)); } /** diff --git a/src/components/syncPlay/ui/settings/SettingsEditor.js b/src/components/syncPlay/ui/settings/SettingsEditor.js index 6f34e852c9..2b32f5de8a 100644 --- a/src/components/syncPlay/ui/settings/SettingsEditor.js +++ b/src/components/syncPlay/ui/settings/SettingsEditor.js @@ -96,14 +96,22 @@ class SettingsEditor { async initEditor() { const { context } = this; - context.querySelector('#txtExtraTimeOffset').value = toFloat(getSetting('extraTimeOffset'), 0.0); - context.querySelector('#chkSyncCorrection').checked = toBoolean(getSetting('enableSyncCorrection'), true); - context.querySelector('#txtMinDelaySpeedToSync').value = toFloat(getSetting('minDelaySpeedToSync'), 60.0); - context.querySelector('#txtMaxDelaySpeedToSync').value = toFloat(getSetting('maxDelaySpeedToSync'), 3000.0); - context.querySelector('#txtSpeedToSyncDuration').value = toFloat(getSetting('speedToSyncDuration'), 1000.0); - context.querySelector('#txtMinDelaySkipToSync').value = toFloat(getSetting('minDelaySkipToSync'), 400.0); - context.querySelector('#chkSpeedToSync').checked = toBoolean(getSetting('useSpeedToSync'), true); - context.querySelector('#chkSkipToSync').checked = toBoolean(getSetting('useSkipToSync'), true); + context.querySelector('#txtExtraTimeOffset').value = toFloat(getSetting('extraTimeOffset'), + SyncPlay.Manager.playbackCore.extraTimeOffset); + context.querySelector('#chkSyncCorrection').checked = toBoolean(getSetting('enableSyncCorrection'), + SyncPlay.Manager.playbackCore.enableSyncCorrection); + context.querySelector('#txtMinDelaySpeedToSync').value = toFloat(getSetting('minDelaySpeedToSync'), + SyncPlay.Manager.playbackCore.minDelaySpeedToSync); + context.querySelector('#txtMaxDelaySpeedToSync').value = toFloat(getSetting('maxDelaySpeedToSync'), + SyncPlay.Manager.playbackCore.maxDelaySpeedToSync); + context.querySelector('#txtSpeedToSyncDuration').value = toFloat(getSetting('speedToSyncDuration'), + SyncPlay.Manager.playbackCore.speedToSyncDuration); + context.querySelector('#txtMinDelaySkipToSync').value = toFloat(getSetting('minDelaySkipToSync'), + SyncPlay.Manager.playbackCore.minDelaySkipToSync); + context.querySelector('#chkSpeedToSync').checked = toBoolean(getSetting('useSpeedToSync'), + SyncPlay.Manager.playbackCore.useSpeedToSync); + context.querySelector('#chkSkipToSync').checked = toBoolean(getSetting('useSkipToSync'), + SyncPlay.Manager.playbackCore.useSkipToSync); } onSubmit() { From e548388f8fdc91c30fc8c45adf0af101e2f78d18 Mon Sep 17 00:00:00 2001 From: Bill Thornton Date: Mon, 13 Sep 2021 11:10:28 -0400 Subject: [PATCH 2/3] Fix syncplay review issues --- src/components/syncPlay/core/PlaybackCore.js | 2 +- .../syncPlay/core/timeSync/TimeSyncCore.js | 2 +- .../syncPlay/ui/settings/SettingsEditor.js | 27 +++++++------------ 3 files changed, 11 insertions(+), 20 deletions(-) diff --git a/src/components/syncPlay/core/PlaybackCore.js b/src/components/syncPlay/core/PlaybackCore.js index 596393f9df..57e34769cd 100644 --- a/src/components/syncPlay/core/PlaybackCore.js +++ b/src/components/syncPlay/core/PlaybackCore.js @@ -22,7 +22,7 @@ class PlaybackCore { this.syncAttempts = 0; this.lastSyncTime = new Date(); // User setting to disable sync during playback. - this.enableSyncCorrection = !(browser.mobile || browser.iOS); + this.enableSyncCorrection = false; this.playerIsBuffering = false; diff --git a/src/components/syncPlay/core/timeSync/TimeSyncCore.js b/src/components/syncPlay/core/timeSync/TimeSyncCore.js index adb135f28b..772121dac8 100644 --- a/src/components/syncPlay/core/timeSync/TimeSyncCore.js +++ b/src/components/syncPlay/core/timeSync/TimeSyncCore.js @@ -48,7 +48,7 @@ class TimeSyncCore { Events.trigger(this, 'time-sync-server-update', [timeOffset, ping]); }); - Events.on(appSettings, 'change', function (e, name) { + Events.on(appSettings, 'change', (e, name) => { if (name === 'extraTimeOffset') { this.extraTimeOffset = toFloat(getSetting('extraTimeOffset'), 0.0); } diff --git a/src/components/syncPlay/ui/settings/SettingsEditor.js b/src/components/syncPlay/ui/settings/SettingsEditor.js index 2b32f5de8a..3f90725145 100644 --- a/src/components/syncPlay/ui/settings/SettingsEditor.js +++ b/src/components/syncPlay/ui/settings/SettingsEditor.js @@ -5,13 +5,12 @@ import { Events } from 'jellyfin-apiclient'; import SyncPlay from '../../core'; -import { getSetting, setSetting } from '../../core/Settings'; +import { setSetting } from '../../core/Settings'; import dialogHelper from '../../../dialogHelper/dialogHelper'; import layoutManager from '../../../layoutManager'; import loading from '../../../loading/loading'; import toast from '../../../toast/toast'; import globalize from '../../../../scripts/globalize'; -import { toBoolean, toFloat } from '../../../../scripts/stringUtils'; import 'material-design-icons-iconfont'; import '../../../../elements/emby-input/emby-input'; @@ -96,22 +95,14 @@ class SettingsEditor { async initEditor() { const { context } = this; - context.querySelector('#txtExtraTimeOffset').value = toFloat(getSetting('extraTimeOffset'), - SyncPlay.Manager.playbackCore.extraTimeOffset); - context.querySelector('#chkSyncCorrection').checked = toBoolean(getSetting('enableSyncCorrection'), - SyncPlay.Manager.playbackCore.enableSyncCorrection); - context.querySelector('#txtMinDelaySpeedToSync').value = toFloat(getSetting('minDelaySpeedToSync'), - SyncPlay.Manager.playbackCore.minDelaySpeedToSync); - context.querySelector('#txtMaxDelaySpeedToSync').value = toFloat(getSetting('maxDelaySpeedToSync'), - SyncPlay.Manager.playbackCore.maxDelaySpeedToSync); - context.querySelector('#txtSpeedToSyncDuration').value = toFloat(getSetting('speedToSyncDuration'), - SyncPlay.Manager.playbackCore.speedToSyncDuration); - context.querySelector('#txtMinDelaySkipToSync').value = toFloat(getSetting('minDelaySkipToSync'), - SyncPlay.Manager.playbackCore.minDelaySkipToSync); - context.querySelector('#chkSpeedToSync').checked = toBoolean(getSetting('useSpeedToSync'), - SyncPlay.Manager.playbackCore.useSpeedToSync); - context.querySelector('#chkSkipToSync').checked = toBoolean(getSetting('useSkipToSync'), - SyncPlay.Manager.playbackCore.useSkipToSync); + context.querySelector('#txtExtraTimeOffset').value = SyncPlay.Manager.timeSyncCore.extraTimeOffset; + context.querySelector('#chkSyncCorrection').checked = SyncPlay.Manager.playbackCore.enableSyncCorrection; + context.querySelector('#txtMinDelaySpeedToSync').value = SyncPlay.Manager.playbackCore.minDelaySpeedToSync; + context.querySelector('#txtMaxDelaySpeedToSync').value = SyncPlay.Manager.playbackCore.maxDelaySpeedToSync; + context.querySelector('#txtSpeedToSyncDuration').value = SyncPlay.Manager.playbackCore.speedToSyncDuration; + context.querySelector('#txtMinDelaySkipToSync').value = SyncPlay.Manager.playbackCore.minDelaySkipToSync; + context.querySelector('#chkSpeedToSync').checked = SyncPlay.Manager.playbackCore.useSpeedToSync; + context.querySelector('#chkSkipToSync').checked = SyncPlay.Manager.playbackCore.useSkipToSync; } onSubmit() { From 99e9b5b41e2ec46ad276160f77fd35ec711bf897 Mon Sep 17 00:00:00 2001 From: Bill Thornton Date: Tue, 14 Sep 2021 10:26:13 -0400 Subject: [PATCH 3/3] Remove redundant assignment --- src/components/syncPlay/core/PlaybackCore.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/components/syncPlay/core/PlaybackCore.js b/src/components/syncPlay/core/PlaybackCore.js index 57e34769cd..a47872e9cb 100644 --- a/src/components/syncPlay/core/PlaybackCore.js +++ b/src/components/syncPlay/core/PlaybackCore.js @@ -21,8 +21,6 @@ class PlaybackCore { this.playbackDiffMillis = 0; // Used for stats and remote time sync. this.syncAttempts = 0; this.lastSyncTime = new Date(); - // User setting to disable sync during playback. - this.enableSyncCorrection = false; this.playerIsBuffering = false;