vdocipher-rn-bridge 1.22.7 → 2.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/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/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 +44 -8
- 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 +4 -15
- 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
|
@@ -3,11 +3,11 @@ import AVKit
|
|
|
3
3
|
import VdoFramework
|
|
4
4
|
|
|
5
5
|
@objc(VdocipherRnBridge)
|
|
6
|
-
class VdocipherRnBridge:
|
|
6
|
+
class VdocipherRnBridge: NSObject {
|
|
7
7
|
|
|
8
|
-
static let vdocipherRnBridgeVersionString = "
|
|
9
|
-
|
|
10
|
-
@objc
|
|
8
|
+
static let vdocipherRnBridgeVersionString = "2.0.1"
|
|
9
|
+
|
|
10
|
+
@objc static func requiresMainQueueSetup() -> Bool {
|
|
11
11
|
return true
|
|
12
12
|
}
|
|
13
13
|
|
package/package.json
CHANGED
|
@@ -1,10 +1,30 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vdocipher-rn-bridge",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.1",
|
|
4
4
|
"description": "React native bridge library that delegates to vdocipher native android SDK",
|
|
5
5
|
"homepage": "https://www.vdocipher.com/docs/mobile/react-native/getting-started/",
|
|
6
6
|
"scripts": {
|
|
7
|
-
"test": "
|
|
7
|
+
"test": "jest",
|
|
8
|
+
"test:watch": "jest --watch",
|
|
9
|
+
"typecheck": "tsc --noEmit"
|
|
10
|
+
},
|
|
11
|
+
"jest": {
|
|
12
|
+
"testEnvironment": "node",
|
|
13
|
+
"testMatch": [
|
|
14
|
+
"**/__tests__/**/*.test.(ts|tsx)"
|
|
15
|
+
],
|
|
16
|
+
"transform": {
|
|
17
|
+
"^.+\\.(ts|tsx|js|jsx)$": "babel-jest"
|
|
18
|
+
},
|
|
19
|
+
"moduleFileExtensions": [
|
|
20
|
+
"ts",
|
|
21
|
+
"tsx",
|
|
22
|
+
"js",
|
|
23
|
+
"jsx"
|
|
24
|
+
],
|
|
25
|
+
"transformIgnorePatterns": [
|
|
26
|
+
"node_modules/(?!((jest-)?react-native|@react-native(-community)?|@testing-library)/)"
|
|
27
|
+
]
|
|
8
28
|
},
|
|
9
29
|
"keywords": [
|
|
10
30
|
"react-native"
|
|
@@ -12,7 +32,7 @@
|
|
|
12
32
|
"author": "",
|
|
13
33
|
"license": "",
|
|
14
34
|
"peerDependencies": {
|
|
15
|
-
"react-native": "0.
|
|
35
|
+
"react-native": "0.80 - 0.86"
|
|
16
36
|
},
|
|
17
37
|
"dependencies": {
|
|
18
38
|
"deprecated-react-native-prop-types": "^5.0.0",
|
|
@@ -22,6 +42,7 @@
|
|
|
22
42
|
"android/build.gradle",
|
|
23
43
|
"android/src",
|
|
24
44
|
"ios",
|
|
45
|
+
"specs",
|
|
25
46
|
"VdoPlayerView.tsx",
|
|
26
47
|
"VdoPlayerSupportView.tsx",
|
|
27
48
|
"VdoPlayerUIView.tsx",
|
|
@@ -34,6 +55,10 @@
|
|
|
34
55
|
"navigationHelper.ts"
|
|
35
56
|
],
|
|
36
57
|
"devDependencies": {
|
|
58
|
+
"@babel/preset-env": "^7.29.2",
|
|
59
|
+
"@babel/preset-react": "^7.28.5",
|
|
60
|
+
"@babel/preset-typescript": "^7.28.5",
|
|
61
|
+
"@testing-library/react-native": "^13.3.3",
|
|
37
62
|
"@tsconfig/react-native": "^3.0.7",
|
|
38
63
|
"@types/jest": "^30.0.0",
|
|
39
64
|
"@types/node": "^18.11.18",
|
|
@@ -41,6 +66,24 @@
|
|
|
41
66
|
"@types/react": "19.2.2",
|
|
42
67
|
"@types/react-native": "0.73.0",
|
|
43
68
|
"@types/react-test-renderer": "^19.1.0",
|
|
69
|
+
"jest": "^30.3.0",
|
|
70
|
+
"metro-react-native-babel-preset": "^0.77.0",
|
|
71
|
+
"prettier": "^3.8.2",
|
|
72
|
+
"react-test-renderer": "^19.2.5",
|
|
44
73
|
"typescript": "^5.9.3"
|
|
74
|
+
},
|
|
75
|
+
"codegenConfig": {
|
|
76
|
+
"name": "VdocipherRnBridgeSpecs",
|
|
77
|
+
"type": "all",
|
|
78
|
+
"jsSrcsDir": "specs",
|
|
79
|
+
"android": {
|
|
80
|
+
"javaPackageName": "com.vdocipher.rnbridge"
|
|
81
|
+
},
|
|
82
|
+
"ios": {
|
|
83
|
+
"componentProvider": {
|
|
84
|
+
"VdoPlayerUIView": "RCTVdoPlayerUIViewComponentView",
|
|
85
|
+
"VdoPlayerView": "RCTVdoPlayerViewComponentView"
|
|
86
|
+
}
|
|
87
|
+
}
|
|
45
88
|
}
|
|
46
89
|
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
require "json"
|
|
2
2
|
|
|
3
3
|
package = JSON.parse(File.read(File.join(__dir__, "package.json")))
|
|
4
|
-
folly_compiler_flags = '-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -Wno-comma -Wno-shorten-64-to-32'
|
|
5
4
|
|
|
6
5
|
Pod::Spec.new do |s|
|
|
7
6
|
s.name = "react-native-vdocipher-rn-bridge"
|
|
@@ -17,24 +16,14 @@ Pod::Spec.new do |s|
|
|
|
17
16
|
s.source_files = "ios/**/*.{h,m,mm,swift}"
|
|
18
17
|
|
|
19
18
|
s.dependency "React-Core"
|
|
20
|
-
s.dependency "VdoFramework", "2.9.
|
|
19
|
+
s.dependency "VdoFramework", "2.9.4"
|
|
21
20
|
|
|
22
|
-
#
|
|
21
|
+
# New arch only; -DFOLLY_CFG_NO_COROUTINES=1 keeps folly off coroutines under C++20 (RN ships no folly/coro headers).
|
|
23
22
|
if ENV['RCT_NEW_ARCH_ENABLED'] == '1' then
|
|
24
|
-
s.
|
|
25
|
-
s.pod_target_xcconfig = {
|
|
23
|
+
s.pod_target_xcconfig = {
|
|
26
24
|
"HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/boost\"",
|
|
27
|
-
"
|
|
25
|
+
"OTHER_CPLUSPLUSFLAGS" => "$(inherited) -DFOLLY_CFG_NO_COROUTINES=1"
|
|
28
26
|
}
|
|
29
|
-
|
|
30
|
-
if respond_to?(:install_modules_dependencies, true)
|
|
31
27
|
install_modules_dependencies(s)
|
|
32
|
-
else
|
|
33
|
-
s.dependency "React-Codegen"
|
|
34
|
-
s.dependency "RCT-Folly"
|
|
35
|
-
s.dependency "RCTRequired"
|
|
36
|
-
s.dependency "RCTTypeSafety"
|
|
37
|
-
s.dependency "ReactCommon/turbomodule/core"
|
|
38
|
-
end
|
|
39
28
|
end
|
|
40
29
|
end
|
|
@@ -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. */
|