2023-10-06 10:39:14 -06:00
|
|
|
import React, {
|
|
|
|
useState,
|
|
|
|
useCallback,
|
|
|
|
useMemo,
|
|
|
|
useRef,
|
|
|
|
forwardRef,
|
|
|
|
useImperativeHandle,
|
2023-10-07 04:56:35 -06:00
|
|
|
} from 'react';
|
2024-07-12 02:27:42 -06:00
|
|
|
import type {ElementRef} from 'react';
|
|
|
|
import {View, StyleSheet, Image, Platform, processColor} from 'react-native';
|
2024-07-22 14:38:35 -06:00
|
|
|
import type {
|
|
|
|
StyleProp,
|
|
|
|
ImageStyle,
|
|
|
|
NativeSyntheticEvent,
|
|
|
|
ViewStyle,
|
|
|
|
ImageResizeMode,
|
|
|
|
} from 'react-native';
|
2024-07-12 02:27:42 -06:00
|
|
|
|
2024-08-22 02:47:51 -06:00
|
|
|
import NativeVideoComponent, {
|
|
|
|
NativeCmcdConfiguration,
|
|
|
|
} from './specs/VideoNativeComponent';
|
2024-07-12 02:27:42 -06:00
|
|
|
import type {
|
|
|
|
OnAudioFocusChangedData,
|
|
|
|
OnAudioTracksData,
|
|
|
|
OnBandwidthUpdateData,
|
|
|
|
OnBufferData,
|
|
|
|
OnControlsVisibilityChange,
|
|
|
|
OnExternalPlaybackChangeData,
|
|
|
|
OnGetLicenseData,
|
|
|
|
OnLoadStartData,
|
|
|
|
OnPictureInPictureStatusChangedData,
|
|
|
|
OnPlaybackStateChangedData,
|
|
|
|
OnProgressData,
|
|
|
|
OnSeekData,
|
|
|
|
OnTextTrackDataChangedData,
|
|
|
|
OnTimedMetadataData,
|
|
|
|
OnVideoAspectRatioData,
|
|
|
|
OnVideoErrorData,
|
|
|
|
OnVideoTracksData,
|
|
|
|
VideoSrc,
|
2024-03-07 03:35:17 -07:00
|
|
|
} from './specs/VideoNativeComponent';
|
|
|
|
import {
|
|
|
|
generateHeaderForNative,
|
|
|
|
getReactTag,
|
|
|
|
resolveAssetSourceForVideo,
|
|
|
|
} from './utils';
|
2024-07-12 02:27:42 -06:00
|
|
|
import NativeVideoManager from './specs/NativeVideoManager';
|
|
|
|
import type {VideoSaveData} from './specs/NativeVideoManager';
|
2024-08-22 02:47:51 -06:00
|
|
|
import {CmcdMode, ViewType} from './types';
|
2024-07-12 02:27:42 -06:00
|
|
|
import type {
|
|
|
|
OnLoadData,
|
|
|
|
OnTextTracksData,
|
|
|
|
OnReceiveAdEventData,
|
|
|
|
ReactVideoProps,
|
2024-08-22 02:47:51 -06:00
|
|
|
CmcdData,
|
2024-04-03 12:49:47 -06:00
|
|
|
} from './types';
|
2023-10-07 04:56:35 -06:00
|
|
|
|
2023-10-06 10:39:14 -06:00
|
|
|
export interface VideoRef {
|
|
|
|
seek: (time: number, tolerance?: number) => void;
|
|
|
|
resume: () => void;
|
|
|
|
pause: () => void;
|
|
|
|
presentFullscreenPlayer: () => void;
|
|
|
|
dismissFullscreenPlayer: () => void;
|
2023-10-07 04:56:35 -06:00
|
|
|
restoreUserInterfaceForPictureInPictureStopCompleted: (
|
|
|
|
restore: boolean,
|
|
|
|
) => void;
|
2024-05-20 04:21:48 -06:00
|
|
|
setVolume: (volume: number) => void;
|
2024-06-10 14:41:26 -06:00
|
|
|
setFullScreen: (fullScreen: boolean) => void;
|
2024-07-12 02:27:42 -06:00
|
|
|
save: (options: object) => Promise<VideoSaveData> | void;
|
|
|
|
getCurrentPosition: () => Promise<number>;
|
2023-10-06 10:39:14 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
const Video = forwardRef<VideoRef, ReactVideoProps>(
|
|
|
|
(
|
|
|
|
{
|
|
|
|
source,
|
|
|
|
style,
|
|
|
|
resizeMode,
|
|
|
|
poster,
|
2024-07-22 14:38:35 -06:00
|
|
|
posterResizeMode,
|
|
|
|
renderLoader,
|
2024-09-14 11:53:54 -06:00
|
|
|
contentStartTime,
|
2023-10-06 10:39:14 -06:00
|
|
|
drm,
|
|
|
|
textTracks,
|
2023-10-11 14:15:58 -06:00
|
|
|
selectedVideoTrack,
|
2023-10-06 10:39:14 -06:00
|
|
|
selectedAudioTrack,
|
|
|
|
selectedTextTrack,
|
2024-06-27 03:58:06 -06:00
|
|
|
useTextureView,
|
|
|
|
useSecureView,
|
|
|
|
viewType,
|
2024-07-12 02:27:42 -06:00
|
|
|
shutterColor,
|
2023-10-06 10:39:14 -06:00
|
|
|
onLoadStart,
|
|
|
|
onLoad,
|
|
|
|
onError,
|
|
|
|
onProgress,
|
|
|
|
onSeek,
|
|
|
|
onEnd,
|
|
|
|
onBuffer,
|
|
|
|
onBandwidthUpdate,
|
2024-06-22 03:15:21 -06:00
|
|
|
onControlsVisibilityChange,
|
2023-10-06 10:39:14 -06:00
|
|
|
onExternalPlaybackChange,
|
|
|
|
onFullscreenPlayerWillPresent,
|
|
|
|
onFullscreenPlayerDidPresent,
|
|
|
|
onFullscreenPlayerWillDismiss,
|
|
|
|
onFullscreenPlayerDidDismiss,
|
|
|
|
onReadyForDisplay,
|
|
|
|
onPlaybackRateChange,
|
2023-11-04 11:11:54 -06:00
|
|
|
onVolumeChange,
|
2023-10-06 10:39:14 -06:00
|
|
|
onAudioBecomingNoisy,
|
|
|
|
onPictureInPictureStatusChanged,
|
|
|
|
onRestoreUserInterfaceForPictureInPictureStop,
|
|
|
|
onReceiveAdEvent,
|
|
|
|
onPlaybackStateChanged,
|
|
|
|
onAudioFocusChanged,
|
|
|
|
onIdle,
|
|
|
|
onTimedMetadata,
|
|
|
|
onAudioTracks,
|
|
|
|
onTextTracks,
|
2024-02-29 06:41:04 -07:00
|
|
|
onTextTrackDataChanged,
|
2023-10-06 10:39:14 -06:00
|
|
|
onVideoTracks,
|
2023-10-26 00:46:04 -06:00
|
|
|
onAspectRatio,
|
2024-09-20 09:46:10 -06:00
|
|
|
localSourceEncryptionKeyScheme,
|
2023-10-06 10:39:14 -06:00
|
|
|
...rest
|
|
|
|
},
|
2023-10-07 04:56:35 -06:00
|
|
|
ref,
|
2023-10-06 10:39:14 -06:00
|
|
|
) => {
|
2024-07-12 02:27:42 -06:00
|
|
|
const nativeRef = useRef<ElementRef<typeof NativeVideoComponent>>(null);
|
2024-07-22 14:38:35 -06:00
|
|
|
|
|
|
|
const isPosterDeprecated = typeof poster === 'string';
|
|
|
|
|
2024-09-17 07:58:47 -06:00
|
|
|
const _renderLoader = useMemo(
|
|
|
|
() =>
|
|
|
|
!renderLoader
|
|
|
|
? undefined
|
|
|
|
: renderLoader instanceof Function
|
|
|
|
? renderLoader
|
|
|
|
: () => renderLoader,
|
|
|
|
[renderLoader],
|
|
|
|
);
|
|
|
|
|
2024-07-22 14:38:35 -06:00
|
|
|
const hasPoster = useMemo(() => {
|
2024-09-17 07:58:47 -06:00
|
|
|
if (_renderLoader) {
|
2024-07-22 14:38:35 -06:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (isPosterDeprecated) {
|
|
|
|
return !!poster;
|
|
|
|
}
|
|
|
|
|
|
|
|
return !!poster?.source;
|
2024-09-17 07:58:47 -06:00
|
|
|
}, [isPosterDeprecated, poster, _renderLoader]);
|
2024-07-22 14:38:35 -06:00
|
|
|
|
|
|
|
const [showPoster, setShowPoster] = useState(hasPoster);
|
|
|
|
|
2023-10-06 10:39:14 -06:00
|
|
|
const [
|
|
|
|
_restoreUserInterfaceForPIPStopCompletionHandler,
|
|
|
|
setRestoreUserInterfaceForPIPStopCompletionHandler,
|
|
|
|
] = useState<boolean | undefined>();
|
|
|
|
|
2024-03-07 03:35:17 -07:00
|
|
|
const src = useMemo<VideoSrc | undefined>(() => {
|
2023-10-07 04:56:35 -06:00
|
|
|
if (!source) {
|
|
|
|
return undefined;
|
|
|
|
}
|
2023-10-06 10:39:14 -06:00
|
|
|
const resolvedSource = resolveAssetSourceForVideo(source);
|
2023-10-07 04:56:35 -06:00
|
|
|
let uri = resolvedSource.uri || '';
|
|
|
|
if (uri && uri.match(/^\//)) {
|
|
|
|
uri = `file://${uri}`;
|
|
|
|
}
|
|
|
|
if (!uri) {
|
2023-10-26 00:46:04 -06:00
|
|
|
console.log('Trying to load empty source');
|
2023-10-07 04:56:35 -06:00
|
|
|
}
|
2024-04-16 02:41:39 -06:00
|
|
|
const isNetwork = !!(uri && uri.match(/^(rtp|rtsp|http|https):/));
|
2023-10-06 10:39:14 -06:00
|
|
|
const isAsset = !!(
|
|
|
|
uri &&
|
|
|
|
uri.match(
|
2023-10-07 04:56:35 -06:00
|
|
|
/^(assets-library|ipod-library|file|content|ms-appx|ms-appdata):/,
|
2023-10-06 10:39:14 -06:00
|
|
|
)
|
|
|
|
);
|
|
|
|
|
2024-07-10 04:17:22 -06:00
|
|
|
const selectedDrm = source.drm || drm;
|
2024-09-13 02:50:33 -06:00
|
|
|
const _textTracks = source.textTracks || textTracks;
|
2024-07-10 04:17:22 -06:00
|
|
|
const _drm = !selectedDrm
|
|
|
|
? undefined
|
|
|
|
: {
|
|
|
|
type: selectedDrm.type,
|
|
|
|
licenseServer: selectedDrm.licenseServer,
|
|
|
|
headers: generateHeaderForNative(selectedDrm.headers),
|
|
|
|
contentId: selectedDrm.contentId,
|
|
|
|
certificateUrl: selectedDrm.certificateUrl,
|
|
|
|
base64Certificate: selectedDrm.base64Certificate,
|
|
|
|
useExternalGetLicense: !!selectedDrm.getLicense,
|
|
|
|
multiDrm: selectedDrm.multiDrm,
|
2024-09-20 09:46:10 -06:00
|
|
|
localSourceEncryptionKeyScheme:
|
|
|
|
selectedDrm.localSourceEncryptionKeyScheme ||
|
|
|
|
localSourceEncryptionKeyScheme,
|
2024-07-10 04:17:22 -06:00
|
|
|
};
|
|
|
|
|
2024-08-22 02:47:51 -06:00
|
|
|
let _cmcd: NativeCmcdConfiguration | undefined;
|
|
|
|
if (Platform.OS === 'android' && source?.cmcd) {
|
|
|
|
const cmcd = source.cmcd;
|
|
|
|
|
|
|
|
if (typeof cmcd === 'boolean') {
|
|
|
|
_cmcd = cmcd ? {mode: CmcdMode.MODE_QUERY_PARAMETER} : undefined;
|
|
|
|
} else if (typeof cmcd === 'object' && !Array.isArray(cmcd)) {
|
|
|
|
const createCmcdHeader = (property?: CmcdData) =>
|
|
|
|
property ? generateHeaderForNative(property) : undefined;
|
|
|
|
|
|
|
|
_cmcd = {
|
|
|
|
mode: cmcd.mode ?? CmcdMode.MODE_QUERY_PARAMETER,
|
|
|
|
request: createCmcdHeader(cmcd.request),
|
|
|
|
session: createCmcdHeader(cmcd.session),
|
|
|
|
object: createCmcdHeader(cmcd.object),
|
|
|
|
status: createCmcdHeader(cmcd.status),
|
|
|
|
};
|
|
|
|
} else {
|
|
|
|
throw new Error(
|
|
|
|
'Invalid CMCD configuration: Expected a boolean or an object.',
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-09-14 11:53:54 -06:00
|
|
|
const selectedContentStartTime =
|
|
|
|
source.contentStartTime || contentStartTime;
|
|
|
|
|
2023-10-06 10:39:14 -06:00
|
|
|
return {
|
|
|
|
uri,
|
|
|
|
isNetwork,
|
|
|
|
isAsset,
|
|
|
|
shouldCache: resolvedSource.shouldCache || false,
|
2023-10-07 04:56:35 -06:00
|
|
|
type: resolvedSource.type || '',
|
2023-10-06 10:39:14 -06:00
|
|
|
mainVer: resolvedSource.mainVer || 0,
|
|
|
|
patchVer: resolvedSource.patchVer || 0,
|
2024-03-07 03:35:17 -07:00
|
|
|
requestHeaders: generateHeaderForNative(resolvedSource.headers),
|
2023-11-24 04:52:46 -07:00
|
|
|
startPosition: resolvedSource.startPosition ?? -1,
|
|
|
|
cropStart: resolvedSource.cropStart || 0,
|
|
|
|
cropEnd: resolvedSource.cropEnd,
|
2024-09-14 11:53:54 -06:00
|
|
|
contentStartTime: selectedContentStartTime,
|
2024-05-07 04:30:57 -06:00
|
|
|
metadata: resolvedSource.metadata,
|
2024-07-10 04:17:22 -06:00
|
|
|
drm: _drm,
|
2024-08-22 02:47:51 -06:00
|
|
|
cmcd: _cmcd,
|
2024-09-13 02:50:33 -06:00
|
|
|
textTracks: _textTracks,
|
2024-06-20 03:19:35 -06:00
|
|
|
textTracksAllowChunklessPreparation:
|
|
|
|
resolvedSource.textTracksAllowChunklessPreparation,
|
2023-10-06 10:39:14 -06:00
|
|
|
};
|
2024-09-20 09:46:10 -06:00
|
|
|
}, [
|
|
|
|
drm,
|
|
|
|
source,
|
|
|
|
textTracks,
|
|
|
|
contentStartTime,
|
|
|
|
localSourceEncryptionKeyScheme,
|
|
|
|
]);
|
2023-10-06 10:39:14 -06:00
|
|
|
|
|
|
|
const _selectedTextTrack = useMemo(() => {
|
2023-10-07 04:56:35 -06:00
|
|
|
if (!selectedTextTrack) {
|
|
|
|
return;
|
|
|
|
}
|
2024-06-19 03:49:42 -06:00
|
|
|
const typeOfValueProp = typeof selectedTextTrack.value;
|
|
|
|
if (
|
|
|
|
typeOfValueProp !== 'number' &&
|
|
|
|
typeOfValueProp !== 'string' &&
|
|
|
|
typeOfValueProp !== 'undefined'
|
|
|
|
) {
|
|
|
|
console.warn(
|
|
|
|
'invalid type provided to selectedTextTrack.value: ',
|
|
|
|
typeOfValueProp,
|
|
|
|
);
|
2024-04-30 07:12:37 -06:00
|
|
|
return;
|
|
|
|
}
|
2023-10-06 10:39:14 -06:00
|
|
|
return {
|
2023-10-11 14:15:58 -06:00
|
|
|
type: selectedTextTrack?.type,
|
2024-04-30 07:12:37 -06:00
|
|
|
value: `${selectedTextTrack.value}`,
|
2023-10-07 04:56:35 -06:00
|
|
|
};
|
2023-10-06 10:39:14 -06:00
|
|
|
}, [selectedTextTrack]);
|
|
|
|
|
|
|
|
const _selectedAudioTrack = useMemo(() => {
|
2023-10-07 04:56:35 -06:00
|
|
|
if (!selectedAudioTrack) {
|
|
|
|
return;
|
|
|
|
}
|
2024-06-19 03:49:42 -06:00
|
|
|
const typeOfValueProp = typeof selectedAudioTrack.value;
|
|
|
|
if (
|
|
|
|
typeOfValueProp !== 'number' &&
|
|
|
|
typeOfValueProp !== 'string' &&
|
|
|
|
typeOfValueProp !== 'undefined'
|
|
|
|
) {
|
|
|
|
console.warn(
|
|
|
|
'invalid type provided to selectedAudioTrack.value: ',
|
|
|
|
typeOfValueProp,
|
|
|
|
);
|
2024-04-30 07:12:37 -06:00
|
|
|
return;
|
|
|
|
}
|
2023-10-11 14:15:58 -06:00
|
|
|
|
2023-10-06 10:39:14 -06:00
|
|
|
return {
|
2023-10-11 14:15:58 -06:00
|
|
|
type: selectedAudioTrack?.type,
|
2024-04-30 07:12:37 -06:00
|
|
|
value: `${selectedAudioTrack.value}`,
|
2023-10-07 04:56:35 -06:00
|
|
|
};
|
2023-10-06 10:39:14 -06:00
|
|
|
}, [selectedAudioTrack]);
|
|
|
|
|
2023-10-11 14:15:58 -06:00
|
|
|
const _selectedVideoTrack = useMemo(() => {
|
|
|
|
if (!selectedVideoTrack) {
|
|
|
|
return;
|
|
|
|
}
|
2024-06-19 03:49:42 -06:00
|
|
|
const typeOfValueProp = typeof selectedVideoTrack.value;
|
|
|
|
if (
|
|
|
|
typeOfValueProp !== 'number' &&
|
|
|
|
typeOfValueProp !== 'string' &&
|
|
|
|
typeOfValueProp !== 'undefined'
|
|
|
|
) {
|
|
|
|
console.warn(
|
|
|
|
'invalid type provided to selectedVideoTrack.value: ',
|
|
|
|
typeOfValueProp,
|
|
|
|
);
|
2024-05-22 06:01:55 -06:00
|
|
|
return;
|
|
|
|
}
|
2023-10-11 14:15:58 -06:00
|
|
|
return {
|
|
|
|
type: selectedVideoTrack?.type,
|
2024-05-22 06:01:55 -06:00
|
|
|
value: `${selectedVideoTrack.value}`,
|
2023-10-11 14:15:58 -06:00
|
|
|
};
|
|
|
|
}, [selectedVideoTrack]);
|
|
|
|
|
2023-10-07 04:56:35 -06:00
|
|
|
const seek = useCallback(async (time: number, tolerance?: number) => {
|
2024-05-21 14:15:47 -06:00
|
|
|
if (isNaN(time) || time === null) {
|
|
|
|
throw new Error("Specified time is not a number: '" + time + "'");
|
2023-10-07 04:56:35 -06:00
|
|
|
}
|
2023-10-06 10:39:14 -06:00
|
|
|
|
2023-10-07 04:56:35 -06:00
|
|
|
if (!nativeRef.current) {
|
|
|
|
console.warn('Video Component is not mounted');
|
|
|
|
return;
|
|
|
|
}
|
2023-10-06 10:39:14 -06:00
|
|
|
|
2024-03-28 04:22:04 -06:00
|
|
|
const callSeekFunction = () => {
|
2024-07-12 02:27:42 -06:00
|
|
|
NativeVideoManager.seekCmd(
|
2024-03-28 04:22:04 -06:00
|
|
|
getReactTag(nativeRef),
|
2024-07-12 02:27:42 -06:00
|
|
|
time,
|
|
|
|
tolerance || 0,
|
2024-03-28 04:22:04 -06:00
|
|
|
);
|
|
|
|
};
|
|
|
|
|
2023-10-07 04:56:35 -06:00
|
|
|
Platform.select({
|
2024-03-28 04:22:04 -06:00
|
|
|
ios: callSeekFunction,
|
|
|
|
android: callSeekFunction,
|
2023-10-07 04:56:35 -06:00
|
|
|
default: () => {
|
2024-07-12 02:27:42 -06:00
|
|
|
// TODO: Implement VideoManager.seekCmd for windows
|
2024-03-28 04:22:04 -06:00
|
|
|
nativeRef.current?.setNativeProps({seek: time});
|
2023-10-07 04:56:35 -06:00
|
|
|
},
|
|
|
|
})();
|
|
|
|
}, []);
|
2023-10-06 10:39:14 -06:00
|
|
|
|
2024-07-12 02:27:42 -06:00
|
|
|
const pause = useCallback(() => {
|
|
|
|
return NativeVideoManager.setPlayerPauseStateCmd(
|
|
|
|
getReactTag(nativeRef),
|
|
|
|
true,
|
|
|
|
);
|
|
|
|
}, []);
|
2023-10-06 10:39:14 -06:00
|
|
|
|
2024-07-12 02:27:42 -06:00
|
|
|
const resume = useCallback(() => {
|
|
|
|
return NativeVideoManager.setPlayerPauseStateCmd(
|
|
|
|
getReactTag(nativeRef),
|
|
|
|
false,
|
|
|
|
);
|
2023-10-06 10:39:14 -06:00
|
|
|
}, []);
|
|
|
|
|
2024-07-12 02:27:42 -06:00
|
|
|
const setVolume = useCallback((volume: number) => {
|
|
|
|
return NativeVideoManager.setVolumeCmd(getReactTag(nativeRef), volume);
|
2023-10-06 10:39:14 -06:00
|
|
|
}, []);
|
|
|
|
|
2024-07-12 02:27:42 -06:00
|
|
|
const setFullScreen = useCallback((fullScreen: boolean) => {
|
|
|
|
return NativeVideoManager.setFullScreenCmd(
|
|
|
|
getReactTag(nativeRef),
|
|
|
|
fullScreen,
|
|
|
|
);
|
2023-10-06 10:39:14 -06:00
|
|
|
}, []);
|
|
|
|
|
2024-07-12 02:27:42 -06:00
|
|
|
const presentFullscreenPlayer = useCallback(
|
|
|
|
() => setFullScreen(true),
|
|
|
|
[setFullScreen],
|
2023-10-06 10:39:14 -06:00
|
|
|
);
|
|
|
|
|
2024-07-12 02:27:42 -06:00
|
|
|
const dismissFullscreenPlayer = useCallback(
|
|
|
|
() => setFullScreen(false),
|
|
|
|
[setFullScreen],
|
|
|
|
);
|
|
|
|
|
|
|
|
const save = useCallback((options: object) => {
|
|
|
|
// VideoManager.save can be null on android & windows
|
|
|
|
if (Platform.OS !== 'ios') {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
// @todo Must implement it in a different way.
|
|
|
|
return NativeVideoManager.save?.(getReactTag(nativeRef), options);
|
2024-05-20 04:21:48 -06:00
|
|
|
}, []);
|
|
|
|
|
2024-05-28 03:00:38 -06:00
|
|
|
const getCurrentPosition = useCallback(() => {
|
2024-07-12 02:27:42 -06:00
|
|
|
// @todo Must implement it in a different way.
|
|
|
|
return NativeVideoManager.getCurrentPosition(getReactTag(nativeRef));
|
2024-05-28 03:00:38 -06:00
|
|
|
}, []);
|
|
|
|
|
2024-07-12 02:27:42 -06:00
|
|
|
const restoreUserInterfaceForPictureInPictureStopCompleted = useCallback(
|
|
|
|
(restored: boolean) => {
|
|
|
|
setRestoreUserInterfaceForPIPStopCompletionHandler(restored);
|
|
|
|
},
|
|
|
|
[setRestoreUserInterfaceForPIPStopCompletionHandler],
|
|
|
|
);
|
2024-06-10 14:41:26 -06:00
|
|
|
|
2023-10-06 10:39:14 -06:00
|
|
|
const onVideoLoadStart = useCallback(
|
|
|
|
(e: NativeSyntheticEvent<OnLoadStartData>) => {
|
2024-04-05 02:35:57 -06:00
|
|
|
hasPoster && setShowPoster(true);
|
2023-10-06 10:39:14 -06:00
|
|
|
onLoadStart?.(e.nativeEvent);
|
|
|
|
},
|
2024-04-05 02:35:57 -06:00
|
|
|
[hasPoster, onLoadStart],
|
2023-10-06 10:39:14 -06:00
|
|
|
);
|
|
|
|
|
|
|
|
const onVideoLoad = useCallback(
|
|
|
|
(e: NativeSyntheticEvent<OnLoadData>) => {
|
2023-10-07 04:56:35 -06:00
|
|
|
if (Platform.OS === 'windows') {
|
2024-04-05 02:35:57 -06:00
|
|
|
hasPoster && setShowPoster(false);
|
2023-10-07 04:56:35 -06:00
|
|
|
}
|
2023-10-06 10:39:14 -06:00
|
|
|
onLoad?.(e.nativeEvent);
|
|
|
|
},
|
2024-04-05 02:35:57 -06:00
|
|
|
[onLoad, hasPoster, setShowPoster],
|
2023-10-06 10:39:14 -06:00
|
|
|
);
|
|
|
|
|
|
|
|
const onVideoError = useCallback(
|
|
|
|
(e: NativeSyntheticEvent<OnVideoErrorData>) => {
|
|
|
|
onError?.(e.nativeEvent);
|
|
|
|
},
|
2023-10-07 04:56:35 -06:00
|
|
|
[onError],
|
2023-10-06 10:39:14 -06:00
|
|
|
);
|
|
|
|
|
|
|
|
const onVideoProgress = useCallback(
|
|
|
|
(e: NativeSyntheticEvent<OnProgressData>) => {
|
|
|
|
onProgress?.(e.nativeEvent);
|
|
|
|
},
|
2023-10-07 04:56:35 -06:00
|
|
|
[onProgress],
|
2023-10-06 10:39:14 -06:00
|
|
|
);
|
|
|
|
|
|
|
|
const onVideoSeek = useCallback(
|
|
|
|
(e: NativeSyntheticEvent<OnSeekData>) => {
|
|
|
|
onSeek?.(e.nativeEvent);
|
|
|
|
},
|
2023-10-07 04:56:35 -06:00
|
|
|
[onSeek],
|
2023-10-06 10:39:14 -06:00
|
|
|
);
|
|
|
|
|
2023-10-07 04:56:35 -06:00
|
|
|
const onVideoPlaybackStateChanged = useCallback(
|
|
|
|
(e: NativeSyntheticEvent<OnPlaybackStateChangedData>) => {
|
|
|
|
onPlaybackStateChanged?.(e.nativeEvent);
|
|
|
|
},
|
|
|
|
[onPlaybackStateChanged],
|
|
|
|
);
|
2023-10-06 10:39:14 -06:00
|
|
|
|
2024-07-12 02:27:42 -06:00
|
|
|
const _shutterColor = useMemo(() => {
|
|
|
|
const color = processColor(shutterColor);
|
|
|
|
return typeof color === 'number' ? color : undefined;
|
|
|
|
}, [shutterColor]);
|
|
|
|
|
2023-10-06 10:39:14 -06:00
|
|
|
// android only
|
|
|
|
const _onTimedMetadata = useCallback(
|
|
|
|
(e: NativeSyntheticEvent<OnTimedMetadataData>) => {
|
|
|
|
onTimedMetadata?.(e.nativeEvent);
|
|
|
|
},
|
2023-10-07 04:56:35 -06:00
|
|
|
[onTimedMetadata],
|
2023-10-06 10:39:14 -06:00
|
|
|
);
|
|
|
|
|
2023-10-07 04:56:35 -06:00
|
|
|
const _onAudioTracks = useCallback(
|
|
|
|
(e: NativeSyntheticEvent<OnAudioTracksData>) => {
|
|
|
|
onAudioTracks?.(e.nativeEvent);
|
|
|
|
},
|
|
|
|
[onAudioTracks],
|
|
|
|
);
|
2023-10-06 10:39:14 -06:00
|
|
|
|
2023-10-07 04:56:35 -06:00
|
|
|
const _onTextTracks = useCallback(
|
|
|
|
(e: NativeSyntheticEvent<OnTextTracksData>) => {
|
|
|
|
onTextTracks?.(e.nativeEvent);
|
|
|
|
},
|
|
|
|
[onTextTracks],
|
|
|
|
);
|
2023-10-06 10:39:14 -06:00
|
|
|
|
2024-02-29 06:41:04 -07:00
|
|
|
const _onTextTrackDataChanged = useCallback(
|
|
|
|
(
|
|
|
|
e: NativeSyntheticEvent<OnTextTrackDataChangedData & {target?: number}>,
|
|
|
|
) => {
|
|
|
|
const {...eventData} = e.nativeEvent;
|
|
|
|
delete eventData.target;
|
|
|
|
onTextTrackDataChanged?.(eventData as OnTextTrackDataChangedData);
|
|
|
|
},
|
|
|
|
[onTextTrackDataChanged],
|
|
|
|
);
|
|
|
|
|
2023-10-07 04:56:35 -06:00
|
|
|
const _onVideoTracks = useCallback(
|
|
|
|
(e: NativeSyntheticEvent<OnVideoTracksData>) => {
|
|
|
|
onVideoTracks?.(e.nativeEvent);
|
|
|
|
},
|
|
|
|
[onVideoTracks],
|
|
|
|
);
|
2023-10-06 10:39:14 -06:00
|
|
|
|
|
|
|
const _onPlaybackRateChange = useCallback(
|
2023-10-07 04:56:35 -06:00
|
|
|
(e: NativeSyntheticEvent<Readonly<{playbackRate: number}>>) => {
|
2023-10-06 10:39:14 -06:00
|
|
|
onPlaybackRateChange?.(e.nativeEvent);
|
|
|
|
},
|
2023-10-07 04:56:35 -06:00
|
|
|
[onPlaybackRateChange],
|
2023-10-06 10:39:14 -06:00
|
|
|
);
|
|
|
|
|
2023-11-04 11:11:54 -06:00
|
|
|
const _onVolumeChange = useCallback(
|
|
|
|
(e: NativeSyntheticEvent<Readonly<{volume: number}>>) => {
|
|
|
|
onVolumeChange?.(e.nativeEvent);
|
|
|
|
},
|
|
|
|
[onVolumeChange],
|
|
|
|
);
|
|
|
|
|
2023-10-06 10:39:14 -06:00
|
|
|
const _onReadyForDisplay = useCallback(() => {
|
2024-04-05 02:35:57 -06:00
|
|
|
hasPoster && setShowPoster(false);
|
2023-10-06 10:39:14 -06:00
|
|
|
onReadyForDisplay?.();
|
2024-04-05 02:35:57 -06:00
|
|
|
}, [setShowPoster, hasPoster, onReadyForDisplay]);
|
2023-10-06 10:39:14 -06:00
|
|
|
|
|
|
|
const _onPictureInPictureStatusChanged = useCallback(
|
|
|
|
(e: NativeSyntheticEvent<OnPictureInPictureStatusChangedData>) => {
|
|
|
|
onPictureInPictureStatusChanged?.(e.nativeEvent);
|
|
|
|
},
|
2023-10-07 04:56:35 -06:00
|
|
|
[onPictureInPictureStatusChanged],
|
2023-10-06 10:39:14 -06:00
|
|
|
);
|
|
|
|
|
2023-10-07 04:56:35 -06:00
|
|
|
const _onAudioFocusChanged = useCallback(
|
|
|
|
(e: NativeSyntheticEvent<OnAudioFocusChangedData>) => {
|
|
|
|
onAudioFocusChanged?.(e.nativeEvent);
|
|
|
|
},
|
|
|
|
[onAudioFocusChanged],
|
|
|
|
);
|
2023-10-06 10:39:14 -06:00
|
|
|
|
2023-10-07 04:56:35 -06:00
|
|
|
const onVideoBuffer = useCallback(
|
|
|
|
(e: NativeSyntheticEvent<OnBufferData>) => {
|
|
|
|
onBuffer?.(e.nativeEvent);
|
|
|
|
},
|
|
|
|
[onBuffer],
|
|
|
|
);
|
2023-10-06 10:39:14 -06:00
|
|
|
|
2023-10-07 04:56:35 -06:00
|
|
|
const onVideoExternalPlaybackChange = useCallback(
|
|
|
|
(e: NativeSyntheticEvent<OnExternalPlaybackChangeData>) => {
|
|
|
|
onExternalPlaybackChange?.(e.nativeEvent);
|
|
|
|
},
|
|
|
|
[onExternalPlaybackChange],
|
|
|
|
);
|
2023-10-06 10:39:14 -06:00
|
|
|
|
2023-10-07 04:56:35 -06:00
|
|
|
const _onBandwidthUpdate = useCallback(
|
|
|
|
(e: NativeSyntheticEvent<OnBandwidthUpdateData>) => {
|
|
|
|
onBandwidthUpdate?.(e.nativeEvent);
|
|
|
|
},
|
|
|
|
[onBandwidthUpdate],
|
|
|
|
);
|
2023-10-06 10:39:14 -06:00
|
|
|
|
2023-10-07 04:56:35 -06:00
|
|
|
const _onReceiveAdEvent = useCallback(
|
|
|
|
(e: NativeSyntheticEvent<OnReceiveAdEventData>) => {
|
|
|
|
onReceiveAdEvent?.(e.nativeEvent);
|
|
|
|
},
|
|
|
|
[onReceiveAdEvent],
|
|
|
|
);
|
2023-10-06 10:39:14 -06:00
|
|
|
|
2023-10-26 00:46:04 -06:00
|
|
|
const _onVideoAspectRatio = useCallback(
|
|
|
|
(e: NativeSyntheticEvent<OnVideoAspectRatioData>) => {
|
|
|
|
onAspectRatio?.(e.nativeEvent);
|
|
|
|
},
|
|
|
|
[onAspectRatio],
|
|
|
|
);
|
|
|
|
|
2024-06-22 03:15:21 -06:00
|
|
|
const _onControlsVisibilityChange = useCallback(
|
|
|
|
(e: NativeSyntheticEvent<OnControlsVisibilityChange>) => {
|
|
|
|
onControlsVisibilityChange?.(e.nativeEvent);
|
|
|
|
},
|
|
|
|
[onControlsVisibilityChange],
|
|
|
|
);
|
|
|
|
|
2024-08-02 02:42:20 -06:00
|
|
|
const selectedDrm = source?.drm || drm;
|
|
|
|
const usingExternalGetLicense = selectedDrm?.getLicense instanceof Function;
|
2024-03-28 04:22:52 -06:00
|
|
|
|
2023-10-06 10:39:14 -06:00
|
|
|
const onGetLicense = useCallback(
|
2024-07-12 02:27:42 -06:00
|
|
|
async (event: NativeSyntheticEvent<OnGetLicenseData>) => {
|
|
|
|
if (!usingExternalGetLicense) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
const data = event.nativeEvent;
|
2024-08-02 02:42:20 -06:00
|
|
|
try {
|
|
|
|
if (!data?.spcBase64) {
|
|
|
|
throw new Error('No spc received');
|
|
|
|
}
|
|
|
|
// Handles both scenarios, getLicenseOverride being a promise and not.
|
|
|
|
const license = await Promise.resolve(
|
|
|
|
selectedDrm.getLicense(
|
2023-10-07 04:56:35 -06:00
|
|
|
data.spcBase64,
|
|
|
|
data.contentId,
|
|
|
|
data.licenseUrl,
|
2024-03-12 09:47:49 -06:00
|
|
|
data.loadedLicenseUrl,
|
2024-08-02 02:42:20 -06:00
|
|
|
),
|
|
|
|
).catch(() => {
|
|
|
|
throw new Error('fetch error');
|
|
|
|
});
|
|
|
|
if (typeof license !== 'string') {
|
|
|
|
throw Error('Empty license result');
|
|
|
|
}
|
|
|
|
if (nativeRef.current) {
|
|
|
|
NativeVideoManager.setLicenseResultCmd(
|
|
|
|
getReactTag(nativeRef),
|
|
|
|
license,
|
|
|
|
data.loadedLicenseUrl,
|
|
|
|
);
|
|
|
|
}
|
|
|
|
} catch (e) {
|
|
|
|
const msg = e instanceof Error ? e.message : 'fetch error';
|
|
|
|
if (nativeRef.current) {
|
|
|
|
NativeVideoManager.setLicenseResultErrorCmd(
|
|
|
|
getReactTag(nativeRef),
|
|
|
|
msg,
|
|
|
|
data.loadedLicenseUrl,
|
2023-10-07 04:56:35 -06:00
|
|
|
);
|
2023-10-06 10:39:14 -06:00
|
|
|
}
|
|
|
|
}
|
2023-10-07 04:56:35 -06:00
|
|
|
},
|
2024-08-02 02:42:20 -06:00
|
|
|
[selectedDrm, usingExternalGetLicense],
|
2023-10-06 10:39:14 -06:00
|
|
|
);
|
|
|
|
|
|
|
|
useImperativeHandle(
|
|
|
|
ref,
|
|
|
|
() => ({
|
|
|
|
seek,
|
|
|
|
presentFullscreenPlayer,
|
|
|
|
dismissFullscreenPlayer,
|
|
|
|
save,
|
|
|
|
pause,
|
|
|
|
resume,
|
|
|
|
restoreUserInterfaceForPictureInPictureStopCompleted,
|
2024-05-20 04:21:48 -06:00
|
|
|
setVolume,
|
2024-05-28 03:00:38 -06:00
|
|
|
getCurrentPosition,
|
2024-06-10 14:41:26 -06:00
|
|
|
setFullScreen,
|
2023-10-06 10:39:14 -06:00
|
|
|
}),
|
|
|
|
[
|
|
|
|
seek,
|
|
|
|
presentFullscreenPlayer,
|
|
|
|
dismissFullscreenPlayer,
|
|
|
|
save,
|
|
|
|
pause,
|
|
|
|
resume,
|
|
|
|
restoreUserInterfaceForPictureInPictureStopCompleted,
|
2024-05-20 04:21:48 -06:00
|
|
|
setVolume,
|
2024-05-28 03:00:38 -06:00
|
|
|
getCurrentPosition,
|
2024-06-10 14:41:26 -06:00
|
|
|
setFullScreen,
|
2023-10-07 04:56:35 -06:00
|
|
|
],
|
2023-10-06 10:39:14 -06:00
|
|
|
);
|
|
|
|
|
2024-06-27 03:58:06 -06:00
|
|
|
const _viewType = useMemo(() => {
|
|
|
|
const hasValidDrmProp =
|
|
|
|
drm !== undefined && Object.keys(drm).length !== 0;
|
|
|
|
|
|
|
|
const shallForceViewType =
|
|
|
|
hasValidDrmProp && (viewType === ViewType.TEXTURE || useTextureView);
|
|
|
|
|
2024-08-02 02:50:27 -06:00
|
|
|
if (useSecureView && useTextureView) {
|
2024-06-27 03:58:06 -06:00
|
|
|
console.warn(
|
2024-08-02 02:50:27 -06:00
|
|
|
'cannot use SecureView on texture view. please set useTextureView={false}',
|
2024-06-27 03:58:06 -06:00
|
|
|
);
|
|
|
|
}
|
2024-08-02 02:50:27 -06:00
|
|
|
|
|
|
|
if (shallForceViewType) {
|
2024-06-27 03:58:06 -06:00
|
|
|
console.warn(
|
2024-08-02 02:50:27 -06:00
|
|
|
'cannot use DRM on texture view. please set useTextureView={false}',
|
2024-06-27 03:58:06 -06:00
|
|
|
);
|
2024-08-02 02:50:27 -06:00
|
|
|
return useSecureView ? ViewType.SURFACE_SECURE : ViewType.SURFACE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (viewType !== undefined && viewType !== null) {
|
|
|
|
return viewType;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (useSecureView) {
|
|
|
|
return ViewType.SURFACE_SECURE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (useTextureView) {
|
|
|
|
return ViewType.TEXTURE;
|
2024-06-27 03:58:06 -06:00
|
|
|
}
|
|
|
|
|
2024-08-02 02:50:27 -06:00
|
|
|
return ViewType.SURFACE;
|
2024-06-27 03:58:06 -06:00
|
|
|
}, [drm, useSecureView, useTextureView, viewType]);
|
|
|
|
|
2024-07-22 14:38:35 -06:00
|
|
|
const _renderPoster = useCallback(() => {
|
|
|
|
if (!hasPoster || !showPoster) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
// poster resize mode
|
|
|
|
let _posterResizeMode: ImageResizeMode = 'contain';
|
|
|
|
|
|
|
|
if (!isPosterDeprecated && poster?.resizeMode) {
|
|
|
|
_posterResizeMode = poster.resizeMode;
|
|
|
|
} else if (posterResizeMode && posterResizeMode !== 'none') {
|
|
|
|
_posterResizeMode = posterResizeMode;
|
|
|
|
}
|
|
|
|
|
|
|
|
// poster style
|
|
|
|
const baseStyle: StyleProp<ImageStyle> = {
|
|
|
|
...StyleSheet.absoluteFillObject,
|
|
|
|
resizeMode: _posterResizeMode,
|
|
|
|
};
|
|
|
|
|
|
|
|
let posterStyle: StyleProp<ImageStyle> = baseStyle;
|
|
|
|
|
|
|
|
if (!isPosterDeprecated && poster?.style) {
|
|
|
|
const styles = Array.isArray(poster.style)
|
|
|
|
? poster.style
|
|
|
|
: [poster.style];
|
|
|
|
posterStyle = [baseStyle, ...styles];
|
|
|
|
}
|
|
|
|
|
|
|
|
// render poster
|
2024-09-17 07:58:47 -06:00
|
|
|
if (_renderLoader && (poster || posterResizeMode)) {
|
2024-07-22 14:38:35 -06:00
|
|
|
console.warn(
|
|
|
|
'You provided both `renderLoader` and `poster` or `posterResizeMode` props. `renderLoader` will be used.',
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
// render loader
|
2024-09-17 07:58:47 -06:00
|
|
|
if (_renderLoader) {
|
|
|
|
return (
|
|
|
|
<View style={StyleSheet.absoluteFill}>
|
|
|
|
{_renderLoader({
|
|
|
|
source: source,
|
|
|
|
style: posterStyle,
|
|
|
|
resizeMode: resizeMode,
|
|
|
|
})}
|
|
|
|
</View>
|
|
|
|
);
|
2024-07-22 14:38:35 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
return (
|
|
|
|
<Image
|
|
|
|
{...(isPosterDeprecated ? {} : poster)}
|
|
|
|
source={isPosterDeprecated ? {uri: poster} : poster?.source}
|
|
|
|
style={posterStyle}
|
|
|
|
/>
|
|
|
|
);
|
|
|
|
}, [
|
|
|
|
hasPoster,
|
|
|
|
isPosterDeprecated,
|
|
|
|
poster,
|
|
|
|
posterResizeMode,
|
2024-09-17 07:58:47 -06:00
|
|
|
_renderLoader,
|
2024-07-22 14:38:35 -06:00
|
|
|
showPoster,
|
2024-09-17 07:58:47 -06:00
|
|
|
source,
|
|
|
|
resizeMode,
|
2024-07-22 14:38:35 -06:00
|
|
|
]);
|
|
|
|
|
|
|
|
const _style: StyleProp<ViewStyle> = useMemo(
|
|
|
|
() => ({
|
|
|
|
...StyleSheet.absoluteFillObject,
|
|
|
|
...(showPoster ? {display: 'none'} : {}),
|
|
|
|
}),
|
|
|
|
[showPoster],
|
|
|
|
);
|
|
|
|
|
2023-10-06 10:39:14 -06:00
|
|
|
return (
|
|
|
|
<View style={style}>
|
|
|
|
<NativeVideoComponent
|
|
|
|
ref={nativeRef}
|
|
|
|
{...rest}
|
|
|
|
src={src}
|
2024-07-22 14:38:35 -06:00
|
|
|
style={_style}
|
2023-10-11 13:56:54 -06:00
|
|
|
resizeMode={resizeMode}
|
2023-10-06 10:39:14 -06:00
|
|
|
restoreUserInterfaceForPIPStopCompletionHandler={
|
|
|
|
_restoreUserInterfaceForPIPStopCompletionHandler
|
|
|
|
}
|
|
|
|
selectedTextTrack={_selectedTextTrack}
|
|
|
|
selectedAudioTrack={_selectedAudioTrack}
|
2023-10-11 14:15:58 -06:00
|
|
|
selectedVideoTrack={_selectedVideoTrack}
|
2024-07-12 02:27:42 -06:00
|
|
|
shutterColor={_shutterColor}
|
|
|
|
onGetLicense={usingExternalGetLicense ? onGetLicense : undefined}
|
2024-05-07 03:06:12 -06:00
|
|
|
onVideoLoad={
|
|
|
|
onLoad || hasPoster
|
|
|
|
? (onVideoLoad as (e: NativeSyntheticEvent<object>) => void)
|
|
|
|
: undefined
|
|
|
|
}
|
|
|
|
onVideoLoadStart={
|
|
|
|
onLoadStart || hasPoster ? onVideoLoadStart : undefined
|
|
|
|
}
|
|
|
|
onVideoError={onError ? onVideoError : undefined}
|
|
|
|
onVideoProgress={onProgress ? onVideoProgress : undefined}
|
|
|
|
onVideoSeek={onSeek ? onVideoSeek : undefined}
|
2023-10-06 10:39:14 -06:00
|
|
|
onVideoEnd={onEnd}
|
2024-05-07 03:06:12 -06:00
|
|
|
onVideoBuffer={onBuffer ? onVideoBuffer : undefined}
|
|
|
|
onVideoPlaybackStateChanged={
|
2024-05-10 12:38:34 -06:00
|
|
|
onPlaybackStateChanged ? onVideoPlaybackStateChanged : undefined
|
2024-05-07 03:06:12 -06:00
|
|
|
}
|
|
|
|
onVideoBandwidthUpdate={
|
|
|
|
onBandwidthUpdate ? _onBandwidthUpdate : undefined
|
|
|
|
}
|
|
|
|
onTimedMetadata={onTimedMetadata ? _onTimedMetadata : undefined}
|
|
|
|
onAudioTracks={onAudioTracks ? _onAudioTracks : undefined}
|
|
|
|
onTextTracks={onTextTracks ? _onTextTracks : undefined}
|
|
|
|
onTextTrackDataChanged={
|
|
|
|
onTextTrackDataChanged ? _onTextTrackDataChanged : undefined
|
|
|
|
}
|
|
|
|
onVideoTracks={onVideoTracks ? _onVideoTracks : undefined}
|
2023-10-06 10:39:14 -06:00
|
|
|
onVideoFullscreenPlayerDidDismiss={onFullscreenPlayerDidDismiss}
|
|
|
|
onVideoFullscreenPlayerDidPresent={onFullscreenPlayerDidPresent}
|
|
|
|
onVideoFullscreenPlayerWillDismiss={onFullscreenPlayerWillDismiss}
|
|
|
|
onVideoFullscreenPlayerWillPresent={onFullscreenPlayerWillPresent}
|
2024-05-07 03:06:12 -06:00
|
|
|
onVideoExternalPlaybackChange={
|
|
|
|
onExternalPlaybackChange ? onVideoExternalPlaybackChange : undefined
|
|
|
|
}
|
|
|
|
onVideoIdle={onIdle}
|
|
|
|
onAudioFocusChanged={
|
|
|
|
onAudioFocusChanged ? _onAudioFocusChanged : undefined
|
|
|
|
}
|
2024-05-14 05:04:44 -06:00
|
|
|
onReadyForDisplay={
|
|
|
|
onReadyForDisplay || hasPoster ? _onReadyForDisplay : undefined
|
|
|
|
}
|
2024-05-07 03:06:12 -06:00
|
|
|
onPlaybackRateChange={
|
|
|
|
onPlaybackRateChange ? _onPlaybackRateChange : undefined
|
|
|
|
}
|
|
|
|
onVolumeChange={onVolumeChange ? _onVolumeChange : undefined}
|
2023-10-06 10:39:14 -06:00
|
|
|
onVideoAudioBecomingNoisy={onAudioBecomingNoisy}
|
2024-05-07 03:06:12 -06:00
|
|
|
onPictureInPictureStatusChanged={
|
|
|
|
onPictureInPictureStatusChanged
|
|
|
|
? _onPictureInPictureStatusChanged
|
|
|
|
: undefined
|
|
|
|
}
|
2023-10-06 10:39:14 -06:00
|
|
|
onRestoreUserInterfaceForPictureInPictureStop={
|
|
|
|
onRestoreUserInterfaceForPictureInPictureStop
|
|
|
|
}
|
2024-05-07 03:06:12 -06:00
|
|
|
onVideoAspectRatio={onAspectRatio ? _onVideoAspectRatio : undefined}
|
2024-04-03 12:49:47 -06:00
|
|
|
onReceiveAdEvent={
|
2024-05-07 03:06:12 -06:00
|
|
|
onReceiveAdEvent
|
|
|
|
? (_onReceiveAdEvent as (e: NativeSyntheticEvent<object>) => void)
|
|
|
|
: undefined
|
2024-04-03 12:49:47 -06:00
|
|
|
}
|
2024-06-22 03:15:21 -06:00
|
|
|
onControlsVisibilityChange={
|
|
|
|
onControlsVisibilityChange ? _onControlsVisibilityChange : undefined
|
|
|
|
}
|
2024-06-27 03:58:06 -06:00
|
|
|
viewType={_viewType}
|
2023-10-06 10:39:14 -06:00
|
|
|
/>
|
2024-07-22 14:38:35 -06:00
|
|
|
{_renderPoster()}
|
2023-10-06 10:39:14 -06:00
|
|
|
</View>
|
|
|
|
);
|
2023-10-07 04:56:35 -06:00
|
|
|
},
|
2023-10-06 10:39:14 -06:00
|
|
|
);
|
|
|
|
|
2023-10-07 04:56:35 -06:00
|
|
|
Video.displayName = 'Video';
|
|
|
|
export default Video;
|