@applicaster/zapp-react-native-utils 12.0.13-alpha.4903122644 → 12.0.13-rc.1

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.
@@ -91,6 +91,7 @@ export class Player {
91
91
  this.onVideoProgress = this.onVideoProgress.bind(this);
92
92
  this.onVideoLoad = this.onVideoLoad.bind(this);
93
93
  this.isFullScreenSupported = this.isFullScreenSupported.bind(this);
94
+ this.onAdBreakEnd = this.onAdBreakEnd.bind(this);
94
95
  this.entryObservable = null;
95
96
  }
96
97
 
@@ -194,17 +195,25 @@ export class Player {
194
195
  adPosition: currentTime,
195
196
  };
196
197
  } else {
197
- if (!isEmptyOrNil(seekableDuration) && seekableDuration >= 0) {
198
- this.playerState.seekableDuration = seekableDuration;
199
- }
198
+ this.updateContentDuration({ seekableDuration, duration, currentTime });
199
+ }
200
+ };
200
201
 
201
- if (!isEmptyOrNil(duration) && duration >= 0) {
202
- this.playerState.contentDuration = duration;
203
- }
202
+ protected updateContentDuration = ({
203
+ seekableDuration = null,
204
+ duration = null,
205
+ currentTime = null,
206
+ }) => {
207
+ if (!isEmptyOrNil(seekableDuration) && seekableDuration >= 0) {
208
+ this.playerState.seekableDuration = seekableDuration;
209
+ }
204
210
 
205
- if (!isEmptyOrNil(currentTime) && currentTime >= 0) {
206
- this.playerState.contentPosition = currentTime;
207
- }
211
+ if (!isEmptyOrNil(duration) && duration >= 0) {
212
+ this.playerState.contentDuration = duration;
213
+ }
214
+
215
+ if (!isEmptyOrNil(currentTime) && currentTime >= 0) {
216
+ this.playerState.contentPosition = currentTime;
208
217
  }
209
218
  };
210
219
 
@@ -551,7 +560,7 @@ export class Player {
551
560
  });
552
561
  };
553
562
 
554
- onAdBreakEnd = (event) => {
563
+ onAdBreakEnd(event) {
555
564
  this.playerState.adState = null;
556
565
  this.playerState.isInAdBreak = false;
557
566
 
@@ -559,7 +568,7 @@ export class Player {
559
568
  callbackName: SharedPlayerCallBacksKeys.OnAdBreakEnd,
560
569
  event,
561
570
  });
562
- };
571
+ }
563
572
 
564
573
  onAdEnd = (event) => {
565
574
  this.playerState.adState = null;
@@ -225,7 +225,9 @@ export class PlayerNative extends Player {
225
225
  };
226
226
 
227
227
  onVideoLoad = (event) => {
228
- if (this.startPosition) {
228
+ this.updateContentDuration(event);
229
+
230
+ if (this.startPosition && !this.playerState.isInAdBreak) {
229
231
  super.onVideoLoad({ ...event, ignoreContinueWatching: true });
230
232
 
231
233
  this.seekTo(this.startPosition);
@@ -253,6 +255,15 @@ export class PlayerNative extends Player {
253
255
  }
254
256
  };
255
257
 
258
+ onAdBreakEnd = (event) => {
259
+ super.onAdBreakEnd(event);
260
+
261
+ if (this.startPosition) {
262
+ this.seekTo(this.startPosition);
263
+ this.startPosition = null;
264
+ }
265
+ };
266
+
256
267
  // This function is called when native player used directly without wrapped component,
257
268
  // Since event from native comes with wrapped in NativeEvent property
258
269
  getNativeViewListener = (): QuickBrickPlayer.SharedPlayerCallBacks => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@applicaster/zapp-react-native-utils",
3
- "version": "12.0.13-alpha.4903122644",
3
+ "version": "12.0.13-rc.1",
4
4
  "description": "Applicaster Zapp React Native utilities package",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -28,7 +28,7 @@
28
28
  },
29
29
  "homepage": "https://github.com/applicaster/quickbrick#readme",
30
30
  "dependencies": {
31
- "@applicaster/applicaster-types": "12.0.13-alpha.4903122644",
31
+ "@applicaster/applicaster-types": "12.0.13-rc.1",
32
32
  "buffer": "^5.2.1",
33
33
  "camelize": "^1.0.0",
34
34
  "create-react-context": "^0.2.3",