@applicaster/quick-brick-player 12.0.0-rc.13 → 12.0.0-rc.131
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 +7 -6
- package/src/CellPlayer/Assets/AssetsComponent.tsx +61 -50
- package/src/CellPlayer/ContextProvider.tsx +53 -4
- package/src/Player/AudioLayer/AudioDescription.tsx +3 -3
- package/src/Player/AudioLayer/AudioPlayerWrapper.tsx +277 -58
- package/src/Player/AudioLayer/Layout/DefaultLayout.tsx +260 -71
- package/src/Player/AudioLayer/Layout/DockedLayout.tsx +81 -27
- package/src/Player/AudioLayer/Layout/defaultLayoutsConts.ts +32 -1
- package/src/Player/AudioLayer/Layout/index.tsx +9 -7
- package/src/Player/AudioLayer/MagicBG/index.tsx +96 -27
- package/src/Player/AudioLayer/utils.ts +33 -0
- package/src/Player/Utils/Utils.ts +26 -16
- package/src/Player/Utils/index.tsx +0 -2
- package/src/Player/index.tsx +146 -167
package/src/Player/index.tsx
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
import React from "react";
|
|
5
5
|
import * as R from "ramda";
|
|
6
6
|
|
|
7
|
-
import { findNodeHandle,
|
|
7
|
+
import { findNodeHandle, StyleSheet, View } from "react-native";
|
|
8
8
|
import TransportControlsMobile from "@applicaster/quick-brick-mobile-transport-controls";
|
|
9
9
|
import TransportControlsTV from "@applicaster/quick-brick-tv-transport-controls";
|
|
10
10
|
|
|
@@ -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";
|
|
@@ -36,15 +30,16 @@ import { AudioPlayerWrapper } from "./AudioLayer/AudioPlayerWrapper";
|
|
|
36
30
|
import { playerManager } from "@applicaster/zapp-react-native-utils/appUtils";
|
|
37
31
|
import { getAllAccessibilityProps } from "@applicaster/zapp-react-native-utils/configurationUtils";
|
|
38
32
|
import { PlayNextData } from "@applicaster/zapp-react-native-ui-components/Components/PlayerContainer/PlayerContainer";
|
|
33
|
+
import { getTargetScreenDataFromEntry } from "@applicaster/zapp-react-native-utils/reactHooks/screen/useTargetScreenData";
|
|
34
|
+
import { isAppleTV } from "@applicaster/zapp-react-native-ui-components/Helpers/Platform";
|
|
35
|
+
import {
|
|
36
|
+
AnimationComponent,
|
|
37
|
+
ComponentAnimationType,
|
|
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";
|
|
39
41
|
|
|
40
|
-
|
|
41
|
-
QuickBrickPlayerPlugin: isApplePlatform()
|
|
42
|
-
? NativeModules.PlayerModule
|
|
43
|
-
: NativeModules.QuickBrickDefaultPlayerModule,
|
|
44
|
-
KalturaPlayerPlugin: isApplePlatform()
|
|
45
|
-
? NativeModules.KalturaPlayerModule
|
|
46
|
-
: NativeModules.QBKalturaPlayerModule,
|
|
47
|
-
};
|
|
42
|
+
import { RNPlayerManager } from "@applicaster/zapp-react-native-utils/appUtils/playerManager/nativePlayerManager";
|
|
48
43
|
|
|
49
44
|
const styles = StyleSheet.create({
|
|
50
45
|
container: { flex: 1 },
|
|
@@ -55,6 +50,7 @@ const styles = StyleSheet.create({
|
|
|
55
50
|
position: "absolute",
|
|
56
51
|
zIndex: 1,
|
|
57
52
|
},
|
|
53
|
+
playerSize: { width: "100%", height: "100%" },
|
|
58
54
|
});
|
|
59
55
|
|
|
60
56
|
const logger = createLogger({
|
|
@@ -68,7 +64,6 @@ export default class VideoPlayer extends React.Component<
|
|
|
68
64
|
> {
|
|
69
65
|
public static propTypes = {};
|
|
70
66
|
_root: any;
|
|
71
|
-
analyticsTracker: AnalyticsTracker;
|
|
72
67
|
playerPluginId: string;
|
|
73
68
|
takeParentStyle: Record<any, any>;
|
|
74
69
|
playbackStarted = false;
|
|
@@ -87,7 +82,7 @@ export default class VideoPlayer extends React.Component<
|
|
|
87
82
|
// TODO: Can be deleted, on controller logic
|
|
88
83
|
paused: false,
|
|
89
84
|
piped: false,
|
|
90
|
-
rate: 1,
|
|
85
|
+
rate: 1.0,
|
|
91
86
|
// TODO: Hack for analytics, must br removed
|
|
92
87
|
resume: null,
|
|
93
88
|
|
|
@@ -99,6 +94,17 @@ export default class VideoPlayer extends React.Component<
|
|
|
99
94
|
duration: 0,
|
|
100
95
|
};
|
|
101
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
|
+
|
|
102
108
|
constructor(props) {
|
|
103
109
|
super(props);
|
|
104
110
|
this.onVideoLoadCalled = false; // android
|
|
@@ -107,16 +113,13 @@ export default class VideoPlayer extends React.Component<
|
|
|
107
113
|
? { width: "100%", flex: "1 1 auto", objectFit: "contain" }
|
|
108
114
|
: { flexBasis: "auto", flexGrow: 1, flexShrink: 1 };
|
|
109
115
|
|
|
110
|
-
const entry = this.props?.entry;
|
|
111
|
-
this.analyticsTracker = new AnalyticsTracker(entry);
|
|
112
116
|
this.playerPluginId = this.props?.playerPluginIdentifier;
|
|
113
117
|
}
|
|
114
118
|
|
|
115
119
|
componentWillUnmount() {
|
|
116
|
-
this.stopBackgroundPlayback();
|
|
117
|
-
|
|
118
120
|
this.playbackStarted = false;
|
|
119
|
-
|
|
121
|
+
|
|
122
|
+
this.analyticsTracker.handleAnalyticEvent(GENERAL_EVENT.session_end);
|
|
120
123
|
this.onPlayerClosed();
|
|
121
124
|
|
|
122
125
|
if (isAndroidPlatform()) {
|
|
@@ -159,6 +162,11 @@ export default class VideoPlayer extends React.Component<
|
|
|
159
162
|
}
|
|
160
163
|
}
|
|
161
164
|
|
|
165
|
+
// For close button
|
|
166
|
+
public closeNativePlayer = () => {
|
|
167
|
+
this.stopBackgroundPlayback();
|
|
168
|
+
};
|
|
169
|
+
|
|
162
170
|
getPlayNextData = () => this.props.playNextData as PlayNextData;
|
|
163
171
|
|
|
164
172
|
/**
|
|
@@ -172,27 +180,6 @@ export default class VideoPlayer extends React.Component<
|
|
|
172
180
|
return this.props.pluginConfiguration;
|
|
173
181
|
};
|
|
174
182
|
|
|
175
|
-
/**
|
|
176
|
-
* Handles analytic events, generates a new analytics tracker and transmits events
|
|
177
|
-
* Passes entry data, and playerState to the tracker for additional context
|
|
178
|
-
* The end result is an event formatted and passed to AnalyticsBridge.postEvent
|
|
179
|
-
* When we get the synthetic event we need to pull the data in the nativeEvent object
|
|
180
|
-
* nativeEvent contains the return value from native
|
|
181
|
-
*/
|
|
182
|
-
handleAnalyticEvent = (event, data = {}) => {
|
|
183
|
-
const entry = this.props?.entry;
|
|
184
|
-
const playerState = this.getState();
|
|
185
|
-
|
|
186
|
-
if (this.analyticsTracker?.handleAnalyticEvent) {
|
|
187
|
-
this.analyticsTracker?.handleAnalyticEvent?.(
|
|
188
|
-
event,
|
|
189
|
-
{ ...data, player_type: this.props.playerPluginIdentifier },
|
|
190
|
-
entry,
|
|
191
|
-
playerState
|
|
192
|
-
);
|
|
193
|
-
}
|
|
194
|
-
};
|
|
195
|
-
|
|
196
183
|
/**
|
|
197
184
|
* This method is for the events that have no implementation in react but are being invoked by native
|
|
198
185
|
* When we get the synthetic event we need to pull the data in the nativeEvent object
|
|
@@ -333,11 +320,7 @@ export default class VideoPlayer extends React.Component<
|
|
|
333
320
|
}
|
|
334
321
|
};
|
|
335
322
|
|
|
336
|
-
|
|
337
|
-
* Sets either subtitle language, or audio language if we have a selected a new locale.
|
|
338
|
-
* If no locale is set it defaults to system language for audio, and leaves subtitles unaltered.
|
|
339
|
-
*/
|
|
340
|
-
setLanguage = (selected = null) => {
|
|
323
|
+
selectTrack = (selected) => {
|
|
341
324
|
const { trackType, id, language } = selected || {};
|
|
342
325
|
|
|
343
326
|
const isOff = language === "Off";
|
|
@@ -368,6 +351,10 @@ export default class VideoPlayer extends React.Component<
|
|
|
368
351
|
}
|
|
369
352
|
};
|
|
370
353
|
|
|
354
|
+
setPlaybackRate = (rate = 1.0) => {
|
|
355
|
+
this.setState({ rate });
|
|
356
|
+
};
|
|
357
|
+
|
|
371
358
|
getCurrentTime = () => {
|
|
372
359
|
return this.state.currentTime;
|
|
373
360
|
};
|
|
@@ -392,28 +379,16 @@ export default class VideoPlayer extends React.Component<
|
|
|
392
379
|
};
|
|
393
380
|
|
|
394
381
|
onPlayerPresented = () => {
|
|
395
|
-
this.handleAnalyticEvent(GENERAL_EVENT.player_presented);
|
|
382
|
+
this.analyticsTracker?.handleAnalyticEvent(GENERAL_EVENT.player_presented);
|
|
396
383
|
};
|
|
397
384
|
|
|
398
385
|
onPlayerClosed = () => {
|
|
399
|
-
this.handleAnalyticEvent(GENERAL_EVENT.player_closed);
|
|
400
|
-
};
|
|
401
|
-
|
|
402
|
-
onPlayerSessionEnd = () => {
|
|
403
|
-
// TODO: Implement method on native android, ios exists
|
|
404
|
-
this.handleAnalyticEvent(GENERAL_EVENT.session_end);
|
|
405
|
-
};
|
|
406
|
-
|
|
407
|
-
onPlayerSessionStart = () => {
|
|
408
|
-
// TODO: Implement method on native android, ios exists
|
|
409
|
-
|
|
410
|
-
this.handleAnalyticEvent(GENERAL_EVENT.session_start);
|
|
386
|
+
this.analyticsTracker?.handleAnalyticEvent(GENERAL_EVENT.player_closed);
|
|
411
387
|
};
|
|
412
388
|
|
|
413
389
|
onVideoEnd = () => {
|
|
414
390
|
this.setState({ displayOverlay: !this.state.displayOverlay }, () => {
|
|
415
391
|
if (this.state?.displayOverlay) {
|
|
416
|
-
this.handleAnalyticEvent(PLAYBACK_EVENT.complete);
|
|
417
392
|
this.props?.listener?.onVideoEnd({});
|
|
418
393
|
}
|
|
419
394
|
});
|
|
@@ -423,15 +398,12 @@ export default class VideoPlayer extends React.Component<
|
|
|
423
398
|
onVideoError = ({ nativeEvent }) => {
|
|
424
399
|
const { message } = nativeEvent;
|
|
425
400
|
|
|
426
|
-
this.handleAnalyticEvent(PLAYBACK_EVENT.error, nativeEvent);
|
|
427
|
-
|
|
428
401
|
return this.props?.listener?.onError(new Error(message));
|
|
429
402
|
};
|
|
430
403
|
|
|
431
404
|
onPlayerPause = ({ nativeEvent = null }) => {
|
|
432
405
|
this.setState({ paused: true });
|
|
433
406
|
this.props?.listener?.onPlayerPause(nativeEvent);
|
|
434
|
-
this.handleAnalyticEvent(PLAYBACK_EVENT.pause, nativeEvent);
|
|
435
407
|
};
|
|
436
408
|
|
|
437
409
|
onPlayerResume = ({ nativeEvent = null }) => {
|
|
@@ -442,98 +414,61 @@ export default class VideoPlayer extends React.Component<
|
|
|
442
414
|
|
|
443
415
|
if (isNotAnAd && !resume) {
|
|
444
416
|
this.setState({ resume: true });
|
|
445
|
-
this.handleAnalyticEvent(PLAYBACK_EVENT.play, nativeEvent);
|
|
446
417
|
}
|
|
447
418
|
};
|
|
448
419
|
|
|
449
420
|
onPlayerSeekComplete = ({ nativeEvent }) => {
|
|
450
421
|
this.props?.listener?.onPlayerSeekComplete(nativeEvent);
|
|
451
|
-
this.handleAnalyticEvent(PLAYBACK_EVENT.seek_complete, nativeEvent);
|
|
452
422
|
};
|
|
453
423
|
|
|
454
424
|
onPlayerSeekStart = ({ nativeEvent }) => {
|
|
455
425
|
this.props?.listener?.onPlayerSeekStart(nativeEvent);
|
|
456
|
-
this.handleAnalyticEvent(PLAYBACK_EVENT.seek_start, nativeEvent);
|
|
457
426
|
};
|
|
458
427
|
|
|
459
428
|
onBufferStart = ({ nativeEvent }) => {
|
|
460
429
|
this.props?.listener?.onBufferStart(nativeEvent);
|
|
461
|
-
this.handleAnalyticEvent(PLAYBACK_EVENT.buffer_start, nativeEvent);
|
|
462
430
|
};
|
|
463
431
|
|
|
464
432
|
onBufferComplete = ({ nativeEvent }) => {
|
|
465
433
|
this.props?.listener?.onBufferComplete(nativeEvent);
|
|
466
|
-
this.handleAnalyticEvent(PLAYBACK_EVENT.buffer_complete, nativeEvent);
|
|
467
|
-
};
|
|
468
|
-
|
|
469
|
-
onPlayerNext = ({ nativeEvent }) => {
|
|
470
|
-
// TODO: Implement method on native
|
|
471
|
-
|
|
472
|
-
this.handleAnalyticEvent(PLAYBACK_EVENT.next, nativeEvent);
|
|
473
|
-
};
|
|
474
|
-
|
|
475
|
-
onPlayerPrevious = ({ nativeEvent }) => {
|
|
476
|
-
// TODO: Implement method on native
|
|
477
|
-
|
|
478
|
-
this.handleAnalyticEvent(PLAYBACK_EVENT.previous, nativeEvent);
|
|
479
|
-
};
|
|
480
|
-
|
|
481
|
-
onPlayerStop = ({ nativeEvent }) => {
|
|
482
|
-
// TODO: Implement method on native
|
|
483
|
-
|
|
484
|
-
this.handleAnalyticEvent(PLAYBACK_EVENT.stop, nativeEvent);
|
|
485
|
-
};
|
|
486
|
-
|
|
487
|
-
onVideoBandwidthUpdate = ({ nativeEvent }) => {
|
|
488
|
-
// TODO: Implement method on native
|
|
489
|
-
|
|
490
|
-
this.handleAnalyticEvent(QOS_EVENT.bitrate_changed, nativeEvent);
|
|
491
434
|
};
|
|
492
435
|
|
|
493
436
|
onAdBegin = ({ nativeEvent }) => {
|
|
494
437
|
this.setState({ isAd: true });
|
|
495
|
-
this.handleAnalyticEvent(AD_EVENT.ad_start, nativeEvent);
|
|
496
438
|
this.props.listener?.onAdBegin?.(nativeEvent);
|
|
497
439
|
};
|
|
498
440
|
|
|
499
441
|
onAdBreakBegin = ({ nativeEvent }) => {
|
|
500
442
|
this.setState({ isAd: true });
|
|
501
|
-
this.handleAnalyticEvent(AD_EVENT.ad_break_start, nativeEvent);
|
|
502
443
|
this.props.listener?.onAdBreakBegin?.(nativeEvent);
|
|
503
444
|
};
|
|
504
445
|
|
|
505
446
|
onAdBreakEnd = ({ nativeEvent }) => {
|
|
506
447
|
this.setState({ isAd: false });
|
|
507
|
-
this.handleAnalyticEvent(AD_EVENT.ad_break_completed, nativeEvent);
|
|
508
448
|
this.props.listener?.onAdBreakEnd?.(nativeEvent);
|
|
509
449
|
};
|
|
510
450
|
|
|
511
451
|
onAdEnd = ({ nativeEvent }) => {
|
|
512
452
|
this.setState({ isAd: false });
|
|
513
|
-
this.handleAnalyticEvent(AD_EVENT.ad_complete, nativeEvent);
|
|
514
453
|
this.props.listener?.onAdEnd?.(nativeEvent);
|
|
515
454
|
};
|
|
516
455
|
|
|
517
456
|
onAdError = ({ nativeEvent }) => {
|
|
518
457
|
this.setState({ isAd: false });
|
|
519
|
-
this.handleAnalyticEvent(AD_EVENT.ad_error, nativeEvent);
|
|
520
458
|
this.props.listener?.onAdError?.(nativeEvent);
|
|
521
459
|
};
|
|
522
460
|
|
|
523
461
|
onAdRequest = ({ nativeEvent }) => {
|
|
524
|
-
this.handleAnalyticEvent(AD_EVENT.ad_request, nativeEvent);
|
|
525
462
|
this.props.listener?.onAdRequest?.(nativeEvent);
|
|
526
463
|
};
|
|
527
464
|
|
|
528
465
|
onAdClicked = ({ nativeEvent }) => {
|
|
529
|
-
this.handleAnalyticEvent(AD_EVENT.ad_clicked, nativeEvent);
|
|
530
466
|
// Broadcast click event
|
|
531
467
|
this.props.playerEvent("ad-clicked", nativeEvent);
|
|
532
468
|
this.props.listener?.onAdClicked?.(nativeEvent);
|
|
533
469
|
};
|
|
534
470
|
|
|
535
471
|
onAdTapped = ({ nativeEvent }) => {
|
|
536
|
-
this.handleAnalyticEvent(AD_EVENT.ad_tapped, nativeEvent);
|
|
537
472
|
// Broadcast click event
|
|
538
473
|
this.props.playerEvent("ad-tapped", nativeEvent);
|
|
539
474
|
this.props.listener?.onAdTapped?.(nativeEvent);
|
|
@@ -551,6 +486,26 @@ export default class VideoPlayer extends React.Component<
|
|
|
551
486
|
this.props.listener?.onPlayerDetached?.(nativeEvent);
|
|
552
487
|
};
|
|
553
488
|
|
|
489
|
+
onVideoFullscreenPlayerDidDismiss = () => {
|
|
490
|
+
this.props.listener?.onVideoFullscreenPlayerDidDismiss?.();
|
|
491
|
+
};
|
|
492
|
+
|
|
493
|
+
onVideoFullscreenPlayerDidPresent = () => {
|
|
494
|
+
this.props.listener?.onVideoFullscreenPlayerDidPresent?.();
|
|
495
|
+
};
|
|
496
|
+
|
|
497
|
+
onVideoFullscreenPlayerWillDismiss = () => {
|
|
498
|
+
this.props.listener?.onVideoFullscreenPlayerWillDismiss?.();
|
|
499
|
+
};
|
|
500
|
+
|
|
501
|
+
onVideoFullscreenPlayerWillPresent = () => {
|
|
502
|
+
this.props.listener?.onVideoFullscreenPlayerWillPresent?.();
|
|
503
|
+
};
|
|
504
|
+
|
|
505
|
+
onPlayerClose = () => {
|
|
506
|
+
this.props.listener?.onPlayerClose?.();
|
|
507
|
+
};
|
|
508
|
+
|
|
554
509
|
onPiPEnter = () => {
|
|
555
510
|
this.setState({ piped: true });
|
|
556
511
|
this.props.openPiP();
|
|
@@ -626,10 +581,6 @@ export default class VideoPlayer extends React.Component<
|
|
|
626
581
|
}
|
|
627
582
|
|
|
628
583
|
if (!this.state.isAd && !this.onVideoLoadCalled) {
|
|
629
|
-
this.handleAnalyticEvent(PLAYBACK_EVENT.load_video, {
|
|
630
|
-
player_type: this.props.playerPluginIdentifier,
|
|
631
|
-
});
|
|
632
|
-
|
|
633
584
|
// TODO: Hack, needs to remove
|
|
634
585
|
this.onVideoLoadCalled = true;
|
|
635
586
|
}
|
|
@@ -754,8 +705,6 @@ export default class VideoPlayer extends React.Component<
|
|
|
754
705
|
|
|
755
706
|
render() {
|
|
756
707
|
const {
|
|
757
|
-
castAction,
|
|
758
|
-
controls,
|
|
759
708
|
docked,
|
|
760
709
|
entry,
|
|
761
710
|
fullscreen,
|
|
@@ -765,9 +714,15 @@ export default class VideoPlayer extends React.Component<
|
|
|
765
714
|
isTabletPortrait,
|
|
766
715
|
muted,
|
|
767
716
|
style,
|
|
717
|
+
castAction,
|
|
718
|
+
controller,
|
|
719
|
+
startComponentsAnimation,
|
|
768
720
|
} = this.props;
|
|
769
721
|
|
|
770
|
-
const
|
|
722
|
+
const supportNativeCast = controller.supportNativeCast();
|
|
723
|
+
|
|
724
|
+
const { audioTrackId, keyEvent, paused, seek, textTrackId, rate } =
|
|
725
|
+
this.state;
|
|
771
726
|
|
|
772
727
|
const isAudioItem =
|
|
773
728
|
entry?.content?.type?.includes?.("audio") ||
|
|
@@ -812,17 +767,35 @@ export default class VideoPlayer extends React.Component<
|
|
|
812
767
|
const liveCatchUpEnabled =
|
|
813
768
|
this.props.pluginConfiguration?.liveCatchUpEnabled;
|
|
814
769
|
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
770
|
+
// TODO: Get screen data more reliable way useCurrentScreenData
|
|
771
|
+
const screenData = getTargetScreenDataFromEntry(this.props.playableItem);
|
|
772
|
+
|
|
773
|
+
const isInlineTV = screenData?.ui_components?.length > 0 && isTV();
|
|
818
774
|
|
|
819
|
-
|
|
775
|
+
let platformSpecificProps: any = isApplePlatform()
|
|
820
776
|
? {
|
|
821
|
-
...hideNativeControls,
|
|
822
777
|
resizeMode: nativeResizeMode,
|
|
823
778
|
}
|
|
824
779
|
: {};
|
|
825
780
|
|
|
781
|
+
const supportsNativeControls =
|
|
782
|
+
!!this.props.controller?.supportsNativeControls?.();
|
|
783
|
+
|
|
784
|
+
const controls = isAppleTV()
|
|
785
|
+
? (supportsNativeControls && !isInlineTV) || !!this.getPlayNextData()
|
|
786
|
+
: supportsNativeControls && !this.getPlayNextData();
|
|
787
|
+
|
|
788
|
+
const shouldUseNativeControls =
|
|
789
|
+
controls &&
|
|
790
|
+
!startComponentsAnimation &&
|
|
791
|
+
!docked &&
|
|
792
|
+
!castAction?.state?.connected;
|
|
793
|
+
|
|
794
|
+
platformSpecificProps = {
|
|
795
|
+
...platformSpecificProps,
|
|
796
|
+
controls: shouldUseNativeControls,
|
|
797
|
+
};
|
|
798
|
+
|
|
826
799
|
const pictureInPictureEnabled =
|
|
827
800
|
this.props.pluginConfiguration?.pictureInPictureEnabled;
|
|
828
801
|
|
|
@@ -830,7 +803,6 @@ export default class VideoPlayer extends React.Component<
|
|
|
830
803
|
entry, // Must be passed first in list
|
|
831
804
|
...platformSpecificProps,
|
|
832
805
|
audioTrackId,
|
|
833
|
-
controls,
|
|
834
806
|
docked,
|
|
835
807
|
enableAutoAudioTrackSelection,
|
|
836
808
|
fullscreen, // TODO: Check fullscreen params not crash
|
|
@@ -839,6 +811,7 @@ export default class VideoPlayer extends React.Component<
|
|
|
839
811
|
nowPlayingEnabled,
|
|
840
812
|
paused,
|
|
841
813
|
seek,
|
|
814
|
+
rate,
|
|
842
815
|
textTrackId,
|
|
843
816
|
liveSeekingEnabled,
|
|
844
817
|
liveCatchUpEnabled,
|
|
@@ -875,8 +848,6 @@ export default class VideoPlayer extends React.Component<
|
|
|
875
848
|
onPlayerResume: this.onPlayerResume, // play
|
|
876
849
|
onPlayerSeekComplete: this.onPlayerSeekComplete, // seek_complete
|
|
877
850
|
onPlayerSeekStart: this.onPlayerSeekStart, // seek_start
|
|
878
|
-
onPlayerSessionEnd: this.onPlayerSessionEnd, // session_end
|
|
879
|
-
onPlayerSessionStart: this.onPlayerSessionStart, // session_start
|
|
880
851
|
};
|
|
881
852
|
|
|
882
853
|
const lifecycleEvents = {
|
|
@@ -884,22 +855,17 @@ export default class VideoPlayer extends React.Component<
|
|
|
884
855
|
onVideoEnd: this.onVideoEnd, // complete
|
|
885
856
|
onVideoError: this.onVideoError, // error
|
|
886
857
|
onVideoProgress: this.onVideoProgress,
|
|
887
|
-
onVideoFullscreenPlayerDidDismiss: this.
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
onVideoFullscreenPlayerWillDismiss: this.unHandledEvent(
|
|
894
|
-
"onVideoFullscreenPlayerWillDismiss"
|
|
895
|
-
),
|
|
896
|
-
onVideoFullscreenPlayerWillPresent: this.unHandledEvent(
|
|
897
|
-
"onVideoFullscreenPlayerWillPresent"
|
|
898
|
-
),
|
|
858
|
+
onVideoFullscreenPlayerDidDismiss: this.onVideoFullscreenPlayerDidDismiss,
|
|
859
|
+
onVideoFullscreenPlayerDidPresent: this.onVideoFullscreenPlayerDidPresent,
|
|
860
|
+
onVideoFullscreenPlayerWillDismiss:
|
|
861
|
+
this.onVideoFullscreenPlayerWillDismiss,
|
|
862
|
+
onVideoFullscreenPlayerWillPresent:
|
|
863
|
+
this.onVideoFullscreenPlayerWillPresent,
|
|
899
864
|
onVideoLoad: this.onVideoLoad,
|
|
900
865
|
onVideoLoadStart: this.unHandledEvent("onVideoLoadStart"),
|
|
901
866
|
onVideoBuffer: this.onVideoBuffer,
|
|
902
867
|
onPlaybackStalled: this.onPlaybackStalled,
|
|
868
|
+
onPlayerClose: this.onPlayerClose,
|
|
903
869
|
onPlayerAttached: this.onPlayerAttached,
|
|
904
870
|
onPlayerDetached: this.onPlayerDetached,
|
|
905
871
|
};
|
|
@@ -914,7 +880,6 @@ export default class VideoPlayer extends React.Component<
|
|
|
914
880
|
onTimedMetadata: this.unHandledEvent("onTimedMetadata"),
|
|
915
881
|
onTracksChanged: this.onTracksChanged,
|
|
916
882
|
eventSubtitlesChange: this.unHandledEvent("eventSubtitlesChange"),
|
|
917
|
-
onVideoBandwidthUpdate: this.onVideoBandwidthUpdate,
|
|
918
883
|
};
|
|
919
884
|
|
|
920
885
|
const playerSystemEvents = {
|
|
@@ -934,9 +899,6 @@ export default class VideoPlayer extends React.Component<
|
|
|
934
899
|
const unsupportedEvents = {
|
|
935
900
|
onBufferComplete: this.onBufferComplete, // buffer_complete
|
|
936
901
|
onBufferStart: this.onBufferStart, // buffer_start
|
|
937
|
-
onPlayerNext: this.onPlayerNext, // next
|
|
938
|
-
onPlayerPrevious: this.onPlayerPrevious, // previous
|
|
939
|
-
onPlayerStop: this.onPlayerStop, // stop
|
|
940
902
|
};
|
|
941
903
|
|
|
942
904
|
const nativeEvents = {
|
|
@@ -950,7 +912,13 @@ export default class VideoPlayer extends React.Component<
|
|
|
950
912
|
...androidLifecyclePiPEvents,
|
|
951
913
|
};
|
|
952
914
|
|
|
953
|
-
const needToShowPlayNextOverlay =
|
|
915
|
+
const needToShowPlayNextOverlay =
|
|
916
|
+
isTV() && this.getPlayNextData() && !docked;
|
|
917
|
+
|
|
918
|
+
const needToShowDefaultControls = !(
|
|
919
|
+
(controls && !castAction?.state?.connected) ||
|
|
920
|
+
this.getPlayNextData()
|
|
921
|
+
);
|
|
954
922
|
|
|
955
923
|
const playerContainerStyles = isApplePlatform()
|
|
956
924
|
? styles.playerContainerBlack
|
|
@@ -973,7 +941,7 @@ export default class VideoPlayer extends React.Component<
|
|
|
973
941
|
!needToShowPlayNextOverlay &&
|
|
974
942
|
this.props.mode !== "PIP";
|
|
975
943
|
|
|
976
|
-
if (
|
|
944
|
+
if (shouldUseNativeControls) {
|
|
977
945
|
return null;
|
|
978
946
|
}
|
|
979
947
|
|
|
@@ -992,6 +960,7 @@ export default class VideoPlayer extends React.Component<
|
|
|
992
960
|
extraInfoText={castAction?.state?.friendlyStatus}
|
|
993
961
|
controlsAlwaysVisible={castAction?.state?.connected}
|
|
994
962
|
playNextData={this.getPlayNextData()}
|
|
963
|
+
needToShowDefaultControls={needToShowDefaultControls}
|
|
995
964
|
/>
|
|
996
965
|
) : null;
|
|
997
966
|
};
|
|
@@ -1026,29 +995,14 @@ export default class VideoPlayer extends React.Component<
|
|
|
1026
995
|
const renderMobilePlayer = () => {
|
|
1027
996
|
return isFullScreenAudioPlayer && isAudioItem ? (
|
|
1028
997
|
<View style={containerStyle}>
|
|
1029
|
-
{!castAction?.state?.connected && (
|
|
998
|
+
{(!castAction?.state?.connected || supportNativeCast) && (
|
|
1030
999
|
<this.props.PlayerComponent
|
|
1031
1000
|
ref={this._assignRoot}
|
|
1032
1001
|
{...nativeEvents}
|
|
1033
1002
|
{...nativeProps}
|
|
1034
1003
|
/>
|
|
1035
1004
|
)}
|
|
1036
|
-
<AudioPlayerWrapper {...sharedWrapperViewProps}
|
|
1037
|
-
<View>
|
|
1038
|
-
{
|
|
1039
|
-
<PlayNextOverlay
|
|
1040
|
-
item={entry}
|
|
1041
|
-
playerIsDocked={docked}
|
|
1042
|
-
pluginConfiguration={this.getPluginConfiguration()}
|
|
1043
|
-
playerId={this.props.playerId}
|
|
1044
|
-
playNextData={this.getPlayNextData()}
|
|
1045
|
-
setNextVideoPreloadThresholdPercentage={
|
|
1046
|
-
this.props.setNextVideoPreloadThresholdPercentage
|
|
1047
|
-
}
|
|
1048
|
-
/>
|
|
1049
|
-
}
|
|
1050
|
-
</View>
|
|
1051
|
-
</AudioPlayerWrapper>
|
|
1005
|
+
<AudioPlayerWrapper {...sharedWrapperViewProps} />
|
|
1052
1006
|
</View>
|
|
1053
1007
|
) : (
|
|
1054
1008
|
<PlayerWrapper {...sharedWrapperViewProps}>
|
|
@@ -1063,11 +1017,24 @@ export default class VideoPlayer extends React.Component<
|
|
|
1063
1017
|
<View style={styles.container}>
|
|
1064
1018
|
<View style={[playerContainerStyles, playerDimensions]}>
|
|
1065
1019
|
{isAudioItem && (
|
|
1066
|
-
<
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1020
|
+
<AnimationComponent
|
|
1021
|
+
animationType={ComponentAnimationType.player}
|
|
1022
|
+
additionalData={{
|
|
1023
|
+
...playerDimensions,
|
|
1024
|
+
inlineAudioPlayer: true,
|
|
1025
|
+
}}
|
|
1026
|
+
style={getStyle(playerDimensions)}
|
|
1027
|
+
>
|
|
1028
|
+
<AudioPlayer
|
|
1029
|
+
style={
|
|
1030
|
+
isTV()
|
|
1031
|
+
? getStyle(playerDimensions)
|
|
1032
|
+
: styles.playerSize
|
|
1033
|
+
}
|
|
1034
|
+
audio_item={entry}
|
|
1035
|
+
plugin_configuration={this.getPluginConfiguration()}
|
|
1036
|
+
/>
|
|
1037
|
+
</AnimationComponent>
|
|
1071
1038
|
)}
|
|
1072
1039
|
|
|
1073
1040
|
{shouldRenderBackground && (
|
|
@@ -1079,17 +1046,28 @@ export default class VideoPlayer extends React.Component<
|
|
|
1079
1046
|
/>
|
|
1080
1047
|
)}
|
|
1081
1048
|
|
|
1082
|
-
{!castAction?.state?.connected && (
|
|
1083
|
-
<
|
|
1084
|
-
|
|
1085
|
-
{
|
|
1086
|
-
{...nativeProps}
|
|
1087
|
-
listener={this.props.listener}
|
|
1049
|
+
{(!castAction?.state?.connected || supportNativeCast) && (
|
|
1050
|
+
<AnimationComponent
|
|
1051
|
+
animationType={ComponentAnimationType.player}
|
|
1052
|
+
additionalData={playerDimensions}
|
|
1088
1053
|
style={getStyle(playerDimensions)}
|
|
1089
|
-
pluginConfiguration={this.getPluginConfiguration()}
|
|
1090
1054
|
>
|
|
1091
|
-
|
|
1092
|
-
|
|
1055
|
+
<this.props.PlayerComponent
|
|
1056
|
+
ref={this._assignRoot}
|
|
1057
|
+
{...nativeEvents}
|
|
1058
|
+
{...nativeProps}
|
|
1059
|
+
listener={this.props.listener}
|
|
1060
|
+
style={
|
|
1061
|
+
isTV()
|
|
1062
|
+
? getStyle(playerDimensions)
|
|
1063
|
+
: styles.playerSize
|
|
1064
|
+
}
|
|
1065
|
+
pluginConfiguration={this.getPluginConfiguration()}
|
|
1066
|
+
controller={this.props.controller}
|
|
1067
|
+
>
|
|
1068
|
+
{this.childrenWithPlayNext()}
|
|
1069
|
+
</this.props.PlayerComponent>
|
|
1070
|
+
</AnimationComponent>
|
|
1093
1071
|
)}
|
|
1094
1072
|
</View>
|
|
1095
1073
|
|
|
@@ -1123,6 +1101,7 @@ export default class VideoPlayer extends React.Component<
|
|
|
1123
1101
|
listener={this.props.listener}
|
|
1124
1102
|
style={this.takeParentStyle}
|
|
1125
1103
|
pluginConfiguration={this.getPluginConfiguration()}
|
|
1104
|
+
controller={this.props.controller}
|
|
1126
1105
|
>
|
|
1127
1106
|
{this.childrenWithPlayNext()}
|
|
1128
1107
|
</this.props.PlayerComponent>
|