@applicaster/quick-brick-player 12.0.0-rc.99 → 12.0.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@applicaster/quick-brick-player",
3
- "version": "12.0.0-rc.99",
3
+ "version": "12.0.1",
4
4
  "description": "Quick Brick Player",
5
5
  "main": "./src/index.ts",
6
6
  "types": "index.d.ts",
@@ -36,11 +36,11 @@
36
36
  },
37
37
  "homepage": "https://github.com/applicaster/quickbrick#readme",
38
38
  "dependencies": {
39
- "@applicaster/quick-brick-mobile-transport-controls": "12.0.0-rc.96",
40
- "@applicaster/quick-brick-tv-transport-controls": "12.0.0-rc.89",
41
- "@applicaster/zapp-react-native-tvos-app": "12.0.0-rc.99",
42
- "@applicaster/zapp-react-native-ui-components": "12.0.0-rc.99",
43
- "@applicaster/zapp-react-native-utils": "12.0.0-rc.99",
39
+ "@applicaster/quick-brick-mobile-transport-controls": "12.0.1",
40
+ "@applicaster/quick-brick-tv-transport-controls": "12.0.1",
41
+ "@applicaster/zapp-react-native-tvos-app": "12.0.1",
42
+ "@applicaster/zapp-react-native-ui-components": "12.0.1",
43
+ "@applicaster/zapp-react-native-utils": "12.0.1",
44
44
  "keymirror": "^0.1.1",
45
45
  "query-string": "7.1.3",
46
46
  "react-native-web-linear-gradient": "1.1.2",
@@ -1,4 +1,4 @@
1
- import React from "react";
1
+ import React, { memo } from "react";
2
2
  import { LiveImageManager } from "@applicaster/zapp-react-native-ui-components/Components/VideoLive/LiveImageManager";
3
3
 
4
4
  import { Context } from "./Context";
@@ -86,7 +86,7 @@ const initialEntryState = () => ({
86
86
  });
87
87
 
88
88
  export function ContextProvider(Component: ReactComponent<any>) {
89
- return function DefaultPlayerProvider({
89
+ return memo(function DefaultPlayerProvider({
90
90
  children,
91
91
  }: CellActionContextProviderProps) {
92
92
  const contextValue = React.useMemo(
@@ -104,5 +104,5 @@ export function ContextProvider(Component: ReactComponent<any>) {
104
104
  <Component>{children}</Component>
105
105
  </Context.Provider>
106
106
  );
107
- };
107
+ });
108
108
  }
@@ -21,14 +21,8 @@ import { PlayerWrapper } from "@applicaster/zapp-react-native-ui-components/Comp
21
21
 
22
22
  import { PlayNextOverlay } from "./PlayNextOverlay";
23
23
  import { PlayerImageBackground } from "@applicaster/zapp-react-native-ui-components/Components/PlayerImageBackground";
24
- import { AnalyticsTracker } from "@applicaster/zapp-react-native-utils/analyticsUtils/analyticsTracker";
25
24
 
26
- import {
27
- AD_EVENT,
28
- GENERAL_EVENT,
29
- PLAYBACK_EVENT,
30
- QOS_EVENT,
31
- } from "@applicaster/zapp-react-native-utils/analyticsUtils/events";
25
+ import { GENERAL_EVENT } from "@applicaster/zapp-react-native-utils/analyticsUtils/events";
32
26
  import { Categories, createLogger, Subsystem } from "../logger";
33
27
  import { parseLanguageTracks } from "@applicaster/zapp-react-native-utils/playerUtils/configurationUtils";
34
28
  import { DEFAULT_COLORS, SEEK_TIME } from "../utils/const";
@@ -42,6 +36,9 @@ import {
42
36
  AnimationComponent,
43
37
  ComponentAnimationType,
44
38
  } from "@applicaster/zapp-react-native-ui-components/Components/VideoModal/ModalAnimation";
39
+ import { PlayerAnalyticsManager } from "@applicaster/zapp-react-native-utils/analyticsUtils/PlayerAnalyticsManager";
40
+ import { PlayerAnalyticsTrackerI } from "@applicaster/zapp-react-native-utils/analyticsUtils/playerAnalyticsTracker";
41
+
45
42
  import { RNPlayerManager } from "@applicaster/zapp-react-native-utils/appUtils/playerManager/nativePlayerManager";
46
43
 
47
44
  const styles = StyleSheet.create({
@@ -67,7 +64,6 @@ export default class VideoPlayer extends React.Component<
67
64
  > {
68
65
  public static propTypes = {};
69
66
  _root: any;
70
- analyticsTracker: AnalyticsTracker;
71
67
  playerPluginId: string;
72
68
  takeParentStyle: Record<any, any>;
73
69
  playbackStarted = false;
@@ -98,6 +94,17 @@ export default class VideoPlayer extends React.Component<
98
94
  duration: 0,
99
95
  };
100
96
 
97
+ private _tracker: PlayerAnalyticsTrackerI;
98
+ get analyticsTracker() {
99
+ if (!this._tracker) {
100
+ this._tracker = PlayerAnalyticsManager.getInstance().getTracker(
101
+ this.props.playerId
102
+ );
103
+ }
104
+
105
+ return this._tracker;
106
+ }
107
+
101
108
  constructor(props) {
102
109
  super(props);
103
110
  this.onVideoLoadCalled = false; // android
@@ -106,14 +113,13 @@ export default class VideoPlayer extends React.Component<
106
113
  ? { width: "100%", flex: "1 1 auto", objectFit: "contain" }
107
114
  : { flexBasis: "auto", flexGrow: 1, flexShrink: 1 };
108
115
 
109
- const entry = this.props?.entry;
110
- this.analyticsTracker = new AnalyticsTracker(entry);
111
116
  this.playerPluginId = this.props?.playerPluginIdentifier;
112
117
  }
113
118
 
114
119
  componentWillUnmount() {
115
120
  this.playbackStarted = false;
116
- this.handleAnalyticEvent(GENERAL_EVENT.session_end);
121
+
122
+ this.analyticsTracker.handleAnalyticEvent(GENERAL_EVENT.session_end);
117
123
  this.onPlayerClosed();
118
124
 
119
125
  if (isAndroidPlatform()) {
@@ -174,27 +180,6 @@ export default class VideoPlayer extends React.Component<
174
180
  return this.props.pluginConfiguration;
175
181
  };
176
182
 
177
- /**
178
- * Handles analytic events, generates a new analytics tracker and transmits events
179
- * Passes entry data, and playerState to the tracker for additional context
180
- * The end result is an event formatted and passed to AnalyticsBridge.postEvent
181
- * When we get the synthetic event we need to pull the data in the nativeEvent object
182
- * nativeEvent contains the return value from native
183
- */
184
- handleAnalyticEvent = (event, data = {}) => {
185
- const entry = this.props?.entry;
186
- const playerState = this.getState();
187
-
188
- if (this.analyticsTracker?.handleAnalyticEvent) {
189
- this.analyticsTracker?.handleAnalyticEvent?.(
190
- event,
191
- { ...data, player_type: this.props.playerPluginIdentifier },
192
- entry,
193
- playerState
194
- );
195
- }
196
- };
197
-
198
183
  /**
199
184
  * This method is for the events that have no implementation in react but are being invoked by native
200
185
  * When we get the synthetic event we need to pull the data in the nativeEvent object
@@ -394,28 +379,16 @@ export default class VideoPlayer extends React.Component<
394
379
  };
395
380
 
396
381
  onPlayerPresented = () => {
397
- this.handleAnalyticEvent(GENERAL_EVENT.player_presented);
382
+ this.analyticsTracker?.handleAnalyticEvent(GENERAL_EVENT.player_presented);
398
383
  };
399
384
 
400
385
  onPlayerClosed = () => {
401
- this.handleAnalyticEvent(GENERAL_EVENT.player_closed);
402
- };
403
-
404
- onPlayerSessionEnd = () => {
405
- // TODO: Implement method on native android, ios exists
406
- this.handleAnalyticEvent(GENERAL_EVENT.session_end);
407
- };
408
-
409
- onPlayerSessionStart = () => {
410
- // TODO: Implement method on native android, ios exists
411
-
412
- this.handleAnalyticEvent(GENERAL_EVENT.session_start);
386
+ this.analyticsTracker?.handleAnalyticEvent(GENERAL_EVENT.player_closed);
413
387
  };
414
388
 
415
389
  onVideoEnd = () => {
416
390
  this.setState({ displayOverlay: !this.state.displayOverlay }, () => {
417
391
  if (this.state?.displayOverlay) {
418
- this.handleAnalyticEvent(PLAYBACK_EVENT.complete);
419
392
  this.props?.listener?.onVideoEnd({});
420
393
  }
421
394
  });
@@ -425,15 +398,12 @@ export default class VideoPlayer extends React.Component<
425
398
  onVideoError = ({ nativeEvent }) => {
426
399
  const { message } = nativeEvent;
427
400
 
428
- this.handleAnalyticEvent(PLAYBACK_EVENT.error, nativeEvent);
429
-
430
401
  return this.props?.listener?.onError(new Error(message));
431
402
  };
432
403
 
433
404
  onPlayerPause = ({ nativeEvent = null }) => {
434
405
  this.setState({ paused: true });
435
406
  this.props?.listener?.onPlayerPause(nativeEvent);
436
- this.handleAnalyticEvent(PLAYBACK_EVENT.pause, nativeEvent);
437
407
  };
438
408
 
439
409
  onPlayerResume = ({ nativeEvent = null }) => {
@@ -444,98 +414,61 @@ export default class VideoPlayer extends React.Component<
444
414
 
445
415
  if (isNotAnAd && !resume) {
446
416
  this.setState({ resume: true });
447
- this.handleAnalyticEvent(PLAYBACK_EVENT.play, nativeEvent);
448
417
  }
449
418
  };
450
419
 
451
420
  onPlayerSeekComplete = ({ nativeEvent }) => {
452
421
  this.props?.listener?.onPlayerSeekComplete(nativeEvent);
453
- this.handleAnalyticEvent(PLAYBACK_EVENT.seek_complete, nativeEvent);
454
422
  };
455
423
 
456
424
  onPlayerSeekStart = ({ nativeEvent }) => {
457
425
  this.props?.listener?.onPlayerSeekStart(nativeEvent);
458
- this.handleAnalyticEvent(PLAYBACK_EVENT.seek_start, nativeEvent);
459
426
  };
460
427
 
461
428
  onBufferStart = ({ nativeEvent }) => {
462
429
  this.props?.listener?.onBufferStart(nativeEvent);
463
- this.handleAnalyticEvent(PLAYBACK_EVENT.buffer_start, nativeEvent);
464
430
  };
465
431
 
466
432
  onBufferComplete = ({ nativeEvent }) => {
467
433
  this.props?.listener?.onBufferComplete(nativeEvent);
468
- this.handleAnalyticEvent(PLAYBACK_EVENT.buffer_complete, nativeEvent);
469
- };
470
-
471
- onPlayerNext = ({ nativeEvent }) => {
472
- // TODO: Implement method on native
473
-
474
- this.handleAnalyticEvent(PLAYBACK_EVENT.next, nativeEvent);
475
- };
476
-
477
- onPlayerPrevious = ({ nativeEvent }) => {
478
- // TODO: Implement method on native
479
-
480
- this.handleAnalyticEvent(PLAYBACK_EVENT.previous, nativeEvent);
481
- };
482
-
483
- onPlayerStop = ({ nativeEvent }) => {
484
- // TODO: Implement method on native
485
-
486
- this.handleAnalyticEvent(PLAYBACK_EVENT.stop, nativeEvent);
487
- };
488
-
489
- onVideoBandwidthUpdate = ({ nativeEvent }) => {
490
- // TODO: Implement method on native
491
-
492
- this.handleAnalyticEvent(QOS_EVENT.bitrate_changed, nativeEvent);
493
434
  };
494
435
 
495
436
  onAdBegin = ({ nativeEvent }) => {
496
437
  this.setState({ isAd: true });
497
- this.handleAnalyticEvent(AD_EVENT.ad_start, nativeEvent);
498
438
  this.props.listener?.onAdBegin?.(nativeEvent);
499
439
  };
500
440
 
501
441
  onAdBreakBegin = ({ nativeEvent }) => {
502
442
  this.setState({ isAd: true });
503
- this.handleAnalyticEvent(AD_EVENT.ad_break_start, nativeEvent);
504
443
  this.props.listener?.onAdBreakBegin?.(nativeEvent);
505
444
  };
506
445
 
507
446
  onAdBreakEnd = ({ nativeEvent }) => {
508
447
  this.setState({ isAd: false });
509
- this.handleAnalyticEvent(AD_EVENT.ad_break_completed, nativeEvent);
510
448
  this.props.listener?.onAdBreakEnd?.(nativeEvent);
511
449
  };
512
450
 
513
451
  onAdEnd = ({ nativeEvent }) => {
514
452
  this.setState({ isAd: false });
515
- this.handleAnalyticEvent(AD_EVENT.ad_complete, nativeEvent);
516
453
  this.props.listener?.onAdEnd?.(nativeEvent);
517
454
  };
518
455
 
519
456
  onAdError = ({ nativeEvent }) => {
520
457
  this.setState({ isAd: false });
521
- this.handleAnalyticEvent(AD_EVENT.ad_error, nativeEvent);
522
458
  this.props.listener?.onAdError?.(nativeEvent);
523
459
  };
524
460
 
525
461
  onAdRequest = ({ nativeEvent }) => {
526
- this.handleAnalyticEvent(AD_EVENT.ad_request, nativeEvent);
527
462
  this.props.listener?.onAdRequest?.(nativeEvent);
528
463
  };
529
464
 
530
465
  onAdClicked = ({ nativeEvent }) => {
531
- this.handleAnalyticEvent(AD_EVENT.ad_clicked, nativeEvent);
532
466
  // Broadcast click event
533
467
  this.props.playerEvent("ad-clicked", nativeEvent);
534
468
  this.props.listener?.onAdClicked?.(nativeEvent);
535
469
  };
536
470
 
537
471
  onAdTapped = ({ nativeEvent }) => {
538
- this.handleAnalyticEvent(AD_EVENT.ad_tapped, nativeEvent);
539
472
  // Broadcast click event
540
473
  this.props.playerEvent("ad-tapped", nativeEvent);
541
474
  this.props.listener?.onAdTapped?.(nativeEvent);
@@ -648,10 +581,6 @@ export default class VideoPlayer extends React.Component<
648
581
  }
649
582
 
650
583
  if (!this.state.isAd && !this.onVideoLoadCalled) {
651
- this.handleAnalyticEvent(PLAYBACK_EVENT.load_video, {
652
- player_type: this.props.playerPluginIdentifier,
653
- });
654
-
655
584
  // TODO: Hack, needs to remove
656
585
  this.onVideoLoadCalled = true;
657
586
  }
@@ -919,8 +848,6 @@ export default class VideoPlayer extends React.Component<
919
848
  onPlayerResume: this.onPlayerResume, // play
920
849
  onPlayerSeekComplete: this.onPlayerSeekComplete, // seek_complete
921
850
  onPlayerSeekStart: this.onPlayerSeekStart, // seek_start
922
- onPlayerSessionEnd: this.onPlayerSessionEnd, // session_end
923
- onPlayerSessionStart: this.onPlayerSessionStart, // session_start
924
851
  };
925
852
 
926
853
  const lifecycleEvents = {
@@ -953,7 +880,6 @@ export default class VideoPlayer extends React.Component<
953
880
  onTimedMetadata: this.unHandledEvent("onTimedMetadata"),
954
881
  onTracksChanged: this.onTracksChanged,
955
882
  eventSubtitlesChange: this.unHandledEvent("eventSubtitlesChange"),
956
- onVideoBandwidthUpdate: this.onVideoBandwidthUpdate,
957
883
  };
958
884
 
959
885
  const playerSystemEvents = {
@@ -973,9 +899,6 @@ export default class VideoPlayer extends React.Component<
973
899
  const unsupportedEvents = {
974
900
  onBufferComplete: this.onBufferComplete, // buffer_complete
975
901
  onBufferStart: this.onBufferStart, // buffer_start
976
- onPlayerNext: this.onPlayerNext, // next
977
- onPlayerPrevious: this.onPlayerPrevious, // previous
978
- onPlayerStop: this.onPlayerStop, // stop
979
902
  };
980
903
 
981
904
  const nativeEvents = {