@reactoo/watchtogether-sdk-js 2.5.69 → 2.5.70

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.69",
3
+ "version": "2.5.70",
4
4
  "description": "Javascript SDK for Reactoo",
5
5
  "main": "src/index.js",
6
6
  "unpkg": "dist/watchtogether-sdk.min.js",
@@ -46,44 +46,49 @@ const syncModule = function ({room, emitter} = {}) {
46
46
  room._log('--- Sync enabled ---');
47
47
 
48
48
  stopFlag = false;
49
-
50
- const loop = () => {
51
-
52
- isSyncing = true;
53
- emitter.emit('playerSyncing', true);
54
-
55
- sync().finally(() => {
56
-
57
- isSyncing = false;
58
- emitter.emit('playerSyncing', false);
59
-
60
- if(isConnected() && !stopFlag) {
61
- syncWaitId = setTimeout(loop, syncNextWaitTime);
62
- }
63
- else {
64
- room._log('--- Automatic stop due to user not connected or stop flag enabled ---');
65
- stopSyncLoop();
66
- }
67
-
68
- })
69
- };
70
-
71
- loop();
49
+
50
+ if(!_playerInterfaceOptions.type === 'push') {
51
+ const loop = () => {
52
+
53
+ isSyncing = true;
54
+ emitter.emit('playerSyncing', true);
55
+
56
+ sync().finally(() => {
57
+
58
+ isSyncing = false;
59
+ emitter.emit('playerSyncing', false);
60
+
61
+ if(isConnected() && !stopFlag) {
62
+ syncWaitId = setTimeout(loop, syncNextWaitTime);
63
+ }
64
+ else {
65
+ room._log('--- Automatic stop due to user not connected or stop flag enabled ---');
66
+ stopSyncLoop();
67
+ }
68
+
69
+ })
70
+ };
71
+ loop();
72
+ }
73
+ else {
74
+ const loop2 = () => {
75
+ seekForward()
76
+ .then(() => {
77
+ setNextWaitTime(false);
78
+ })
79
+ .catch((e) => {
80
+ setNextWaitTime(true);
81
+ console.log('Sync failed', e);
82
+ });
83
+ syncWaitId = setTimeout(loop2, syncNextWaitTime);
84
+ };
85
+ loop2();
86
+ }
87
+
88
+
72
89
 
73
90
  //TODO: push sync
74
- // const loop2 = () => {
75
- // seekForward()
76
- // .then(() => {
77
- // setNextWaitTime(false);
78
- // })
79
- // .catch((e) => {
80
- // setNextWaitTime(true);
81
- // console.log('Sync failed', e);
82
- // });
83
- // syncWaitId = setTimeout(loop2, syncNextWaitTime);
84
- // };
85
- //
86
- // loop2();
91
+
87
92
 
88
93
  };
89
94
 
@@ -582,10 +587,10 @@ const syncModule = function ({room, emitter} = {}) {
582
587
  return;
583
588
  }
584
589
 
585
- if(_playerInterfaceOptions.type === 'push') {
586
- room._log('Push sync is not implemented in this sync module yet');
587
- return;
588
- }
590
+ // if(_playerInterfaceOptions.type === 'push') {
591
+ // room._log('Push sync is not implemented in this sync module yet');
592
+ // return;
593
+ // }
589
594
 
590
595
  if(_playerInterface.isVod) {
591
596
  room._log('VOD sync is not implemented in this sync module yet');