vdocipher-rn-bridge 1.22.6 → 2.0.0
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/VdoPlayerSupportView.tsx +12 -70
- package/VdoPlayerUIView.tsx +29 -90
- package/VdoPlayerView.tsx +36 -73
- package/android/build.gradle +23 -4
- package/android/src/main/AndroidManifest.xml +1 -2
- package/android/src/main/java/com/vdocipher/rnbridge/PlayerViewRegistry.java +34 -0
- package/android/src/main/java/com/vdocipher/rnbridge/ReactVdoPlayerUIView.java +7 -11
- package/android/src/main/java/com/vdocipher/rnbridge/{ReactVdoPlayerUIViewManager.java → ReactVdoPlayerUIViewManagerImpl.java} +66 -80
- package/android/src/main/java/com/vdocipher/rnbridge/ReactVdoPlayerView.java +8 -12
- package/android/src/main/java/com/vdocipher/rnbridge/{ReactVdoPlayerViewManager.java → ReactVdoPlayerViewManagerImpl.java} +61 -75
- package/android/src/main/java/com/vdocipher/rnbridge/TrackSelectionModuleImpl.java +64 -0
- package/android/src/main/java/com/vdocipher/rnbridge/Utils.java +27 -0
- package/android/src/main/java/com/vdocipher/rnbridge/{VdoDownloadModule.java → VdoDownloadModuleImpl.java} +23 -50
- package/android/src/main/java/com/vdocipher/rnbridge/VdoEventEmitter.java +51 -17
- package/android/src/main/java/com/vdocipher/rnbridge/VdoPlayerModuleImpl.java +28 -0
- package/android/src/main/java/com/vdocipher/rnbridge/{VdoPlayerSettingsModule.java → VdoPlayerSettingsModuleImpl.java} +3 -8
- package/android/src/main/java/com/vdocipher/rnbridge/{VdoPreCacheManagerModule.java → VdoPreCacheManagerModuleImpl.java} +3 -10
- package/android/src/main/java/com/vdocipher/rnbridge/{VdocipherRnBridgeModule.java → VdocipherRnBridgeModuleImpl.java} +5 -16
- package/android/src/main/java/com/vdocipher/rnbridge/VdocipherRnBridgePackage.java +13 -27
- package/android/src/newarch/java/com/vdocipher/rnbridge/ReactVdoPlayerUIViewManager.java +195 -0
- package/android/src/newarch/java/com/vdocipher/rnbridge/ReactVdoPlayerViewManager.java +174 -0
- package/android/src/newarch/java/com/vdocipher/rnbridge/TrackSelectionModule.java +61 -0
- package/android/src/newarch/java/com/vdocipher/rnbridge/VdoDownloadModule.java +129 -0
- package/android/src/newarch/java/com/vdocipher/rnbridge/VdoPlayerModule.java +29 -0
- package/android/src/newarch/java/com/vdocipher/rnbridge/VdoPlayerSettingsModule.java +42 -0
- package/android/src/newarch/java/com/vdocipher/rnbridge/VdoPreCacheManagerModule.java +43 -0
- package/android/src/newarch/java/com/vdocipher/rnbridge/VdocipherRnBridgeModule.java +44 -0
- package/android/src/oldarch/java/com/vdocipher/rnbridge/ReactVdoPlayerUIViewManager.java +114 -0
- package/android/src/oldarch/java/com/vdocipher/rnbridge/ReactVdoPlayerViewManager.java +109 -0
- package/android/src/oldarch/java/com/vdocipher/rnbridge/TrackSelectionModule.java +59 -0
- package/android/src/oldarch/java/com/vdocipher/rnbridge/VdoDownloadModule.java +132 -0
- package/android/src/oldarch/java/com/vdocipher/rnbridge/VdoPlayerModule.java +29 -0
- package/android/src/oldarch/java/com/vdocipher/rnbridge/VdoPlayerSettingsModule.java +40 -0
- package/android/src/oldarch/java/com/vdocipher/rnbridge/VdoPreCacheManagerModule.java +40 -0
- package/android/src/oldarch/java/com/vdocipher/rnbridge/VdocipherRnBridgeModule.java +40 -0
- package/downloads.ts +5 -5
- package/ios/AssetList.swift +27 -0
- package/ios/RCTVdoPlayerUIView.h +4 -4
- package/ios/RCTVdoPlayerUIView.swift +2 -1
- package/ios/RCTVdoPlayerUIViewComponentView.mm +127 -0
- package/ios/RCTVdoPlayerView.swift +1 -0
- package/ios/RCTVdoPlayerViewComponentView.mm +127 -0
- package/ios/VdoCipherRNView.h +16 -3
- package/ios/VdoCipherRNView.swift +45 -9
- package/ios/VdoDownload.swift +74 -76
- package/ios/VdoPlayerCommandDispatch.h +52 -0
- package/ios/VdoPreCacheManager.swift +1 -1
- package/ios/VdocipherRnBridgeViewManager.mm +234 -0
- package/ios/VdocipherRnBridgeViewManager.swift +4 -4
- package/package.json +46 -3
- package/react-native-vdocipher-rn-bridge.podspec +1 -1
- package/specs/NativeTrackSelection.ts +38 -0
- package/specs/NativeVdoDownload.ts +76 -0
- package/specs/NativeVdoEventEmitter.ts +12 -0
- package/specs/NativeVdoPlayer.ts +11 -0
- package/specs/NativeVdoPlayerSettings.ts +13 -0
- package/specs/NativeVdoPreCacheManager.ts +12 -0
- package/specs/NativeVdocipherRnBridge.ts +11 -0
- package/specs/RCTVdoPlayerUIViewNativeComponent.ts +93 -0
- package/specs/RCTVdoPlayerViewNativeComponent.ts +84 -0
- package/tsconfig.json +1 -1
- package/type.ts +84 -90
- package/android/src/main/java/com/vdocipher/rnbridge/TrackSelectionModule.java +0 -126
- package/android/src/main/java/com/vdocipher/rnbridge/VdoPlayerModule.java +0 -54
- package/ios/VdocipherRnBridgeViewManager.m +0 -126
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type {TurboModule} from 'react-native';
|
|
2
|
+
import {TurboModuleRegistry} from 'react-native';
|
|
3
|
+
import { Int32 } from 'react-native/Libraries/Types/CodegenTypes';
|
|
4
|
+
|
|
5
|
+
interface VideoQuality {
|
|
6
|
+
id: Int32;
|
|
7
|
+
bitrate: Int32;
|
|
8
|
+
width: Int32;
|
|
9
|
+
height: Int32;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
interface CaptionLanguage {
|
|
13
|
+
id: Int32;
|
|
14
|
+
language: string;
|
|
15
|
+
label: string;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export interface Spec extends TurboModule {
|
|
19
|
+
isAdaptive(callback: (isAdaptive: boolean) => void): void;
|
|
20
|
+
getVideoQualities(callback: (videoQualities: Array<VideoQuality>) => void): void;
|
|
21
|
+
getSelectedVideoQuality(callback: (selectedVideoQuality: {id: Int32,
|
|
22
|
+
bitrate: Int32,
|
|
23
|
+
width: Int32,
|
|
24
|
+
height: Int32}) => void): void;
|
|
25
|
+
getSelectedAudioQuality(callback: (selectedAudioQuality: {id: Int32,
|
|
26
|
+
bitrate: Int32,
|
|
27
|
+
width: Int32,
|
|
28
|
+
height: Int32}) => void): void;
|
|
29
|
+
getCaptionLanguages(callback: (captionLanguages: Array<CaptionLanguage>) => void): void;
|
|
30
|
+
getSelectedCaptionLanguage(callback: (selectedCaptionLanguage: {id: Int32,
|
|
31
|
+
language: string,
|
|
32
|
+
label: string}) => void): void;
|
|
33
|
+
getDuration(callback: (duration: Int32) => void): void;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export default TurboModuleRegistry.getEnforcing<Spec>(
|
|
37
|
+
'TrackSelection',
|
|
38
|
+
);
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import type {TurboModule} from 'react-native';
|
|
2
|
+
import {TurboModuleRegistry} from 'react-native';
|
|
3
|
+
import { Int32, Double, UnsafeObject } from 'react-native/Libraries/Types/CodegenTypes';
|
|
4
|
+
|
|
5
|
+
interface ErrorDescription {
|
|
6
|
+
errorCode: Int32;
|
|
7
|
+
errorMsg: string;
|
|
8
|
+
httpStatusCode: Int32;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
interface MediaInfo {
|
|
12
|
+
mediaId: string;
|
|
13
|
+
type: string;
|
|
14
|
+
title: string;
|
|
15
|
+
description: string;
|
|
16
|
+
duration: Int32;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
interface Track {
|
|
20
|
+
id: Int32;
|
|
21
|
+
type: string;
|
|
22
|
+
language: string;
|
|
23
|
+
bitrate: Int32;
|
|
24
|
+
width: Int32;
|
|
25
|
+
height: Int32;
|
|
26
|
+
label: string;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
interface DownloadOptions {
|
|
30
|
+
mediaId: string;
|
|
31
|
+
mediaInfo: MediaInfo;
|
|
32
|
+
availableTracks: Array<Track>;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
interface DownloadStatus {
|
|
36
|
+
mediaInfo: MediaInfo;
|
|
37
|
+
localStorageFolder: string;
|
|
38
|
+
status: string;
|
|
39
|
+
reason: Int32;
|
|
40
|
+
reasonDescription: string;
|
|
41
|
+
totalSizeBytes: Double;
|
|
42
|
+
bytesDownloaded: Double;
|
|
43
|
+
downloadPercent: Int32;
|
|
44
|
+
poster: string;
|
|
45
|
+
lastModifiedTimestamp: Double;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export interface Spec extends TurboModule {
|
|
49
|
+
addListener(eventName: string): void;
|
|
50
|
+
removeListeners(count: number): void;
|
|
51
|
+
getDownloadOptions(optionParams: UnsafeObject,
|
|
52
|
+
errorCallback: (errorDescription: ErrorDescription) => void,
|
|
53
|
+
successCallback: (nativeId: string, optionsMap: DownloadOptions) => void): void;
|
|
54
|
+
enqueueDownload(nativeId: string, requestOptions: UnsafeObject,
|
|
55
|
+
errorCallback: (exception: string | null, msg: string) => void,
|
|
56
|
+
successCallback: () => void): void;
|
|
57
|
+
query(queryFilters: UnsafeObject,
|
|
58
|
+
errorCallback: (exception: string | null, msg: string) => void,
|
|
59
|
+
successCallback: (downloadStatusArray: Array<DownloadStatus>) => void): void;
|
|
60
|
+
remove(deleteIds: Array<string>,
|
|
61
|
+
errorCallback: (exception: string | null, msg: string) => void,
|
|
62
|
+
successCallback: () => void): void;
|
|
63
|
+
stop(stopIds: Array<string>,
|
|
64
|
+
errorCallback: (exception: string | null, msg: string) => void,
|
|
65
|
+
successCallback: () => void): void;
|
|
66
|
+
resume(resumeIds: Array<string>,
|
|
67
|
+
errorCallback: (exception: string | null, msg: string) => void,
|
|
68
|
+
successCallback: () => void): void;
|
|
69
|
+
isExpired(mediaId: string,
|
|
70
|
+
errorCallback: (exception: string | null, msg: string) => void,
|
|
71
|
+
successCallback: () => void): void;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export default TurboModuleRegistry.getEnforcing<Spec>(
|
|
75
|
+
'VdoDownload',
|
|
76
|
+
);
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type {TurboModule} from 'react-native';
|
|
2
|
+
import {TurboModuleRegistry} from 'react-native';
|
|
3
|
+
|
|
4
|
+
// iOS-only: Android has no VdoEventEmitter module (events go through the view).
|
|
5
|
+
export interface Spec extends TurboModule {
|
|
6
|
+
addListener(eventName: string): void;
|
|
7
|
+
removeListeners(count: number): void;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export default TurboModuleRegistry.getEnforcing<Spec>(
|
|
11
|
+
'VdoEventEmitter',
|
|
12
|
+
);
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type {TurboModule} from 'react-native';
|
|
2
|
+
import {TurboModuleRegistry} from 'react-native';
|
|
3
|
+
import { Int32 } from 'react-native/Libraries/Types/CodegenTypes';
|
|
4
|
+
|
|
5
|
+
export interface Spec extends TurboModule {
|
|
6
|
+
getPlaybackPropertiesV2(callback: (playbackProperties: {totalPlayed: Int32, totalCovered: Int32}) => void): void;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export default TurboModuleRegistry.getEnforcing<Spec>(
|
|
10
|
+
'VdoPlayer',
|
|
11
|
+
);
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type {TurboModule} from 'react-native';
|
|
2
|
+
import {TurboModuleRegistry} from 'react-native';
|
|
3
|
+
import { UnsafeObject } from 'react-native/Libraries/Types/CodegenTypes';
|
|
4
|
+
|
|
5
|
+
export interface Spec extends TurboModule {
|
|
6
|
+
// Each platform reads only its own keys (Android: vdoPlaybackModeAndroid/bufferingGoalMs;
|
|
7
|
+
// iOS: vdoPlaybackModeiOS). All optional so a caller passes only what its platform needs.
|
|
8
|
+
applySettings(playerSettings: UnsafeObject): void;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export default TurboModuleRegistry.getEnforcing<Spec>(
|
|
12
|
+
'VdoPlayerSettings',
|
|
13
|
+
);
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type {TurboModule} from 'react-native';
|
|
2
|
+
import {TurboModuleRegistry} from 'react-native';
|
|
3
|
+
import { UnsafeObject } from 'react-native/Libraries/Types/CodegenTypes';
|
|
4
|
+
|
|
5
|
+
export interface Spec extends TurboModule {
|
|
6
|
+
cacheVideo(preCacheSettings: UnsafeObject): void;
|
|
7
|
+
clearCache(): void;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export default TurboModuleRegistry.getEnforcing<Spec>(
|
|
11
|
+
'VdoPreCacheManager',
|
|
12
|
+
);
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type {TurboModule} from 'react-native';
|
|
2
|
+
import {TurboModuleRegistry} from 'react-native';
|
|
3
|
+
import { UnsafeObject } from 'react-native/Libraries/Types/CodegenTypes';
|
|
4
|
+
|
|
5
|
+
export interface Spec extends TurboModule {
|
|
6
|
+
startVideoScreen(embedParams: UnsafeObject, setPictureInPictureSupport: boolean): void;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export default TurboModuleRegistry.getEnforcing<Spec>(
|
|
10
|
+
'VdocipherRnBridge',
|
|
11
|
+
);
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import type { HostComponent, ViewProps } from "react-native";
|
|
2
|
+
import { DirectEventHandler, Double, Float, Int32, WithDefault } from "react-native/Libraries/Types/CodegenTypes";
|
|
3
|
+
import codegenNativeComponent from "react-native/Libraries/Utilities/codegenNativeComponent";
|
|
4
|
+
import codegenNativeCommands from "react-native/Libraries/Utilities/codegenNativeCommands";
|
|
5
|
+
import type * as React from "react";
|
|
6
|
+
|
|
7
|
+
interface EmbedInfo {
|
|
8
|
+
otp?: string;
|
|
9
|
+
playbackInfo?: string;
|
|
10
|
+
token?: string;
|
|
11
|
+
mediaId?: string;
|
|
12
|
+
mediaUrl?: string;
|
|
13
|
+
licenseUrl?: string | null;
|
|
14
|
+
offline?: boolean;
|
|
15
|
+
forceLowestBitrate?: boolean | null;
|
|
16
|
+
forceHighestSupportedBitrate?: boolean | null;
|
|
17
|
+
maxVideoBitrateKbps?: Int32 | null;
|
|
18
|
+
enableAutoResume?: boolean | null;
|
|
19
|
+
preferredCaptionsLanguage?: string | null;
|
|
20
|
+
playerConfig?: string | null;
|
|
21
|
+
customPlayerId?: string | null;
|
|
22
|
+
setPictureInPictureSupport?: boolean | null;
|
|
23
|
+
resumeTimeMs?: Int32 | null;
|
|
24
|
+
allowAdbDebugging?: boolean;
|
|
25
|
+
clipStartInMs?: Int32 | null;
|
|
26
|
+
clipEndInMs?: Int32 | null;
|
|
27
|
+
clipped?: boolean | null;
|
|
28
|
+
clipMarkerColor?: string | null;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export interface NativeProps extends ViewProps {
|
|
32
|
+
embedInfo: EmbedInfo;
|
|
33
|
+
resizeMode?: string;
|
|
34
|
+
aspectRatio?: Float;
|
|
35
|
+
autoPlay?: WithDefault<boolean, true>;
|
|
36
|
+
|
|
37
|
+
onInitSuccess: DirectEventHandler<{restored: boolean}>,
|
|
38
|
+
onInitFailure: DirectEventHandler<{errorDescription: {errorCode: Int32, errorMsg: string, httpStatusCode: Int32}}>,
|
|
39
|
+
onVdoLoading: DirectEventHandler<{}>,
|
|
40
|
+
onVdoLoaded: DirectEventHandler<{mediaInfo: {mediaId: string, type: string, title: string, description: string, duration: Int32}}>,
|
|
41
|
+
onVdoLoadError: DirectEventHandler<{errorDescription: {errorCode: Int32, errorMsg: string, httpStatusCode: Int32}}>,
|
|
42
|
+
onVdoPlayerStateChanged: DirectEventHandler<{playWhenReady: boolean, playerState: string}>,
|
|
43
|
+
onVdoProgress: DirectEventHandler<{currentTime: Int32}>,
|
|
44
|
+
onVdoBufferUpdate: DirectEventHandler<{bufferTime: Int32}>,
|
|
45
|
+
onVdoPlaybackSpeedChanged: DirectEventHandler<{playbackSpeed: Double}>,
|
|
46
|
+
onVdoTracksChanged: DirectEventHandler<{availableTracks: {id: Int32, type: string, language: string, bitrate: Int32, width: Int32, height: Int32, label: string}[], selectedTracks: {id: Int32, type: string, language: string, bitrate: Int32, width: Int32, height: Int32, label: string}[]}>,
|
|
47
|
+
onVdoMediaEnded: DirectEventHandler<{}>,
|
|
48
|
+
onVdoError: DirectEventHandler<{errorDescription: {errorCode: Int32, errorMsg: string, httpStatusCode: Int32}}>,
|
|
49
|
+
onVdoEnterFullscreen: DirectEventHandler<{}>,
|
|
50
|
+
onVdoExitFullscreen: DirectEventHandler<{}>,
|
|
51
|
+
onVdoPictureInPictureModeChanged: DirectEventHandler<{isInPictureInPictureMode: boolean}>,
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
// Command names/signatures must stay in sync with the native handlers (no compile-time link):
|
|
55
|
+
// iOS: RCTVdoPlayerUIViewComponentView.mm (new arch), VdocipherRnBridgeViewManager.mm (old arch)
|
|
56
|
+
// Android: ReactVdoPlayerUIViewManagerImpl.java
|
|
57
|
+
interface NativeCommands {
|
|
58
|
+
play: (viewRef: React.ElementRef<HostComponent<NativeProps>>) => void;
|
|
59
|
+
pause: (viewRef: React.ElementRef<HostComponent<NativeProps>>) => void;
|
|
60
|
+
seek: (viewRef: React.ElementRef<HostComponent<NativeProps>>, seekTargetMs: Int32) => void;
|
|
61
|
+
enterFullscreen: (viewRef: React.ElementRef<HostComponent<NativeProps>>) => void;
|
|
62
|
+
exitFullscreen: (viewRef: React.ElementRef<HostComponent<NativeProps>>) => void;
|
|
63
|
+
playbackSpeed: (viewRef: React.ElementRef<HostComponent<NativeProps>>, speed: Double) => void;
|
|
64
|
+
disableCaptions: (viewRef: React.ElementRef<HostComponent<NativeProps>>) => void;
|
|
65
|
+
enableAdaptiveVideo: (viewRef: React.ElementRef<HostComponent<NativeProps>>) => void;
|
|
66
|
+
setVideoQuality: (viewRef: React.ElementRef<HostComponent<NativeProps>>, track: string) => void;
|
|
67
|
+
setCaptionLanguage: (viewRef: React.ElementRef<HostComponent<NativeProps>>, caption: string) => void;
|
|
68
|
+
// iOS-only: pause on screen blur / resume on focus. No-op on Android.
|
|
69
|
+
setScreenFocused: (viewRef: React.ElementRef<HostComponent<NativeProps>>) => void;
|
|
70
|
+
setScreenBlurred: (viewRef: React.ElementRef<HostComponent<NativeProps>>) => void;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export const Commands = codegenNativeCommands<NativeCommands>({
|
|
74
|
+
supportedCommands: [
|
|
75
|
+
"play",
|
|
76
|
+
"pause",
|
|
77
|
+
"seek",
|
|
78
|
+
"enterFullscreen",
|
|
79
|
+
"exitFullscreen",
|
|
80
|
+
"playbackSpeed",
|
|
81
|
+
"disableCaptions",
|
|
82
|
+
"enableAdaptiveVideo",
|
|
83
|
+
"setVideoQuality",
|
|
84
|
+
"setCaptionLanguage",
|
|
85
|
+
"setScreenFocused",
|
|
86
|
+
"setScreenBlurred",
|
|
87
|
+
],
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
export default codegenNativeComponent<NativeProps>(
|
|
91
|
+
"VdoPlayerUIView",
|
|
92
|
+
{ paperComponentName: "RCTVdoPlayerUIView" }
|
|
93
|
+
) as HostComponent<NativeProps>;
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import type { HostComponent, ViewProps } from "react-native";
|
|
2
|
+
import { DirectEventHandler, Double, Float, Int32, WithDefault } from "react-native/Libraries/Types/CodegenTypes";
|
|
3
|
+
import codegenNativeComponent from "react-native/Libraries/Utilities/codegenNativeComponent";
|
|
4
|
+
import codegenNativeCommands from "react-native/Libraries/Utilities/codegenNativeCommands";
|
|
5
|
+
import type * as React from "react";
|
|
6
|
+
|
|
7
|
+
interface EmbedInfo {
|
|
8
|
+
otp?: string;
|
|
9
|
+
playbackInfo?: string;
|
|
10
|
+
token?: string;
|
|
11
|
+
mediaId?: string;
|
|
12
|
+
mediaUrl?: string;
|
|
13
|
+
licenseUrl?: string | null;
|
|
14
|
+
offline?: boolean;
|
|
15
|
+
forceLowestBitrate?: boolean | null;
|
|
16
|
+
forceHighestSupportedBitrate?: boolean | null;
|
|
17
|
+
maxVideoBitrateKbps?: Int32 | null;
|
|
18
|
+
enableAutoResume?: boolean | null;
|
|
19
|
+
preferredCaptionsLanguage?: string | null;
|
|
20
|
+
playerConfig?: string | null;
|
|
21
|
+
customPlayerId?: string | null;
|
|
22
|
+
setPictureInPictureSupport?: boolean | null;
|
|
23
|
+
resumeTimeMs?: Int32 | null;
|
|
24
|
+
allowAdbDebugging?: boolean;
|
|
25
|
+
clipStartInMs?: Int32 | null;
|
|
26
|
+
clipEndInMs?: Int32 | null;
|
|
27
|
+
clipped?: boolean | null;
|
|
28
|
+
clipMarkerColor?: string | null;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export interface NativeProps extends ViewProps {
|
|
32
|
+
embedInfo: EmbedInfo;
|
|
33
|
+
resizeMode?: string;
|
|
34
|
+
aspectRatio?: Float;
|
|
35
|
+
autoPlay?: WithDefault<boolean, true>;
|
|
36
|
+
|
|
37
|
+
onInitSuccess: DirectEventHandler<{restored: boolean}>,
|
|
38
|
+
onInitFailure: DirectEventHandler<{errorDescription: {errorCode: Int32, errorMsg: string, httpStatusCode: Int32}}>,
|
|
39
|
+
onVdoLoading: DirectEventHandler<{}>,
|
|
40
|
+
onVdoLoaded: DirectEventHandler<{mediaInfo: {mediaId: string, type: string, title: string, description: string, duration: Int32}}>,
|
|
41
|
+
onVdoLoadError: DirectEventHandler<{errorDescription: {errorCode: Int32, errorMsg: string, httpStatusCode: Int32}}>,
|
|
42
|
+
onVdoPlayerStateChanged: DirectEventHandler<{playWhenReady: boolean, playerState: string}>,
|
|
43
|
+
onVdoProgress: DirectEventHandler<{currentTime: Int32}>,
|
|
44
|
+
onVdoBufferUpdate: DirectEventHandler<{bufferTime: Int32}>,
|
|
45
|
+
onVdoPlaybackSpeedChanged: DirectEventHandler<{playbackSpeed: Double}>,
|
|
46
|
+
onVdoTracksChanged: DirectEventHandler<{availableTracks: {id: Int32, type: string, language: string, bitrate: Int32, width: Int32, height: Int32, label: string}[], selectedTracks: {id: Int32, type: string, language: string, bitrate: Int32, width: Int32, height: Int32, label: string}[]}>,
|
|
47
|
+
onVdoMediaEnded: DirectEventHandler<{}>,
|
|
48
|
+
onVdoError: DirectEventHandler<{errorDescription: {errorCode: Int32, errorMsg: string, httpStatusCode: Int32}}>,
|
|
49
|
+
onVdoEnterFullscreen: DirectEventHandler<{}>,
|
|
50
|
+
onVdoExitFullscreen: DirectEventHandler<{}>,
|
|
51
|
+
onVdoPictureInPictureModeChanged: DirectEventHandler<{isInPictureInPictureMode: boolean}>,
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
// Command names/signatures must stay in sync with the native handlers (no compile-time link):
|
|
55
|
+
// iOS: RCTVdoPlayerViewComponentView.mm (new arch), VdocipherRnBridgeViewManager.mm (old arch)
|
|
56
|
+
// Android: ReactVdoPlayerViewManagerImpl.java
|
|
57
|
+
interface NativeCommands {
|
|
58
|
+
play: (viewRef: React.ElementRef<HostComponent<NativeProps>>) => void;
|
|
59
|
+
pause: (viewRef: React.ElementRef<HostComponent<NativeProps>>) => void;
|
|
60
|
+
seek: (viewRef: React.ElementRef<HostComponent<NativeProps>>, seekTargetMs: Int32) => void;
|
|
61
|
+
playbackSpeed: (viewRef: React.ElementRef<HostComponent<NativeProps>>, speed: Double) => void;
|
|
62
|
+
enableAdaptiveVideo: (viewRef: React.ElementRef<HostComponent<NativeProps>>) => void;
|
|
63
|
+
setVideoQuality: (viewRef: React.ElementRef<HostComponent<NativeProps>>, track: string) => void;
|
|
64
|
+
setCaptionLanguage: (viewRef: React.ElementRef<HostComponent<NativeProps>>, caption: string) => void;
|
|
65
|
+
disableCaptions: (viewRef: React.ElementRef<HostComponent<NativeProps>>) => void;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export const Commands = codegenNativeCommands<NativeCommands>({
|
|
69
|
+
supportedCommands: [
|
|
70
|
+
"play",
|
|
71
|
+
"pause",
|
|
72
|
+
"seek",
|
|
73
|
+
"playbackSpeed",
|
|
74
|
+
"enableAdaptiveVideo",
|
|
75
|
+
"setVideoQuality",
|
|
76
|
+
"setCaptionLanguage",
|
|
77
|
+
"disableCaptions",
|
|
78
|
+
],
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
export default codegenNativeComponent<NativeProps>(
|
|
82
|
+
"VdoPlayerView",
|
|
83
|
+
{ paperComponentName: "RCTVdoPlayerView" }
|
|
84
|
+
) as HostComponent<NativeProps>;
|
package/tsconfig.json
CHANGED
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
// "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */
|
|
33
33
|
// "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */
|
|
34
34
|
"typeRoots": ["./node_modules/@types"], /* Specify multiple folders that act like './node_modules/@types'. */
|
|
35
|
-
"types": ["node"], /* Specify type package names to be included without being referenced in a source file. */
|
|
35
|
+
"types": ["node", "jest"], /* Specify type package names to be included without being referenced in a source file. */
|
|
36
36
|
// "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
|
|
37
37
|
// "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */
|
|
38
38
|
// "resolveJsonModule": true, /* Enable importing .json files. */
|
package/type.ts
CHANGED
|
@@ -1,32 +1,19 @@
|
|
|
1
1
|
import PropTypes from 'prop-types';
|
|
2
|
+
import { StyleProp, ViewProps, ViewStyle } from 'react-native';
|
|
2
3
|
|
|
3
|
-
export type EmbedInfo = OtpEmbedInfo | TokenEmbedInfo |ExternalEmbedInfo;
|
|
4
|
+
export type EmbedInfo = OtpEmbedInfo | TokenEmbedInfo | ExternalEmbedInfo;
|
|
4
5
|
|
|
5
|
-
|
|
6
|
-
otp: string;
|
|
7
|
-
playbackInfo: string;
|
|
8
|
-
/**
|
|
9
|
-
* Not supported in iOS
|
|
10
|
-
*/
|
|
11
|
-
forceLowestBitrate?: boolean | null;
|
|
12
|
-
/**
|
|
13
|
-
* Not supported in iOS
|
|
14
|
-
*/
|
|
15
|
-
forceHighestSupportedBitrate?: boolean | null;
|
|
16
|
-
/**
|
|
17
|
-
* Not supported in iOS
|
|
18
|
-
*/
|
|
19
|
-
maxVideoBitrateKbps?: number | null;
|
|
6
|
+
interface BaseEmbedInfo {
|
|
20
7
|
enableAutoResume?: boolean | null;
|
|
21
8
|
preferredCaptionsLanguage?: string | null;
|
|
22
9
|
/**
|
|
23
|
-
* @deprecated
|
|
10
|
+
* @deprecated
|
|
24
11
|
* Use {@link customPlayerId} instead.
|
|
25
12
|
*/
|
|
26
13
|
playerConfig?: string | null;
|
|
27
14
|
customPlayerId?: string | null;
|
|
28
15
|
/**
|
|
29
|
-
* @deprecated
|
|
16
|
+
* @deprecated
|
|
30
17
|
* This property is no longer required to enable PIP mode.
|
|
31
18
|
* Use {@link https://developer.android.com/reference/android/app/Activity#enterPictureInPictureMode(android.app.PictureInPictureParams)} at activity level instead.
|
|
32
19
|
*/
|
|
@@ -36,15 +23,16 @@ export interface OtpEmbedInfo {
|
|
|
36
23
|
* Not supported in iOS
|
|
37
24
|
*/
|
|
38
25
|
allowAdbDebugging?: boolean;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
interface ClippableEmbedInfo extends BaseEmbedInfo {
|
|
39
29
|
clipStartInMs?: number | null;
|
|
40
30
|
clipEndInMs?: number | null;
|
|
41
31
|
clipped?: boolean | null;
|
|
42
32
|
clipMarkerColor?: string | null;
|
|
43
33
|
}
|
|
44
34
|
|
|
45
|
-
|
|
46
|
-
token: string;
|
|
47
|
-
mediaId: string;
|
|
35
|
+
interface AndroidBitrateOptions {
|
|
48
36
|
/**
|
|
49
37
|
* Not supported in iOS
|
|
50
38
|
*/
|
|
@@ -57,81 +45,34 @@ export interface TokenEmbedInfo {
|
|
|
57
45
|
* Not supported in iOS
|
|
58
46
|
*/
|
|
59
47
|
maxVideoBitrateKbps?: number | null;
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
* This property is no longer required to enable PIP mode.
|
|
71
|
-
* Use {@link https://developer.android.com/reference/android/app/Activity#enterPictureInPictureMode(android.app.PictureInPictureParams)} at activity level instead.
|
|
72
|
-
*/
|
|
73
|
-
setPictureInPictureSupport?: boolean | null;
|
|
74
|
-
resumeTimeMs?: number | null;
|
|
75
|
-
/**
|
|
76
|
-
* Not supported in iOS
|
|
77
|
-
*/
|
|
78
|
-
allowAdbDebugging?: boolean;
|
|
79
|
-
clipStartInMs?: number | null;
|
|
80
|
-
clipEndInMs?: number | null;
|
|
81
|
-
clipped?: boolean | null;
|
|
82
|
-
clipMarkerColor?: string | null;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export interface OtpEmbedInfo extends ClippableEmbedInfo, AndroidBitrateOptions {
|
|
51
|
+
otp: string;
|
|
52
|
+
playbackInfo: string;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export interface TokenEmbedInfo extends ClippableEmbedInfo, AndroidBitrateOptions {
|
|
56
|
+
token: string;
|
|
57
|
+
mediaId: string;
|
|
83
58
|
}
|
|
84
59
|
|
|
85
60
|
/**
|
|
86
61
|
* Not supported in iOS
|
|
87
62
|
*/
|
|
88
|
-
export interface ExternalEmbedInfo {
|
|
63
|
+
export interface ExternalEmbedInfo extends BaseEmbedInfo, AndroidBitrateOptions {
|
|
89
64
|
mediaUrl: string;
|
|
90
65
|
licenseUrl?: string | null;
|
|
91
|
-
forceLowestBitrate?: boolean | null;
|
|
92
|
-
forceHighestSupportedBitrate?: boolean | null;
|
|
93
|
-
maxVideoBitrateKbps?: number | null;
|
|
94
|
-
enableAutoResume?: boolean | null;
|
|
95
|
-
preferredCaptionsLanguage?: string | null;
|
|
96
|
-
customPlayerId?: string | null;
|
|
97
|
-
resumeTimeMs?: number | null;
|
|
98
|
-
allowAdbDebugging?: boolean;
|
|
99
66
|
}
|
|
100
67
|
|
|
101
|
-
export
|
|
68
|
+
export interface OfflineEmbedInfo extends ClippableEmbedInfo {
|
|
102
69
|
offline: boolean;
|
|
103
70
|
mediaId: string;
|
|
104
|
-
enableAutoResume?: boolean | null;
|
|
105
|
-
preferredCaptionsLanguage?: string | null;
|
|
106
|
-
/**
|
|
107
|
-
* @deprecated
|
|
108
|
-
* This id will be ignored and the customPlayerId passed while downloading will be used
|
|
109
|
-
*/
|
|
110
|
-
playerConfig?: string | null;
|
|
111
|
-
/**
|
|
112
|
-
* @deprecated
|
|
113
|
-
* This property is no longer required to enable PIP mode.
|
|
114
|
-
* Use {@link https://developer.android.com/reference/android/app/Activity#enterPictureInPictureMode(android.app.PictureInPictureParams)} at activity level instead.
|
|
115
|
-
*/
|
|
116
|
-
setPictureInPictureSupport?: boolean | null;
|
|
117
|
-
resumeTimeMs?: number | null;
|
|
118
|
-
/**
|
|
119
|
-
* Not supported in iOS
|
|
120
|
-
*/
|
|
121
|
-
allowAdbDebugging?: boolean;
|
|
122
|
-
clipStartInMs?: number | null;
|
|
123
|
-
clipEndInMs?: number | null;
|
|
124
|
-
clipped?: boolean | null;
|
|
125
|
-
clipMarkerColor?: string | null;
|
|
126
71
|
}
|
|
127
72
|
|
|
128
|
-
export type OfflineOptionParams =
|
|
129
|
-
otp: string;
|
|
130
|
-
|
|
131
|
-
token: string;
|
|
132
|
-
mediaId: string;
|
|
133
|
-
customPlayerId?: string;
|
|
134
|
-
}
|
|
73
|
+
export type OfflineOptionParams =
|
|
74
|
+
| { otp: string; playbackInfo: string; customPlayerId?: string; }
|
|
75
|
+
| { token: string; mediaId: string; customPlayerId?: string; };
|
|
135
76
|
|
|
136
77
|
export interface MediaInfo {
|
|
137
78
|
mediaId: string;
|
|
@@ -170,6 +111,20 @@ export interface DownloadStatus {
|
|
|
170
111
|
lastModifiedTimestamp: number;
|
|
171
112
|
}
|
|
172
113
|
|
|
114
|
+
export interface QueryFilters {
|
|
115
|
+
mediaId: Array<string>;
|
|
116
|
+
status: Array<string>;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
export interface EnqueueSelections {
|
|
120
|
+
selections: Array<number>;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
export interface DownloadOptionsResult {
|
|
124
|
+
downloadOptions: DownloadOptions;
|
|
125
|
+
enqueue: (selections: EnqueueSelections) => Promise<void>;
|
|
126
|
+
}
|
|
127
|
+
|
|
173
128
|
export interface VideoQuality {
|
|
174
129
|
id: number;
|
|
175
130
|
bitrate: number;
|
|
@@ -208,6 +163,51 @@ export interface PreCacheSettings {
|
|
|
208
163
|
cacheSize?: number;
|
|
209
164
|
}
|
|
210
165
|
|
|
166
|
+
export interface ErrorDescription {
|
|
167
|
+
errorCode: number;
|
|
168
|
+
errorMsg: string;
|
|
169
|
+
httpStatusCode: number;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
export interface VdoPlayerProps extends ViewProps {
|
|
173
|
+
embedInfo: EmbedInfo | OfflineEmbedInfo;
|
|
174
|
+
showNativeControls?: boolean;
|
|
175
|
+
autoPlay?: boolean;
|
|
176
|
+
style?: StyleProp<ViewStyle & { resizeMode?: string }>;
|
|
177
|
+
// Native view callbacks (internal plumbing, overridden by VdoPlayerView)
|
|
178
|
+
onInitSuccess?: (event: any) => void;
|
|
179
|
+
onInitFailure?: (event: any) => void;
|
|
180
|
+
onVdoLoading?: (event: any) => void;
|
|
181
|
+
onVdoLoaded?: (event: any) => void;
|
|
182
|
+
onVdoLoadError?: (event: any) => void;
|
|
183
|
+
onVdoPlayerStateChanged?: (event: any) => void;
|
|
184
|
+
onVdoProgress?: (event: any) => void;
|
|
185
|
+
onVdoBufferUpdate?: (event: any) => void;
|
|
186
|
+
onVdoPlaybackSpeedChanged?: (event: any) => void;
|
|
187
|
+
onVdoTracksChanged?: (event: any) => void;
|
|
188
|
+
onVdoMediaEnded?: (event: any) => void;
|
|
189
|
+
onVdoError?: (event: any) => void;
|
|
190
|
+
onVdoEnterFullscreen?: (event: any) => void;
|
|
191
|
+
onVdoExitFullscreen?: (event: any) => void;
|
|
192
|
+
onVdoPictureInPictureModeChanged?: (event: any) => void;
|
|
193
|
+
// Wrapper-level callbacks (public API)
|
|
194
|
+
onInitializationSuccess?: (event: { restored: boolean }) => void;
|
|
195
|
+
onInitializationFailure?: (event: { errorDescription: ErrorDescription }) => void;
|
|
196
|
+
onLoading?: (event: { embedInfo: EmbedInfo | OfflineEmbedInfo }) => void;
|
|
197
|
+
onLoaded?: (event: { embedInfo: EmbedInfo | OfflineEmbedInfo; mediaInfo: MediaInfo }) => void;
|
|
198
|
+
onLoadError?: (event: { embedInfo: EmbedInfo | OfflineEmbedInfo; errorDescription: ErrorDescription }) => void;
|
|
199
|
+
onPlayerStateChanged?: (event: { playWhenReady: boolean; playerState: string }) => void;
|
|
200
|
+
onProgress?: (event: { currentTime: number }) => void;
|
|
201
|
+
onBufferUpdate?: (event: { bufferTime: number }) => void;
|
|
202
|
+
onPlaybackSpeedChanged?: (playbackSpeed: number) => void;
|
|
203
|
+
onTracksChanged?: (event: { availableTracks: Array<Track>; selectedTracks: Array<Track> }) => void;
|
|
204
|
+
onMediaEnded?: (event: { embedInfo: EmbedInfo | OfflineEmbedInfo }) => void;
|
|
205
|
+
onError?: (event: { embedInfo: EmbedInfo | OfflineEmbedInfo; errorDescription: ErrorDescription }) => void;
|
|
206
|
+
onEnterFullscreen?: () => void;
|
|
207
|
+
onExitFullscreen?: () => void;
|
|
208
|
+
onPictureInPictureModeChanged?: (event: { isInPictureInPictureMode: boolean }) => void;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
211
|
export const VdoPropTypes = {
|
|
212
212
|
/* Native only */
|
|
213
213
|
onInitSuccess: PropTypes.func,
|
|
@@ -222,10 +222,6 @@ export const VdoPropTypes = {
|
|
|
222
222
|
onVdoTracksChanged: PropTypes.func,
|
|
223
223
|
onVdoMediaEnded: PropTypes.func,
|
|
224
224
|
onVdoError: PropTypes.func,
|
|
225
|
-
playbackProperties: PropTypes.number,
|
|
226
|
-
onVdoPlaybackProperties: PropTypes.func,
|
|
227
|
-
seek: PropTypes.number,
|
|
228
|
-
fullscreen: PropTypes.bool,
|
|
229
225
|
onVdoEnterFullscreen: PropTypes.func,
|
|
230
226
|
onVdoExitFullscreen: PropTypes.func,
|
|
231
227
|
onVdoPictureInPictureModeChanged: PropTypes.func,
|
|
@@ -298,8 +294,7 @@ export const VdoPropTypes = {
|
|
|
298
294
|
resizeMode: PropTypes.string,
|
|
299
295
|
}),
|
|
300
296
|
showNativeControls: PropTypes.bool,
|
|
301
|
-
|
|
302
|
-
playbackSpeed: PropTypes.number,
|
|
297
|
+
autoPlay: PropTypes.bool,
|
|
303
298
|
onInitializationSuccess: PropTypes.func,
|
|
304
299
|
onInitializationFailure: PropTypes.func,
|
|
305
300
|
onLoading: PropTypes.func,
|
|
@@ -312,7 +307,6 @@ export const VdoPropTypes = {
|
|
|
312
307
|
onTracksChanged: PropTypes.func,
|
|
313
308
|
onMediaEnded: PropTypes.func,
|
|
314
309
|
onError: PropTypes.func,
|
|
315
|
-
onPlaybackProperties: PropTypes.func,
|
|
316
310
|
onEnterFullscreen: PropTypes.func,
|
|
317
311
|
onExitFullscreen: PropTypes.func,
|
|
318
312
|
onPictureInPictureModeChanged: PropTypes.func,
|