@reactoo/watchtogether-sdk-js 2.5.56 → 2.5.57

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reactoo/watchtogether-sdk-js",
3
- "version": "2.5.56",
3
+ "version": "2.5.57",
4
4
  "description": "Javascript SDK for Reactoo",
5
5
  "main": "src/index.js",
6
6
  "unpkg": "dist/watchtogether-sdk.min.js",
@@ -7,6 +7,7 @@ const syncModule = function ({room, emitter} = {}) {
7
7
  let _emitter = localEmitter();
8
8
 
9
9
  let _playerInterface = null;
10
+ let _propagateMaster = false;
10
11
  let _playerInterfaceOptions = {
11
12
  type: 'none',
12
13
  ignoreBufferedTimeRanges: true,
@@ -28,7 +29,6 @@ const syncModule = function ({room, emitter} = {}) {
28
29
  let isPlaying = false;
29
30
  let isPreloading = true;
30
31
  let isProgrammaticallySeeked = false;
31
- let shouldPropagateMaster = false;
32
32
 
33
33
  const startSyncLoop = () => {
34
34
 
@@ -117,7 +117,7 @@ const syncModule = function ({room, emitter} = {}) {
117
117
  return Promise.resolve();
118
118
  }
119
119
 
120
- else if(shouldPropagateMaster) {
120
+ else if(_propagateMaster) {
121
121
  setNextWaitTime(false);
122
122
  return propagateMasterFunc();
123
123
  }
@@ -167,7 +167,7 @@ const syncModule = function ({room, emitter} = {}) {
167
167
  }
168
168
 
169
169
  const handleAddLocalParticipant = () => {
170
- if(shouldPropagateMaster) {
170
+ if(_propagateMaster) {
171
171
  propagateMasterFunc();
172
172
  }
173
173
  if(_playerInterface.isPaused === false) {
@@ -176,7 +176,7 @@ const syncModule = function ({room, emitter} = {}) {
176
176
  };
177
177
 
178
178
  const handleAddRemoteParticipant = () => {
179
- if(shouldPropagateMaster) {
179
+ if(_propagateMaster) {
180
180
  propagateMasterFunc();
181
181
  }
182
182
  };
@@ -516,11 +516,12 @@ const syncModule = function ({room, emitter} = {}) {
516
516
 
517
517
  __events: ['playerSyncing'],
518
518
 
519
- initialize: (playerInterface) => {
519
+ initialize: ({playerInterface, propagateMaster = false} = {}) => {
520
520
 
521
521
  _playerInterface = playerInterface;
522
522
  _playerInterfaceOptions = {..._playerInterfaceOptions, ...(_playerInterface.syncSettings || {})}
523
-
523
+ _propagateMaster = propagateMaster;
524
+
524
525
  room._log('Interface options passed: ', (_playerInterface.syncSettings || {}));
525
526
  room._log('All interface options: ', _playerInterfaceOptions );
526
527
 
@@ -557,9 +558,6 @@ const syncModule = function ({room, emitter} = {}) {
557
558
  _emitter.emit('timeupdate', event);
558
559
  }
559
560
  });
560
-
561
-
562
- shouldPropagateMaster = false;
563
561
 
564
562
  isPlaying = _playerInterface.isPaused === false;
565
563
 
@@ -569,7 +567,7 @@ const syncModule = function ({room, emitter} = {}) {
569
567
  room.on('addRemoteParticipant', handleAddRemoteParticipant);
570
568
  room.on('data', parseDataEvents);
571
569
 
572
- if(shouldPropagateMaster) {
570
+ if(_propagateMaster) {
573
571
  propagateMasterFunc().catch(() => {});
574
572
  }
575
573
 
@@ -580,8 +578,7 @@ const syncModule = function ({room, emitter} = {}) {
580
578
  _emitter.on('buffering', handleBuffering);
581
579
  _emitter.on('playing', handlePlaying);
582
580
  _emitter.on('pause', handlePause);
583
-
584
-
581
+
585
582
  },
586
583
 
587
584
  destroy: () => {