@reactoo/watchtogether-sdk-js 2.5.57 → 2.5.60
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -15,7 +15,7 @@ const syncModule = function ({room, emitter} = {}) {
|
|
|
15
15
|
};
|
|
16
16
|
const syncDefaultWaitTime = 60000;
|
|
17
17
|
const syncShortWaitTime = 10000;
|
|
18
|
-
const maxSyncThreshold = 0.
|
|
18
|
+
const maxSyncThreshold = 0.4;
|
|
19
19
|
const maxSyncTries = 3;
|
|
20
20
|
const waitForPlayingEventAfterSeek = 5000;
|
|
21
21
|
const fastForwardThreshold = 4
|
|
@@ -134,15 +134,15 @@ const syncModule = function ({room, emitter} = {}) {
|
|
|
134
134
|
return Promise.resolve();
|
|
135
135
|
}
|
|
136
136
|
|
|
137
|
-
if(position !== null) {
|
|
137
|
+
if(position !== null && !isNaN(position)) {
|
|
138
138
|
return seekBy(position)
|
|
139
139
|
.then(() => {
|
|
140
140
|
const seekDuration = (Date.now() - syncStartTime) / 1000;
|
|
141
141
|
const {position, realPosition, isBufferSufficient} = _playerInterface.getTimeDifference
|
|
142
|
-
? _playerInterface.getTimeDifference(syncData.masterFragmentSn, syncData.masterFragmentPos, syncData.ping)
|
|
143
|
-
: getTimeDifference(syncData.masterFragmentSn, syncData.masterFragmentPos, syncData.ping);
|
|
142
|
+
? _playerInterface.getTimeDifference(syncData.masterFragmentSn, syncData.masterFragmentPos + seekDuration, syncData.ping)
|
|
143
|
+
: getTimeDifference(syncData.masterFragmentSn, syncData.masterFragmentPos + seekDuration, syncData.ping);
|
|
144
144
|
|
|
145
|
-
const syncPrecision = Math.abs(realPosition
|
|
145
|
+
const syncPrecision = Math.abs(realPosition);
|
|
146
146
|
room._log(`Insufficient buffer: `, !isBufferSufficient)
|
|
147
147
|
room._log(`Seek duration is ${seekDuration} seconds`);
|
|
148
148
|
room._log(`Sync precision should be ${syncPrecision}`);
|
|
@@ -152,15 +152,18 @@ const syncModule = function ({room, emitter} = {}) {
|
|
|
152
152
|
return Promise.resolve();
|
|
153
153
|
})
|
|
154
154
|
.catch((e) => {
|
|
155
|
+
room._log(`Seek failed: `, e);
|
|
155
156
|
setNextWaitTime(true);
|
|
156
157
|
return Promise.reject(e);
|
|
157
158
|
});
|
|
158
159
|
} else {
|
|
160
|
+
room._log(`Position in not a number: `, position);
|
|
159
161
|
setNextWaitTime(true);
|
|
160
162
|
return Promise.reject();
|
|
161
163
|
}
|
|
162
164
|
}
|
|
163
|
-
}).catch(() => {
|
|
165
|
+
}).catch((e) => {
|
|
166
|
+
room._log(`getSyncData() failed: `, e);
|
|
164
167
|
setNextWaitTime(true);
|
|
165
168
|
return Promise.reject();
|
|
166
169
|
})
|
|
@@ -526,6 +529,7 @@ const syncModule = function ({room, emitter} = {}) {
|
|
|
526
529
|
room._log('All interface options: ', _playerInterfaceOptions );
|
|
527
530
|
|
|
528
531
|
if(_playerInterfaceOptions.type === 'none') {
|
|
532
|
+
room._log('Sync module has been disabled via type:none');
|
|
529
533
|
return;
|
|
530
534
|
}
|
|
531
535
|
|