@applicaster/quick-brick-player 12.0.0-alpha.7725319213 → 12.0.0-alpha.7843515010
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 +10 -9
- package/src/CellPlayer/Assets/AssetsComponent.tsx +61 -50
- package/src/CellPlayer/ContextProvider.tsx +50 -1
- 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 +134 -177
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,19 +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";
|
|
39
|
-
import {
|
|
40
|
-
getTargetScreenDataFromEntry
|
|
41
|
-
} from "@applicaster/zapp-react-native-utils/reactHooks/screen/useTargetScreenData";
|
|
33
|
+
import { getTargetScreenDataFromEntry } from "@applicaster/zapp-react-native-utils/reactHooks/screen/useTargetScreenData";
|
|
42
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";
|
|
43
41
|
|
|
44
|
-
|
|
45
|
-
QuickBrickPlayerPlugin: isApplePlatform()
|
|
46
|
-
? NativeModules.PlayerModule
|
|
47
|
-
: NativeModules.QuickBrickDefaultPlayerModule,
|
|
48
|
-
KalturaPlayerPlugin: isApplePlatform()
|
|
49
|
-
? NativeModules.KalturaPlayerModule
|
|
50
|
-
: NativeModules.QBKalturaPlayerModule,
|
|
51
|
-
};
|
|
42
|
+
import { RNPlayerManager } from "@applicaster/zapp-react-native-utils/appUtils/playerManager/nativePlayerManager";
|
|
52
43
|
|
|
53
44
|
const styles = StyleSheet.create({
|
|
54
45
|
container: { flex: 1 },
|
|
@@ -59,6 +50,7 @@ const styles = StyleSheet.create({
|
|
|
59
50
|
position: "absolute",
|
|
60
51
|
zIndex: 1,
|
|
61
52
|
},
|
|
53
|
+
playerSize: { width: "100%", height: "100%" },
|
|
62
54
|
});
|
|
63
55
|
|
|
64
56
|
const logger = createLogger({
|
|
@@ -72,7 +64,6 @@ export default class VideoPlayer extends React.Component<
|
|
|
72
64
|
> {
|
|
73
65
|
public static propTypes = {};
|
|
74
66
|
_root: any;
|
|
75
|
-
analyticsTracker: AnalyticsTracker;
|
|
76
67
|
playerPluginId: string;
|
|
77
68
|
takeParentStyle: Record<any, any>;
|
|
78
69
|
playbackStarted = false;
|
|
@@ -91,7 +82,7 @@ export default class VideoPlayer extends React.Component<
|
|
|
91
82
|
// TODO: Can be deleted, on controller logic
|
|
92
83
|
paused: false,
|
|
93
84
|
piped: false,
|
|
94
|
-
rate: 1,
|
|
85
|
+
rate: 1.0,
|
|
95
86
|
// TODO: Hack for analytics, must br removed
|
|
96
87
|
resume: null,
|
|
97
88
|
|
|
@@ -103,6 +94,17 @@ export default class VideoPlayer extends React.Component<
|
|
|
103
94
|
duration: 0,
|
|
104
95
|
};
|
|
105
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
|
+
|
|
106
108
|
constructor(props) {
|
|
107
109
|
super(props);
|
|
108
110
|
this.onVideoLoadCalled = false; // android
|
|
@@ -111,16 +113,13 @@ export default class VideoPlayer extends React.Component<
|
|
|
111
113
|
? { width: "100%", flex: "1 1 auto", objectFit: "contain" }
|
|
112
114
|
: { flexBasis: "auto", flexGrow: 1, flexShrink: 1 };
|
|
113
115
|
|
|
114
|
-
const entry = this.props?.entry;
|
|
115
|
-
this.analyticsTracker = new AnalyticsTracker(entry);
|
|
116
116
|
this.playerPluginId = this.props?.playerPluginIdentifier;
|
|
117
117
|
}
|
|
118
118
|
|
|
119
119
|
componentWillUnmount() {
|
|
120
|
-
this.stopBackgroundPlayback();
|
|
121
|
-
|
|
122
120
|
this.playbackStarted = false;
|
|
123
|
-
|
|
121
|
+
|
|
122
|
+
this.analyticsTracker.handleAnalyticEvent(GENERAL_EVENT.session_end);
|
|
124
123
|
this.onPlayerClosed();
|
|
125
124
|
|
|
126
125
|
if (isAndroidPlatform()) {
|
|
@@ -163,6 +162,11 @@ export default class VideoPlayer extends React.Component<
|
|
|
163
162
|
}
|
|
164
163
|
}
|
|
165
164
|
|
|
165
|
+
// For close button
|
|
166
|
+
public closeNativePlayer = () => {
|
|
167
|
+
this.stopBackgroundPlayback();
|
|
168
|
+
};
|
|
169
|
+
|
|
166
170
|
getPlayNextData = () => this.props.playNextData as PlayNextData;
|
|
167
171
|
|
|
168
172
|
/**
|
|
@@ -176,27 +180,6 @@ export default class VideoPlayer extends React.Component<
|
|
|
176
180
|
return this.props.pluginConfiguration;
|
|
177
181
|
};
|
|
178
182
|
|
|
179
|
-
/**
|
|
180
|
-
* Handles analytic events, generates a new analytics tracker and transmits events
|
|
181
|
-
* Passes entry data, and playerState to the tracker for additional context
|
|
182
|
-
* The end result is an event formatted and passed to AnalyticsBridge.postEvent
|
|
183
|
-
* When we get the synthetic event we need to pull the data in the nativeEvent object
|
|
184
|
-
* nativeEvent contains the return value from native
|
|
185
|
-
*/
|
|
186
|
-
handleAnalyticEvent = (event, data = {}) => {
|
|
187
|
-
const entry = this.props?.entry;
|
|
188
|
-
const playerState = this.getState();
|
|
189
|
-
|
|
190
|
-
if (this.analyticsTracker?.handleAnalyticEvent) {
|
|
191
|
-
this.analyticsTracker?.handleAnalyticEvent?.(
|
|
192
|
-
event,
|
|
193
|
-
{ ...data, player_type: this.props.playerPluginIdentifier },
|
|
194
|
-
entry,
|
|
195
|
-
playerState
|
|
196
|
-
);
|
|
197
|
-
}
|
|
198
|
-
};
|
|
199
|
-
|
|
200
183
|
/**
|
|
201
184
|
* This method is for the events that have no implementation in react but are being invoked by native
|
|
202
185
|
* When we get the synthetic event we need to pull the data in the nativeEvent object
|
|
@@ -337,11 +320,7 @@ export default class VideoPlayer extends React.Component<
|
|
|
337
320
|
}
|
|
338
321
|
};
|
|
339
322
|
|
|
340
|
-
|
|
341
|
-
* Sets either subtitle language, or audio language if we have a selected a new locale.
|
|
342
|
-
* If no locale is set it defaults to system language for audio, and leaves subtitles unaltered.
|
|
343
|
-
*/
|
|
344
|
-
setLanguage = (selected = null) => {
|
|
323
|
+
selectTrack = (selected) => {
|
|
345
324
|
const { trackType, id, language } = selected || {};
|
|
346
325
|
|
|
347
326
|
const isOff = language === "Off";
|
|
@@ -372,6 +351,10 @@ export default class VideoPlayer extends React.Component<
|
|
|
372
351
|
}
|
|
373
352
|
};
|
|
374
353
|
|
|
354
|
+
setPlaybackRate = (rate = 1.0) => {
|
|
355
|
+
this.setState({ rate });
|
|
356
|
+
};
|
|
357
|
+
|
|
375
358
|
getCurrentTime = () => {
|
|
376
359
|
return this.state.currentTime;
|
|
377
360
|
};
|
|
@@ -396,28 +379,16 @@ export default class VideoPlayer extends React.Component<
|
|
|
396
379
|
};
|
|
397
380
|
|
|
398
381
|
onPlayerPresented = () => {
|
|
399
|
-
this.handleAnalyticEvent(GENERAL_EVENT.player_presented);
|
|
382
|
+
this.analyticsTracker?.handleAnalyticEvent(GENERAL_EVENT.player_presented);
|
|
400
383
|
};
|
|
401
384
|
|
|
402
385
|
onPlayerClosed = () => {
|
|
403
|
-
this.handleAnalyticEvent(GENERAL_EVENT.player_closed);
|
|
404
|
-
};
|
|
405
|
-
|
|
406
|
-
onPlayerSessionEnd = () => {
|
|
407
|
-
// TODO: Implement method on native android, ios exists
|
|
408
|
-
this.handleAnalyticEvent(GENERAL_EVENT.session_end);
|
|
409
|
-
};
|
|
410
|
-
|
|
411
|
-
onPlayerSessionStart = () => {
|
|
412
|
-
// TODO: Implement method on native android, ios exists
|
|
413
|
-
|
|
414
|
-
this.handleAnalyticEvent(GENERAL_EVENT.session_start);
|
|
386
|
+
this.analyticsTracker?.handleAnalyticEvent(GENERAL_EVENT.player_closed);
|
|
415
387
|
};
|
|
416
388
|
|
|
417
389
|
onVideoEnd = () => {
|
|
418
390
|
this.setState({ displayOverlay: !this.state.displayOverlay }, () => {
|
|
419
391
|
if (this.state?.displayOverlay) {
|
|
420
|
-
this.handleAnalyticEvent(PLAYBACK_EVENT.complete);
|
|
421
392
|
this.props?.listener?.onVideoEnd({});
|
|
422
393
|
}
|
|
423
394
|
});
|
|
@@ -427,15 +398,12 @@ export default class VideoPlayer extends React.Component<
|
|
|
427
398
|
onVideoError = ({ nativeEvent }) => {
|
|
428
399
|
const { message } = nativeEvent;
|
|
429
400
|
|
|
430
|
-
this.handleAnalyticEvent(PLAYBACK_EVENT.error, nativeEvent);
|
|
431
|
-
|
|
432
401
|
return this.props?.listener?.onError(new Error(message));
|
|
433
402
|
};
|
|
434
403
|
|
|
435
404
|
onPlayerPause = ({ nativeEvent = null }) => {
|
|
436
405
|
this.setState({ paused: true });
|
|
437
406
|
this.props?.listener?.onPlayerPause(nativeEvent);
|
|
438
|
-
this.handleAnalyticEvent(PLAYBACK_EVENT.pause, nativeEvent);
|
|
439
407
|
};
|
|
440
408
|
|
|
441
409
|
onPlayerResume = ({ nativeEvent = null }) => {
|
|
@@ -446,98 +414,61 @@ export default class VideoPlayer extends React.Component<
|
|
|
446
414
|
|
|
447
415
|
if (isNotAnAd && !resume) {
|
|
448
416
|
this.setState({ resume: true });
|
|
449
|
-
this.handleAnalyticEvent(PLAYBACK_EVENT.play, nativeEvent);
|
|
450
417
|
}
|
|
451
418
|
};
|
|
452
419
|
|
|
453
420
|
onPlayerSeekComplete = ({ nativeEvent }) => {
|
|
454
421
|
this.props?.listener?.onPlayerSeekComplete(nativeEvent);
|
|
455
|
-
this.handleAnalyticEvent(PLAYBACK_EVENT.seek_complete, nativeEvent);
|
|
456
422
|
};
|
|
457
423
|
|
|
458
424
|
onPlayerSeekStart = ({ nativeEvent }) => {
|
|
459
425
|
this.props?.listener?.onPlayerSeekStart(nativeEvent);
|
|
460
|
-
this.handleAnalyticEvent(PLAYBACK_EVENT.seek_start, nativeEvent);
|
|
461
426
|
};
|
|
462
427
|
|
|
463
428
|
onBufferStart = ({ nativeEvent }) => {
|
|
464
429
|
this.props?.listener?.onBufferStart(nativeEvent);
|
|
465
|
-
this.handleAnalyticEvent(PLAYBACK_EVENT.buffer_start, nativeEvent);
|
|
466
430
|
};
|
|
467
431
|
|
|
468
432
|
onBufferComplete = ({ nativeEvent }) => {
|
|
469
433
|
this.props?.listener?.onBufferComplete(nativeEvent);
|
|
470
|
-
this.handleAnalyticEvent(PLAYBACK_EVENT.buffer_complete, nativeEvent);
|
|
471
|
-
};
|
|
472
|
-
|
|
473
|
-
onPlayerNext = ({ nativeEvent }) => {
|
|
474
|
-
// TODO: Implement method on native
|
|
475
|
-
|
|
476
|
-
this.handleAnalyticEvent(PLAYBACK_EVENT.next, nativeEvent);
|
|
477
|
-
};
|
|
478
|
-
|
|
479
|
-
onPlayerPrevious = ({ nativeEvent }) => {
|
|
480
|
-
// TODO: Implement method on native
|
|
481
|
-
|
|
482
|
-
this.handleAnalyticEvent(PLAYBACK_EVENT.previous, nativeEvent);
|
|
483
|
-
};
|
|
484
|
-
|
|
485
|
-
onPlayerStop = ({ nativeEvent }) => {
|
|
486
|
-
// TODO: Implement method on native
|
|
487
|
-
|
|
488
|
-
this.handleAnalyticEvent(PLAYBACK_EVENT.stop, nativeEvent);
|
|
489
|
-
};
|
|
490
|
-
|
|
491
|
-
onVideoBandwidthUpdate = ({ nativeEvent }) => {
|
|
492
|
-
// TODO: Implement method on native
|
|
493
|
-
|
|
494
|
-
this.handleAnalyticEvent(QOS_EVENT.bitrate_changed, nativeEvent);
|
|
495
434
|
};
|
|
496
435
|
|
|
497
436
|
onAdBegin = ({ nativeEvent }) => {
|
|
498
437
|
this.setState({ isAd: true });
|
|
499
|
-
this.handleAnalyticEvent(AD_EVENT.ad_start, nativeEvent);
|
|
500
438
|
this.props.listener?.onAdBegin?.(nativeEvent);
|
|
501
439
|
};
|
|
502
440
|
|
|
503
441
|
onAdBreakBegin = ({ nativeEvent }) => {
|
|
504
442
|
this.setState({ isAd: true });
|
|
505
|
-
this.handleAnalyticEvent(AD_EVENT.ad_break_start, nativeEvent);
|
|
506
443
|
this.props.listener?.onAdBreakBegin?.(nativeEvent);
|
|
507
444
|
};
|
|
508
445
|
|
|
509
446
|
onAdBreakEnd = ({ nativeEvent }) => {
|
|
510
447
|
this.setState({ isAd: false });
|
|
511
|
-
this.handleAnalyticEvent(AD_EVENT.ad_break_completed, nativeEvent);
|
|
512
448
|
this.props.listener?.onAdBreakEnd?.(nativeEvent);
|
|
513
449
|
};
|
|
514
450
|
|
|
515
451
|
onAdEnd = ({ nativeEvent }) => {
|
|
516
452
|
this.setState({ isAd: false });
|
|
517
|
-
this.handleAnalyticEvent(AD_EVENT.ad_complete, nativeEvent);
|
|
518
453
|
this.props.listener?.onAdEnd?.(nativeEvent);
|
|
519
454
|
};
|
|
520
455
|
|
|
521
456
|
onAdError = ({ nativeEvent }) => {
|
|
522
457
|
this.setState({ isAd: false });
|
|
523
|
-
this.handleAnalyticEvent(AD_EVENT.ad_error, nativeEvent);
|
|
524
458
|
this.props.listener?.onAdError?.(nativeEvent);
|
|
525
459
|
};
|
|
526
460
|
|
|
527
461
|
onAdRequest = ({ nativeEvent }) => {
|
|
528
|
-
this.handleAnalyticEvent(AD_EVENT.ad_request, nativeEvent);
|
|
529
462
|
this.props.listener?.onAdRequest?.(nativeEvent);
|
|
530
463
|
};
|
|
531
464
|
|
|
532
465
|
onAdClicked = ({ nativeEvent }) => {
|
|
533
|
-
this.handleAnalyticEvent(AD_EVENT.ad_clicked, nativeEvent);
|
|
534
466
|
// Broadcast click event
|
|
535
467
|
this.props.playerEvent("ad-clicked", nativeEvent);
|
|
536
468
|
this.props.listener?.onAdClicked?.(nativeEvent);
|
|
537
469
|
};
|
|
538
470
|
|
|
539
471
|
onAdTapped = ({ nativeEvent }) => {
|
|
540
|
-
this.handleAnalyticEvent(AD_EVENT.ad_tapped, nativeEvent);
|
|
541
472
|
// Broadcast click event
|
|
542
473
|
this.props.playerEvent("ad-tapped", nativeEvent);
|
|
543
474
|
this.props.listener?.onAdTapped?.(nativeEvent);
|
|
@@ -555,6 +486,26 @@ export default class VideoPlayer extends React.Component<
|
|
|
555
486
|
this.props.listener?.onPlayerDetached?.(nativeEvent);
|
|
556
487
|
};
|
|
557
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
|
+
|
|
558
509
|
onPiPEnter = () => {
|
|
559
510
|
this.setState({ piped: true });
|
|
560
511
|
this.props.openPiP();
|
|
@@ -630,10 +581,6 @@ export default class VideoPlayer extends React.Component<
|
|
|
630
581
|
}
|
|
631
582
|
|
|
632
583
|
if (!this.state.isAd && !this.onVideoLoadCalled) {
|
|
633
|
-
this.handleAnalyticEvent(PLAYBACK_EVENT.load_video, {
|
|
634
|
-
player_type: this.props.playerPluginIdentifier,
|
|
635
|
-
});
|
|
636
|
-
|
|
637
584
|
// TODO: Hack, needs to remove
|
|
638
585
|
this.onVideoLoadCalled = true;
|
|
639
586
|
}
|
|
@@ -758,7 +705,6 @@ export default class VideoPlayer extends React.Component<
|
|
|
758
705
|
|
|
759
706
|
render() {
|
|
760
707
|
const {
|
|
761
|
-
castAction,
|
|
762
708
|
docked,
|
|
763
709
|
entry,
|
|
764
710
|
fullscreen,
|
|
@@ -768,9 +714,15 @@ export default class VideoPlayer extends React.Component<
|
|
|
768
714
|
isTabletPortrait,
|
|
769
715
|
muted,
|
|
770
716
|
style,
|
|
717
|
+
castAction,
|
|
718
|
+
controller,
|
|
719
|
+
startComponentsAnimation,
|
|
771
720
|
} = this.props;
|
|
772
721
|
|
|
773
|
-
const
|
|
722
|
+
const supportNativeCast = controller.supportNativeCast();
|
|
723
|
+
|
|
724
|
+
const { audioTrackId, keyEvent, paused, seek, textTrackId, rate } =
|
|
725
|
+
this.state;
|
|
774
726
|
|
|
775
727
|
const isAudioItem =
|
|
776
728
|
entry?.content?.type?.includes?.("audio") ||
|
|
@@ -822,26 +774,28 @@ export default class VideoPlayer extends React.Component<
|
|
|
822
774
|
|
|
823
775
|
let platformSpecificProps: any = isApplePlatform()
|
|
824
776
|
? {
|
|
825
|
-
|
|
826
|
-
|
|
777
|
+
resizeMode: nativeResizeMode,
|
|
778
|
+
}
|
|
779
|
+
: {};
|
|
827
780
|
|
|
828
|
-
const supportsNativeControls =
|
|
781
|
+
const supportsNativeControls =
|
|
782
|
+
!!this.props.controller?.supportsNativeControls?.();
|
|
829
783
|
|
|
830
784
|
const controls = isAppleTV()
|
|
831
|
-
? supportsNativeControls && isInlineTV
|
|
785
|
+
? (supportsNativeControls && !isInlineTV) || !!this.getPlayNextData()
|
|
832
786
|
: supportsNativeControls && !this.getPlayNextData();
|
|
833
787
|
|
|
788
|
+
const shouldUseNativeControls =
|
|
789
|
+
controls &&
|
|
790
|
+
!startComponentsAnimation &&
|
|
791
|
+
!docked &&
|
|
792
|
+
!castAction?.state?.connected;
|
|
793
|
+
|
|
834
794
|
platformSpecificProps = {
|
|
835
795
|
...platformSpecificProps,
|
|
836
|
-
controls
|
|
796
|
+
controls: shouldUseNativeControls,
|
|
837
797
|
};
|
|
838
798
|
|
|
839
|
-
console.log("Anton Player render2 ", {
|
|
840
|
-
platformSpecificProps,
|
|
841
|
-
isNotInlineTv: !isInlineTV,
|
|
842
|
-
hasNoPlayNextData: !this.getPlayNextData()
|
|
843
|
-
});
|
|
844
|
-
|
|
845
799
|
const pictureInPictureEnabled =
|
|
846
800
|
this.props.pluginConfiguration?.pictureInPictureEnabled;
|
|
847
801
|
|
|
@@ -857,6 +811,7 @@ export default class VideoPlayer extends React.Component<
|
|
|
857
811
|
nowPlayingEnabled,
|
|
858
812
|
paused,
|
|
859
813
|
seek,
|
|
814
|
+
rate,
|
|
860
815
|
textTrackId,
|
|
861
816
|
liveSeekingEnabled,
|
|
862
817
|
liveCatchUpEnabled,
|
|
@@ -893,8 +848,6 @@ export default class VideoPlayer extends React.Component<
|
|
|
893
848
|
onPlayerResume: this.onPlayerResume, // play
|
|
894
849
|
onPlayerSeekComplete: this.onPlayerSeekComplete, // seek_complete
|
|
895
850
|
onPlayerSeekStart: this.onPlayerSeekStart, // seek_start
|
|
896
|
-
onPlayerSessionEnd: this.onPlayerSessionEnd, // session_end
|
|
897
|
-
onPlayerSessionStart: this.onPlayerSessionStart, // session_start
|
|
898
851
|
};
|
|
899
852
|
|
|
900
853
|
const lifecycleEvents = {
|
|
@@ -902,22 +855,17 @@ export default class VideoPlayer extends React.Component<
|
|
|
902
855
|
onVideoEnd: this.onVideoEnd, // complete
|
|
903
856
|
onVideoError: this.onVideoError, // error
|
|
904
857
|
onVideoProgress: this.onVideoProgress,
|
|
905
|
-
onVideoFullscreenPlayerDidDismiss: this.
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
onVideoFullscreenPlayerWillDismiss: this.unHandledEvent(
|
|
912
|
-
"onVideoFullscreenPlayerWillDismiss"
|
|
913
|
-
),
|
|
914
|
-
onVideoFullscreenPlayerWillPresent: this.unHandledEvent(
|
|
915
|
-
"onVideoFullscreenPlayerWillPresent"
|
|
916
|
-
),
|
|
858
|
+
onVideoFullscreenPlayerDidDismiss: this.onVideoFullscreenPlayerDidDismiss,
|
|
859
|
+
onVideoFullscreenPlayerDidPresent: this.onVideoFullscreenPlayerDidPresent,
|
|
860
|
+
onVideoFullscreenPlayerWillDismiss:
|
|
861
|
+
this.onVideoFullscreenPlayerWillDismiss,
|
|
862
|
+
onVideoFullscreenPlayerWillPresent:
|
|
863
|
+
this.onVideoFullscreenPlayerWillPresent,
|
|
917
864
|
onVideoLoad: this.onVideoLoad,
|
|
918
865
|
onVideoLoadStart: this.unHandledEvent("onVideoLoadStart"),
|
|
919
866
|
onVideoBuffer: this.onVideoBuffer,
|
|
920
867
|
onPlaybackStalled: this.onPlaybackStalled,
|
|
868
|
+
onPlayerClose: this.onPlayerClose,
|
|
921
869
|
onPlayerAttached: this.onPlayerAttached,
|
|
922
870
|
onPlayerDetached: this.onPlayerDetached,
|
|
923
871
|
};
|
|
@@ -932,7 +880,6 @@ export default class VideoPlayer extends React.Component<
|
|
|
932
880
|
onTimedMetadata: this.unHandledEvent("onTimedMetadata"),
|
|
933
881
|
onTracksChanged: this.onTracksChanged,
|
|
934
882
|
eventSubtitlesChange: this.unHandledEvent("eventSubtitlesChange"),
|
|
935
|
-
onVideoBandwidthUpdate: this.onVideoBandwidthUpdate,
|
|
936
883
|
};
|
|
937
884
|
|
|
938
885
|
const playerSystemEvents = {
|
|
@@ -952,9 +899,6 @@ export default class VideoPlayer extends React.Component<
|
|
|
952
899
|
const unsupportedEvents = {
|
|
953
900
|
onBufferComplete: this.onBufferComplete, // buffer_complete
|
|
954
901
|
onBufferStart: this.onBufferStart, // buffer_start
|
|
955
|
-
onPlayerNext: this.onPlayerNext, // next
|
|
956
|
-
onPlayerPrevious: this.onPlayerPrevious, // previous
|
|
957
|
-
onPlayerStop: this.onPlayerStop, // stop
|
|
958
902
|
};
|
|
959
903
|
|
|
960
904
|
const nativeEvents = {
|
|
@@ -968,7 +912,13 @@ export default class VideoPlayer extends React.Component<
|
|
|
968
912
|
...androidLifecyclePiPEvents,
|
|
969
913
|
};
|
|
970
914
|
|
|
971
|
-
const needToShowPlayNextOverlay =
|
|
915
|
+
const needToShowPlayNextOverlay =
|
|
916
|
+
isTV() && this.getPlayNextData() && !docked;
|
|
917
|
+
|
|
918
|
+
const needToShowDefaultControls = !(
|
|
919
|
+
(controls && !castAction?.state?.connected) ||
|
|
920
|
+
this.getPlayNextData()
|
|
921
|
+
);
|
|
972
922
|
|
|
973
923
|
const playerContainerStyles = isApplePlatform()
|
|
974
924
|
? styles.playerContainerBlack
|
|
@@ -976,8 +926,6 @@ export default class VideoPlayer extends React.Component<
|
|
|
976
926
|
? styles.playerContainerTransparent
|
|
977
927
|
: styles.playerContainerBlack;
|
|
978
928
|
|
|
979
|
-
console.log("Anton Player render", {screenData, props: this.props, nativeProps});
|
|
980
|
-
|
|
981
929
|
const isInline = () => {
|
|
982
930
|
if (isTV()) {
|
|
983
931
|
return inline;
|
|
@@ -993,7 +941,7 @@ export default class VideoPlayer extends React.Component<
|
|
|
993
941
|
!needToShowPlayNextOverlay &&
|
|
994
942
|
this.props.mode !== "PIP";
|
|
995
943
|
|
|
996
|
-
if (
|
|
944
|
+
if (shouldUseNativeControls) {
|
|
997
945
|
return null;
|
|
998
946
|
}
|
|
999
947
|
|
|
@@ -1012,6 +960,7 @@ export default class VideoPlayer extends React.Component<
|
|
|
1012
960
|
extraInfoText={castAction?.state?.friendlyStatus}
|
|
1013
961
|
controlsAlwaysVisible={castAction?.state?.connected}
|
|
1014
962
|
playNextData={this.getPlayNextData()}
|
|
963
|
+
needToShowDefaultControls={needToShowDefaultControls}
|
|
1015
964
|
/>
|
|
1016
965
|
) : null;
|
|
1017
966
|
};
|
|
@@ -1046,29 +995,14 @@ export default class VideoPlayer extends React.Component<
|
|
|
1046
995
|
const renderMobilePlayer = () => {
|
|
1047
996
|
return isFullScreenAudioPlayer && isAudioItem ? (
|
|
1048
997
|
<View style={containerStyle}>
|
|
1049
|
-
{!castAction?.state?.connected && (
|
|
998
|
+
{(!castAction?.state?.connected || supportNativeCast) && (
|
|
1050
999
|
<this.props.PlayerComponent
|
|
1051
1000
|
ref={this._assignRoot}
|
|
1052
1001
|
{...nativeEvents}
|
|
1053
1002
|
{...nativeProps}
|
|
1054
1003
|
/>
|
|
1055
1004
|
)}
|
|
1056
|
-
<AudioPlayerWrapper {...sharedWrapperViewProps}
|
|
1057
|
-
<View>
|
|
1058
|
-
{
|
|
1059
|
-
<PlayNextOverlay
|
|
1060
|
-
item={entry}
|
|
1061
|
-
playerIsDocked={docked}
|
|
1062
|
-
pluginConfiguration={this.getPluginConfiguration()}
|
|
1063
|
-
playerId={this.props.playerId}
|
|
1064
|
-
playNextData={this.getPlayNextData()}
|
|
1065
|
-
setNextVideoPreloadThresholdPercentage={
|
|
1066
|
-
this.props.setNextVideoPreloadThresholdPercentage
|
|
1067
|
-
}
|
|
1068
|
-
/>
|
|
1069
|
-
}
|
|
1070
|
-
</View>
|
|
1071
|
-
</AudioPlayerWrapper>
|
|
1005
|
+
<AudioPlayerWrapper {...sharedWrapperViewProps} />
|
|
1072
1006
|
</View>
|
|
1073
1007
|
) : (
|
|
1074
1008
|
<PlayerWrapper {...sharedWrapperViewProps}>
|
|
@@ -1083,11 +1017,24 @@ export default class VideoPlayer extends React.Component<
|
|
|
1083
1017
|
<View style={styles.container}>
|
|
1084
1018
|
<View style={[playerContainerStyles, playerDimensions]}>
|
|
1085
1019
|
{isAudioItem && (
|
|
1086
|
-
<
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
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>
|
|
1091
1038
|
)}
|
|
1092
1039
|
|
|
1093
1040
|
{shouldRenderBackground && (
|
|
@@ -1099,18 +1046,28 @@ export default class VideoPlayer extends React.Component<
|
|
|
1099
1046
|
/>
|
|
1100
1047
|
)}
|
|
1101
1048
|
|
|
1102
|
-
{!castAction?.state?.connected && (
|
|
1103
|
-
<
|
|
1104
|
-
|
|
1105
|
-
{
|
|
1106
|
-
{...nativeProps}
|
|
1107
|
-
listener={this.props.listener}
|
|
1049
|
+
{(!castAction?.state?.connected || supportNativeCast) && (
|
|
1050
|
+
<AnimationComponent
|
|
1051
|
+
animationType={ComponentAnimationType.player}
|
|
1052
|
+
additionalData={playerDimensions}
|
|
1108
1053
|
style={getStyle(playerDimensions)}
|
|
1109
|
-
pluginConfiguration={this.getPluginConfiguration()}
|
|
1110
|
-
controller={this.props.controller}
|
|
1111
1054
|
>
|
|
1112
|
-
|
|
1113
|
-
|
|
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>
|
|
1114
1071
|
)}
|
|
1115
1072
|
</View>
|
|
1116
1073
|
|