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
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
package com.vdocipher.rnbridge;
|
|
2
|
+
|
|
3
|
+
import android.content.Intent;
|
|
4
|
+
import android.app.Activity;
|
|
5
|
+
|
|
6
|
+
import com.vdocipher.rnbridge.NativeVdocipherRnBridgeSpec;
|
|
7
|
+
import com.facebook.react.bridge.ReactApplicationContext;
|
|
8
|
+
import com.facebook.react.bridge.ReactContextBaseJavaModule;
|
|
9
|
+
import com.facebook.react.bridge.ReactMethod;
|
|
10
|
+
import com.facebook.react.bridge.ReadableMap;
|
|
11
|
+
import com.vdocipher.aegis.player.VdoInitParams;
|
|
12
|
+
|
|
13
|
+
import android.graphics.Color;
|
|
14
|
+
|
|
15
|
+
import static com.vdocipher.rnbridge.Utils.getTechOverride;
|
|
16
|
+
import java.util.HashMap;
|
|
17
|
+
import android.util.Log;
|
|
18
|
+
|
|
19
|
+
import com.vdocipher.rnbridge.VdocipherRnBridgeModuleImpl;
|
|
20
|
+
|
|
21
|
+
public class VdocipherRnBridgeModule extends NativeVdocipherRnBridgeSpec {
|
|
22
|
+
|
|
23
|
+
private final VdocipherRnBridgeModuleImpl vdocipherRnBridgeModuleImpl;
|
|
24
|
+
ReactApplicationContext context;
|
|
25
|
+
|
|
26
|
+
public VdocipherRnBridgeModule(ReactApplicationContext reactContext) {
|
|
27
|
+
super(reactContext);
|
|
28
|
+
context = reactContext;
|
|
29
|
+
vdocipherRnBridgeModuleImpl = new VdocipherRnBridgeModuleImpl(reactContext);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
@Override
|
|
33
|
+
public String getName() {
|
|
34
|
+
return VdocipherRnBridgeModuleImpl.NAME;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// todo error event handling
|
|
38
|
+
@Override
|
|
39
|
+
public void startVideoScreen(ReadableMap embedParams, boolean setPictureInPictureSupport) {
|
|
40
|
+
Activity currentActivity = context.getCurrentActivity();
|
|
41
|
+
vdocipherRnBridgeModuleImpl.startVideoScreen(embedParams, setPictureInPictureSupport, currentActivity);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
package com.vdocipher.rnbridge;
|
|
2
|
+
|
|
3
|
+
import android.util.Log;
|
|
4
|
+
import android.view.KeyEvent;
|
|
5
|
+
|
|
6
|
+
import com.facebook.react.bridge.ReadableMap;
|
|
7
|
+
import com.facebook.react.common.MapBuilder;
|
|
8
|
+
import com.facebook.react.uimanager.ThemedReactContext;
|
|
9
|
+
import com.facebook.react.uimanager.ViewGroupManager;
|
|
10
|
+
import com.facebook.react.uimanager.annotations.ReactProp;
|
|
11
|
+
import com.vdocipher.aegis.player.VdoInitParams;
|
|
12
|
+
import android.graphics.Color;
|
|
13
|
+
|
|
14
|
+
import java.util.Map;
|
|
15
|
+
|
|
16
|
+
import javax.annotation.Nullable;
|
|
17
|
+
import java.util.concurrent.CopyOnWriteArraySet;
|
|
18
|
+
|
|
19
|
+
import static com.vdocipher.rnbridge.Utils.getTechOverride;
|
|
20
|
+
|
|
21
|
+
import com.vdocipher.rnbridge.ReactVdoPlayerUIViewManagerImpl;
|
|
22
|
+
import com.facebook.react.bridge.ReactApplicationContext;
|
|
23
|
+
import com.facebook.react.bridge.ReadableArray;
|
|
24
|
+
|
|
25
|
+
public class ReactVdoPlayerUIViewManager extends ViewGroupManager<ReactVdoPlayerUIView> {
|
|
26
|
+
private static final String TAG = "RctVdoPlayerUIViewMngr";
|
|
27
|
+
private ReactVdoPlayerUIViewManagerImpl reactVdoPlayerUIViewManagerImpl;
|
|
28
|
+
|
|
29
|
+
private static final int COMMAND_PLAY = 1;
|
|
30
|
+
private static final int COMMAND_PAUSE = 2;
|
|
31
|
+
private static final int COMMAND_SEEK = 3;
|
|
32
|
+
private static final int COMMAND_ENTER_FULLSCREEN = 4;
|
|
33
|
+
private static final int COMMAND_EXIT_FULLSCREEN = 5;
|
|
34
|
+
private static final int COMMAND_HANDLE_BACK_PRESS = 6;
|
|
35
|
+
private static final int COMMAND_KEY_DOWN_EVENT = 7;
|
|
36
|
+
private static final int COMMAND_HANDLE_PLAYBACK_SPEED = 8;
|
|
37
|
+
private static final int COMMAND_DISABLE_CAPTIONS = 9;
|
|
38
|
+
private static final int COMMAND_ENABLE_ADAPTIVE_VIDEO = 10;
|
|
39
|
+
private static final int COMMAND_SET_VIDEO_QUALITY = 11;
|
|
40
|
+
private static final int COMMAND_SET_CAPTION_LANGUAGE = 12;
|
|
41
|
+
|
|
42
|
+
public ReactVdoPlayerUIViewManager(ReactApplicationContext context, PlayerViewRegistry registry) {
|
|
43
|
+
reactVdoPlayerUIViewManagerImpl = new ReactVdoPlayerUIViewManagerImpl(registry);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
@Override
|
|
47
|
+
public String getName() {
|
|
48
|
+
return ReactVdoPlayerUIViewManagerImpl.REACT_CLASS;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
@Override
|
|
52
|
+
public ReactVdoPlayerUIView createViewInstance(ThemedReactContext context) {
|
|
53
|
+
return reactVdoPlayerUIViewManagerImpl.createViewInstance(context);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
@Nullable
|
|
57
|
+
@Override
|
|
58
|
+
public Map<String, Object> getExportedCustomDirectEventTypeConstants() {
|
|
59
|
+
return reactVdoPlayerUIViewManagerImpl.getExportedCustomDirectEventTypeConstants();
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
@Override
|
|
63
|
+
public void onDropViewInstance(ReactVdoPlayerUIView view) {
|
|
64
|
+
reactVdoPlayerUIViewManagerImpl.onDropViewInstance(view);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
@Override
|
|
68
|
+
public Map<String, Integer> getCommandsMap() {
|
|
69
|
+
return MapBuilder.<String, Integer>builder()
|
|
70
|
+
.put("play", COMMAND_PLAY)
|
|
71
|
+
.put("pause", COMMAND_PAUSE)
|
|
72
|
+
.put("seek", COMMAND_SEEK)
|
|
73
|
+
.put("enterFullscreen", COMMAND_ENTER_FULLSCREEN)
|
|
74
|
+
.put("exitFullscreen", COMMAND_EXIT_FULLSCREEN)
|
|
75
|
+
.put("handleBackPress", COMMAND_HANDLE_BACK_PRESS)
|
|
76
|
+
.put("keyDownEvent", COMMAND_KEY_DOWN_EVENT)
|
|
77
|
+
.put("playbackSpeed", COMMAND_HANDLE_PLAYBACK_SPEED)
|
|
78
|
+
.put("disableCaptions", COMMAND_DISABLE_CAPTIONS)
|
|
79
|
+
.put("enableAdaptiveVideo", COMMAND_ENABLE_ADAPTIVE_VIDEO)
|
|
80
|
+
.put("setVideoQuality", COMMAND_SET_VIDEO_QUALITY)
|
|
81
|
+
.put("setCaptionLanguage", COMMAND_SET_CAPTION_LANGUAGE)
|
|
82
|
+
.build();
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
@Override
|
|
86
|
+
public void receiveCommand(
|
|
87
|
+
ReactVdoPlayerUIView view,
|
|
88
|
+
String commandId,
|
|
89
|
+
@Nullable ReadableArray args
|
|
90
|
+
) {
|
|
91
|
+
reactVdoPlayerUIViewManagerImpl.receiveCommand(view, commandId, args);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
@ReactProp(name = "embedInfo")
|
|
95
|
+
public void setEmbedInfo(ReactVdoPlayerUIView vdoPlayerView, @Nullable ReadableMap embedInfo) {
|
|
96
|
+
reactVdoPlayerUIViewManagerImpl.setEmbedInfo(vdoPlayerView, embedInfo);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
@ReactProp(name = "resizeMode")
|
|
100
|
+
public void setResizeMode(ReactVdoPlayerUIView vdoPlayerView, String resizeMode) {
|
|
101
|
+
reactVdoPlayerUIViewManagerImpl.setResizeMode(vdoPlayerView, resizeMode);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
@ReactProp(name = "aspectRatio")
|
|
105
|
+
public void setAspectRatio(ReactVdoPlayerUIView vdoPlayerView, float aspectRatio) {
|
|
106
|
+
reactVdoPlayerUIViewManagerImpl.setAspectRatio(vdoPlayerView, aspectRatio);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
@ReactProp(name = "autoPlay", defaultBoolean = true)
|
|
110
|
+
public void setAutoPlay(ReactVdoPlayerUIView vdoPlayerView, boolean autoPlay) {
|
|
111
|
+
reactVdoPlayerUIViewManagerImpl.setAutoPlay(vdoPlayerView, autoPlay);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
package com.vdocipher.rnbridge;
|
|
2
|
+
|
|
3
|
+
import android.util.Log;
|
|
4
|
+
|
|
5
|
+
import com.facebook.react.bridge.ReadableMap;
|
|
6
|
+
import com.facebook.react.common.MapBuilder;
|
|
7
|
+
import com.facebook.react.uimanager.ThemedReactContext;
|
|
8
|
+
import com.facebook.react.uimanager.ViewGroupManager;
|
|
9
|
+
import com.facebook.react.uimanager.annotations.ReactProp;
|
|
10
|
+
import com.vdocipher.aegis.player.VdoInitParams;
|
|
11
|
+
import com.vdocipher.aegis.media.Track;
|
|
12
|
+
import android.graphics.Color;
|
|
13
|
+
|
|
14
|
+
import java.util.Map;
|
|
15
|
+
|
|
16
|
+
import javax.annotation.Nullable;
|
|
17
|
+
import java.util.concurrent.CopyOnWriteArraySet;
|
|
18
|
+
|
|
19
|
+
import static com.vdocipher.rnbridge.Utils.getTechOverride;
|
|
20
|
+
import com.vdocipher.rnbridge.ReactVdoPlayerViewManagerImpl;
|
|
21
|
+
import com.facebook.react.bridge.ReactApplicationContext;
|
|
22
|
+
import com.facebook.react.bridge.ReadableArray;
|
|
23
|
+
|
|
24
|
+
public class ReactVdoPlayerViewManager extends ViewGroupManager<ReactVdoPlayerView> {
|
|
25
|
+
private static final String TAG = "ReactVdoPlayerViewMngr";
|
|
26
|
+
private ReactVdoPlayerViewManagerImpl reactVdoPlayerViewManagerImpl;
|
|
27
|
+
|
|
28
|
+
private static final int COMMAND_PLAY = 1;
|
|
29
|
+
private static final int COMMAND_PAUSE = 2;
|
|
30
|
+
private static final int COMMAND_SEEK = 3;
|
|
31
|
+
private static final int COMMAND_ENTER_FULLSCREEN = 4;
|
|
32
|
+
private static final int COMMAND_EXIT_FULLSCREEN = 5;
|
|
33
|
+
private static final int COMMAND_HANDLE_PLAYBACK_SPEED = 6;
|
|
34
|
+
private static final int COMMAND_DISABLE_CAPTIONS = 9;
|
|
35
|
+
private static final int COMMAND_ENABLE_ADAPTIVE_VIDEO = 10;
|
|
36
|
+
private static final int COMMAND_SET_VIDEO_QUALITY = 11;
|
|
37
|
+
private static final int COMMAND_SET_CAPTION_LANGUAGE = 12;
|
|
38
|
+
|
|
39
|
+
public ReactVdoPlayerViewManager(ReactApplicationContext context, PlayerViewRegistry registry) {
|
|
40
|
+
reactVdoPlayerViewManagerImpl = new ReactVdoPlayerViewManagerImpl(registry);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
@Override
|
|
44
|
+
public String getName() {
|
|
45
|
+
return ReactVdoPlayerViewManagerImpl.REACT_CLASS;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
@Override
|
|
49
|
+
public ReactVdoPlayerView createViewInstance(ThemedReactContext context) {
|
|
50
|
+
return reactVdoPlayerViewManagerImpl.createViewInstance(context);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
@Nullable
|
|
54
|
+
@Override
|
|
55
|
+
public Map<String, Object> getExportedCustomDirectEventTypeConstants() {
|
|
56
|
+
return reactVdoPlayerViewManagerImpl.getExportedCustomDirectEventTypeConstants();
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
@Override
|
|
60
|
+
public void onDropViewInstance(ReactVdoPlayerView view) {
|
|
61
|
+
reactVdoPlayerViewManagerImpl.onDropViewInstance(view);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
@Override
|
|
65
|
+
public Map<String, Integer> getCommandsMap() {
|
|
66
|
+
return MapBuilder.<String, Integer>builder()
|
|
67
|
+
.put("play", COMMAND_PLAY)
|
|
68
|
+
.put("pause", COMMAND_PAUSE)
|
|
69
|
+
.put("seek", COMMAND_SEEK)
|
|
70
|
+
.put("enterFullscreen", COMMAND_ENTER_FULLSCREEN)
|
|
71
|
+
.put("exitFullscreen", COMMAND_EXIT_FULLSCREEN)
|
|
72
|
+
.put("playbackSpeed", COMMAND_HANDLE_PLAYBACK_SPEED)
|
|
73
|
+
.put("disableCaptions", COMMAND_DISABLE_CAPTIONS)
|
|
74
|
+
.put("enableAdaptiveVideo", COMMAND_ENABLE_ADAPTIVE_VIDEO)
|
|
75
|
+
.put("setVideoQuality", COMMAND_SET_VIDEO_QUALITY)
|
|
76
|
+
.put("setCaptionLanguage", COMMAND_SET_CAPTION_LANGUAGE)
|
|
77
|
+
.build();
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
@Override
|
|
81
|
+
public void receiveCommand(
|
|
82
|
+
ReactVdoPlayerView view,
|
|
83
|
+
String commandId,
|
|
84
|
+
@Nullable ReadableArray args
|
|
85
|
+
) {
|
|
86
|
+
reactVdoPlayerViewManagerImpl.receiveCommand(view, commandId, args);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
@ReactProp(name = "embedInfo")
|
|
90
|
+
public void setEmbedInfo(ReactVdoPlayerView vdoPlayerView, @Nullable ReadableMap embedInfo) {
|
|
91
|
+
reactVdoPlayerViewManagerImpl.setEmbedInfo(vdoPlayerView, embedInfo);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
@ReactProp(name = "resizeMode")
|
|
95
|
+
public void setResizeMode(ReactVdoPlayerView vdoPlayerView, String resizeMode) {
|
|
96
|
+
reactVdoPlayerViewManagerImpl.setResizeMode(vdoPlayerView, resizeMode);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
@ReactProp(name = "aspectRatio")
|
|
100
|
+
public void setAspectRatio(ReactVdoPlayerView vdoPlayerView, float aspectRatio) {
|
|
101
|
+
reactVdoPlayerViewManagerImpl.setAspectRatio(vdoPlayerView, aspectRatio);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
@ReactProp(name = "autoPlay", defaultBoolean = true)
|
|
105
|
+
public void setAutoPlay(ReactVdoPlayerView vdoPlayerView, boolean autoPlay) {
|
|
106
|
+
reactVdoPlayerViewManagerImpl.setAutoPlay(vdoPlayerView, autoPlay);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
package com.vdocipher.rnbridge;
|
|
2
|
+
|
|
3
|
+
import com.facebook.react.bridge.ReactContextBaseJavaModule;
|
|
4
|
+
import com.facebook.react.bridge.ReactApplicationContext;
|
|
5
|
+
import com.facebook.react.bridge.ReactMethod;
|
|
6
|
+
import com.facebook.react.bridge.Callback;
|
|
7
|
+
import com.vdocipher.rnbridge.TrackSelectionModuleImpl;
|
|
8
|
+
|
|
9
|
+
public class TrackSelectionModule extends ReactContextBaseJavaModule{
|
|
10
|
+
private static final String TAG = "TrackSelectionModule";
|
|
11
|
+
|
|
12
|
+
private TrackSelectionModuleImpl trackSelectionModuleImpl;
|
|
13
|
+
|
|
14
|
+
@Override
|
|
15
|
+
public String getName() {
|
|
16
|
+
return TrackSelectionModuleImpl.NAME;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
public TrackSelectionModule(ReactApplicationContext reactContext, PlayerViewRegistry registry) {
|
|
20
|
+
super(reactContext);
|
|
21
|
+
trackSelectionModuleImpl = new TrackSelectionModuleImpl(reactContext, registry);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
@ReactMethod
|
|
25
|
+
public void isAdaptive(com.facebook.react.bridge.Callback callback) {
|
|
26
|
+
trackSelectionModuleImpl.isAdaptive(callback);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
@ReactMethod
|
|
30
|
+
public void getVideoQualities(com.facebook.react.bridge.Callback callback) {
|
|
31
|
+
trackSelectionModuleImpl.getVideoQualities(callback);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
@ReactMethod
|
|
35
|
+
public void getSelectedVideoQuality(com.facebook.react.bridge.Callback callback) {
|
|
36
|
+
trackSelectionModuleImpl.getSelectedVideoQuality(callback);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
@ReactMethod
|
|
40
|
+
public void getSelectedAudioQuality(com.facebook.react.bridge.Callback callback) {
|
|
41
|
+
trackSelectionModuleImpl.getSelectedAudioQuality(callback);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
@ReactMethod
|
|
45
|
+
public void getCaptionLanguages(com.facebook.react.bridge.Callback callback) {
|
|
46
|
+
trackSelectionModuleImpl.getCaptionLanguages(callback);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
@ReactMethod
|
|
50
|
+
public void getSelectedCaptionLanguage(com.facebook.react.bridge.Callback callback) {
|
|
51
|
+
trackSelectionModuleImpl.getSelectedCaptionLanguage(callback);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
@ReactMethod
|
|
55
|
+
public void getDuration(com.facebook.react.bridge.Callback callback) {
|
|
56
|
+
trackSelectionModuleImpl.getDuration(callback);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
}
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
package com.vdocipher.rnbridge;
|
|
2
|
+
|
|
3
|
+
import android.content.Context;
|
|
4
|
+
import android.util.Log;
|
|
5
|
+
|
|
6
|
+
import com.facebook.react.bridge.Arguments;
|
|
7
|
+
import com.facebook.react.bridge.Callback;
|
|
8
|
+
import com.facebook.react.bridge.ReactApplicationContext;
|
|
9
|
+
import com.facebook.react.bridge.ReactContext;
|
|
10
|
+
import com.facebook.react.bridge.ReactContextBaseJavaModule;
|
|
11
|
+
import com.facebook.react.bridge.ReadableArray;
|
|
12
|
+
import com.facebook.react.bridge.ReadableMap;
|
|
13
|
+
import com.facebook.react.bridge.WritableMap;
|
|
14
|
+
import com.facebook.react.modules.core.DeviceEventManagerModule;
|
|
15
|
+
import com.vdocipher.aegis.media.ErrorCodes;
|
|
16
|
+
import com.vdocipher.aegis.media.ErrorDescription;
|
|
17
|
+
import com.vdocipher.aegis.offline.DownloadOptions;
|
|
18
|
+
import com.vdocipher.aegis.offline.DownloadRequest;
|
|
19
|
+
import com.vdocipher.aegis.offline.DownloadSelections;
|
|
20
|
+
import com.vdocipher.aegis.offline.DownloadStatus;
|
|
21
|
+
import com.vdocipher.aegis.offline.OptionsDownloader;
|
|
22
|
+
import com.vdocipher.aegis.offline.VdoDownloadManager;
|
|
23
|
+
import com.facebook.react.bridge.ReactMethod;
|
|
24
|
+
|
|
25
|
+
import java.io.File;
|
|
26
|
+
import java.util.HashMap;
|
|
27
|
+
|
|
28
|
+
import javax.annotation.Nullable;
|
|
29
|
+
|
|
30
|
+
import android.os.Handler;
|
|
31
|
+
import android.os.Looper;
|
|
32
|
+
|
|
33
|
+
import static com.vdocipher.rnbridge.Utils.*;
|
|
34
|
+
import com.vdocipher.rnbridge.VdoDownloadModuleImpl;
|
|
35
|
+
import com.vdocipher.rnbridge.VdoDownloadModuleImpl.EnqueueFailureCallback;
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Exposes apis to:
|
|
39
|
+
* <p>
|
|
40
|
+
* <li>Fetch available download options for a video in your VdoCipher dashboard
|
|
41
|
+
* <li>Download media assets to local storage
|
|
42
|
+
* <li>Track download progress
|
|
43
|
+
* <li>Manage downloads (query or delete downloads)
|
|
44
|
+
*/
|
|
45
|
+
|
|
46
|
+
public class VdoDownloadModule extends ReactContextBaseJavaModule {
|
|
47
|
+
private static final String TAG = "VdoDownloadModule";
|
|
48
|
+
|
|
49
|
+
private VdoDownloadModuleImpl vdoDownloadModuleImpl;
|
|
50
|
+
private Handler mainHandler;
|
|
51
|
+
|
|
52
|
+
public VdoDownloadModule(ReactApplicationContext reactContext) {
|
|
53
|
+
super(reactContext);
|
|
54
|
+
vdoDownloadModuleImpl = new VdoDownloadModuleImpl(reactContext);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
@Override
|
|
58
|
+
public String getName() {
|
|
59
|
+
return VdoDownloadModuleImpl.NAME;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
@ReactMethod
|
|
63
|
+
public void addListener(String eventName) {
|
|
64
|
+
// Keep: Required for RN built in Event Emitter Calls.
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
@ReactMethod
|
|
68
|
+
public void removeListeners(Integer count) {
|
|
69
|
+
// Keep: Required for RN built in Event Emitter Calls.
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
@ReactMethod
|
|
73
|
+
public void getDownloadOptions(ReadableMap optionParams,
|
|
74
|
+
Callback errorCallback,
|
|
75
|
+
Callback successCallback) {
|
|
76
|
+
vdoDownloadModuleImpl.getDownloadOptions(optionParams, errorCallback, successCallback);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
@ReactMethod
|
|
80
|
+
public void enqueueDownload(String nativeId,
|
|
81
|
+
ReadableMap requestOptions,
|
|
82
|
+
Callback errorCallback,
|
|
83
|
+
Callback successCallback) {
|
|
84
|
+
enqueueDownload(nativeId, requestOptions, new EnqueueFailureCallback(errorCallback), successCallback);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
@ReactMethod
|
|
88
|
+
public void query(ReadableMap queryFilters,
|
|
89
|
+
Callback errorCallback,
|
|
90
|
+
Callback successCallback) {
|
|
91
|
+
vdoDownloadModuleImpl.query(queryFilters, errorCallback, successCallback);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
@ReactMethod
|
|
95
|
+
public void remove(ReadableArray deleteIds,
|
|
96
|
+
Callback errorCallback,
|
|
97
|
+
Callback successCallback) {
|
|
98
|
+
vdoDownloadModuleImpl.remove(deleteIds, errorCallback, successCallback);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
@ReactMethod
|
|
102
|
+
public void stop(ReadableArray stopIds,
|
|
103
|
+
Callback errorCallback,
|
|
104
|
+
Callback successCallback) {
|
|
105
|
+
vdoDownloadModuleImpl.stop(stopIds, errorCallback, successCallback);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
@ReactMethod
|
|
109
|
+
public void resume(ReadableArray resumeIds,
|
|
110
|
+
Callback errorCallback,
|
|
111
|
+
Callback successCallback) {
|
|
112
|
+
vdoDownloadModuleImpl.resume(resumeIds, errorCallback, successCallback);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
@ReactMethod
|
|
116
|
+
public void isExpired(String mediaId,
|
|
117
|
+
Callback errorCallback,
|
|
118
|
+
Callback successCallback) {
|
|
119
|
+
vdoDownloadModuleImpl.isExpired(mediaId, errorCallback, successCallback);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
// Private
|
|
124
|
+
|
|
125
|
+
private void enqueueDownload(String nativeId,
|
|
126
|
+
ReadableMap requestOptions,
|
|
127
|
+
EnqueueFailureCallback errorCallback,
|
|
128
|
+
Callback successCallback) {
|
|
129
|
+
vdoDownloadModuleImpl.enqueueDownload(nativeId, requestOptions, errorCallback, successCallback);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
package com.vdocipher.rnbridge;
|
|
2
|
+
|
|
3
|
+
import com.facebook.react.bridge.ReactContextBaseJavaModule;
|
|
4
|
+
import com.facebook.react.bridge.ReactApplicationContext;
|
|
5
|
+
import com.facebook.react.bridge.ReactMethod;
|
|
6
|
+
import com.facebook.react.bridge.Callback;
|
|
7
|
+
import com.vdocipher.rnbridge.VdoPlayerModuleImpl;
|
|
8
|
+
|
|
9
|
+
public class VdoPlayerModule extends ReactContextBaseJavaModule {
|
|
10
|
+
private static final String TAG = "VdoPlayerModule";
|
|
11
|
+
|
|
12
|
+
private VdoPlayerModuleImpl vdoPlayerModuleImpl;
|
|
13
|
+
|
|
14
|
+
@Override
|
|
15
|
+
public String getName() {
|
|
16
|
+
return VdoPlayerModuleImpl.NAME;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
public VdoPlayerModule(ReactApplicationContext reactContext, PlayerViewRegistry registry) {
|
|
20
|
+
super(reactContext);
|
|
21
|
+
vdoPlayerModuleImpl = new VdoPlayerModuleImpl(reactContext, registry);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
@ReactMethod()
|
|
25
|
+
public void getPlaybackPropertiesV2(com.facebook.react.bridge.Callback callback) {
|
|
26
|
+
vdoPlayerModuleImpl.getPlaybackPropertiesV2(callback);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
package com.vdocipher.rnbridge;
|
|
2
|
+
|
|
3
|
+
import com.facebook.react.bridge.ReactContextBaseJavaModule;
|
|
4
|
+
import com.facebook.react.bridge.ReactApplicationContext;
|
|
5
|
+
import com.facebook.react.bridge.ReactMethod;
|
|
6
|
+
import com.facebook.react.bridge.ReadableMap;
|
|
7
|
+
import com.facebook.react.bridge.Callback;
|
|
8
|
+
import android.util.Log;
|
|
9
|
+
import com.facebook.react.uimanager.annotations.ReactProp;
|
|
10
|
+
import com.vdocipher.aegis.player.VdoPlayerSetting;
|
|
11
|
+
import static com.vdocipher.rnbridge.Utils.*;
|
|
12
|
+
import static com.vdocipher.rnbridge.Constants.VDO_SHARED_PREFS;
|
|
13
|
+
import static com.vdocipher.rnbridge.Constants.VDO_PLAYBACK_MODE;
|
|
14
|
+
|
|
15
|
+
import android.content.Context;
|
|
16
|
+
import android.content.SharedPreferences;
|
|
17
|
+
import com.vdocipher.rnbridge.VdoPlayerSettingsModuleImpl;
|
|
18
|
+
|
|
19
|
+
public class VdoPlayerSettingsModule extends ReactContextBaseJavaModule {
|
|
20
|
+
private static final String TAG = "VdoPlayerSettingsModule";
|
|
21
|
+
|
|
22
|
+
private VdoPlayerSettingsModuleImpl vdoPlayerSettingsModuleImpl;
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
public VdoPlayerSettingsModule(ReactApplicationContext reactContext) {
|
|
26
|
+
super(reactContext);
|
|
27
|
+
vdoPlayerSettingsModuleImpl = new VdoPlayerSettingsModuleImpl(reactContext);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
@Override
|
|
31
|
+
public String getName() {
|
|
32
|
+
return VdoPlayerSettingsModuleImpl.NAME;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
@ReactMethod()
|
|
36
|
+
public void applySettings(ReadableMap playerSettings) {
|
|
37
|
+
vdoPlayerSettingsModuleImpl.applySettings(playerSettings);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
package com.vdocipher.rnbridge;
|
|
2
|
+
|
|
3
|
+
import com.facebook.react.bridge.ReactContextBaseJavaModule;
|
|
4
|
+
import com.facebook.react.bridge.ReactApplicationContext;
|
|
5
|
+
import com.facebook.react.bridge.ReactMethod;
|
|
6
|
+
import com.facebook.react.bridge.ReadableMap;
|
|
7
|
+
import com.facebook.react.bridge.Callback;
|
|
8
|
+
import android.util.Log;
|
|
9
|
+
import com.facebook.react.uimanager.annotations.ReactProp;
|
|
10
|
+
import com.vdocipher.aegis.player.cache.Config;
|
|
11
|
+
import com.vdocipher.aegis.player.cache.VdoPreCacheManager;
|
|
12
|
+
import android.content.Context;
|
|
13
|
+
import android.content.SharedPreferences;
|
|
14
|
+
import com.vdocipher.rnbridge.VdoPreCacheManagerModuleImpl;
|
|
15
|
+
|
|
16
|
+
public class VdoPreCacheManagerModule extends ReactContextBaseJavaModule {
|
|
17
|
+
private static final String TAG = "VdoPlayerSettingsModule";
|
|
18
|
+
private VdoPreCacheManagerModuleImpl vdoPreCacheManagerModuleImpl;
|
|
19
|
+
|
|
20
|
+
@Override
|
|
21
|
+
public String getName() {
|
|
22
|
+
return VdoPreCacheManagerModuleImpl.NAME;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
public VdoPreCacheManagerModule(ReactApplicationContext reactContext) {
|
|
26
|
+
super(reactContext);
|
|
27
|
+
vdoPreCacheManagerModuleImpl = new VdoPreCacheManagerModuleImpl(reactContext);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
@ReactMethod()
|
|
31
|
+
public void cacheVideo(ReadableMap preCacheSettings) {
|
|
32
|
+
vdoPreCacheManagerModuleImpl.cacheVideo(preCacheSettings);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
@ReactMethod()
|
|
36
|
+
public void clearCache() {
|
|
37
|
+
vdoPreCacheManagerModuleImpl.clearCache();
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
package com.vdocipher.rnbridge;
|
|
2
|
+
|
|
3
|
+
import android.content.Intent;
|
|
4
|
+
import android.app.Activity;
|
|
5
|
+
|
|
6
|
+
import com.facebook.react.bridge.ReactApplicationContext;
|
|
7
|
+
import com.facebook.react.bridge.ReactContextBaseJavaModule;
|
|
8
|
+
import com.facebook.react.bridge.ReactMethod;
|
|
9
|
+
import com.facebook.react.bridge.ReadableMap;
|
|
10
|
+
import com.vdocipher.aegis.player.VdoInitParams;
|
|
11
|
+
|
|
12
|
+
import android.graphics.Color;
|
|
13
|
+
|
|
14
|
+
import static com.vdocipher.rnbridge.Utils.getTechOverride;
|
|
15
|
+
import java.util.HashMap;
|
|
16
|
+
import com.vdocipher.rnbridge.VdocipherRnBridgeModuleImpl;
|
|
17
|
+
|
|
18
|
+
public class VdocipherRnBridgeModule extends ReactContextBaseJavaModule {
|
|
19
|
+
|
|
20
|
+
private final VdocipherRnBridgeModuleImpl vdocipherRnBridgeModuleImpl;
|
|
21
|
+
ReactApplicationContext context;
|
|
22
|
+
|
|
23
|
+
public VdocipherRnBridgeModule(ReactApplicationContext reactContext) {
|
|
24
|
+
super(reactContext);
|
|
25
|
+
context = reactContext;
|
|
26
|
+
vdocipherRnBridgeModuleImpl = new VdocipherRnBridgeModuleImpl(reactContext);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
@Override
|
|
30
|
+
public String getName() {
|
|
31
|
+
return VdocipherRnBridgeModuleImpl.NAME;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
// todo error event handling
|
|
35
|
+
@ReactMethod
|
|
36
|
+
public void startVideoScreen(ReadableMap embedParams, boolean setPictureInPictureSupport) {
|
|
37
|
+
Activity currentActivity = context.getCurrentActivity();
|
|
38
|
+
vdocipherRnBridgeModuleImpl.startVideoScreen(embedParams, setPictureInPictureSupport, currentActivity);
|
|
39
|
+
}
|
|
40
|
+
}
|
package/downloads.ts
CHANGED
|
@@ -12,9 +12,9 @@ import * as VdoTypes from './type';
|
|
|
12
12
|
|
|
13
13
|
const { VdoDownload } = NativeModules;
|
|
14
14
|
|
|
15
|
-
const getDownloadOptions = (optionParams: VdoTypes.OfflineOptionParams) => {
|
|
15
|
+
const getDownloadOptions = (optionParams: VdoTypes.OfflineOptionParams): Promise<VdoTypes.DownloadOptionsResult> => {
|
|
16
16
|
|
|
17
|
-
return new Promise(function(resolve, reject) {
|
|
17
|
+
return new Promise<VdoTypes.DownloadOptionsResult>(function(resolve, reject) {
|
|
18
18
|
VdoDownload.getDownloadOptions(
|
|
19
19
|
optionParams,
|
|
20
20
|
(errorDescription: {errorCode: number, errorMsg: string, httpStatusCode: number}) => {
|
|
@@ -30,7 +30,7 @@ const getDownloadOptions = (optionParams: VdoTypes.OfflineOptionParams) => {
|
|
|
30
30
|
});
|
|
31
31
|
};
|
|
32
32
|
|
|
33
|
-
const getEnqueueFn = (nativeId: string) => (downloadOptions:
|
|
33
|
+
const getEnqueueFn = (nativeId: string) => (downloadOptions: VdoTypes.EnqueueSelections): Promise<void> => {
|
|
34
34
|
|
|
35
35
|
|
|
36
36
|
return new Promise<void>(function(resolve, reject) {
|
|
@@ -52,10 +52,10 @@ const getEnqueueFn = (nativeId: string) => (downloadOptions: {selections: Array<
|
|
|
52
52
|
});
|
|
53
53
|
};
|
|
54
54
|
|
|
55
|
-
const query = (queryFilters:
|
|
55
|
+
const query = (queryFilters: VdoTypes.QueryFilters): Promise<Array<VdoTypes.DownloadStatus>> => {
|
|
56
56
|
|
|
57
57
|
|
|
58
|
-
return new Promise(function(resolve, reject) {
|
|
58
|
+
return new Promise<Array<VdoTypes.DownloadStatus>>(function(resolve, reject) {
|
|
59
59
|
VdoDownload.query(
|
|
60
60
|
queryFilters,
|
|
61
61
|
(exception: string, msg: string) => {
|
package/ios/RCTVdoPlayerUIView.h
CHANGED
|
@@ -5,15 +5,15 @@
|
|
|
5
5
|
// Created by Manish Gupta on 22/05/23.
|
|
6
6
|
//
|
|
7
7
|
|
|
8
|
-
|
|
9
8
|
#import "VdoCipherRNView.h"
|
|
10
9
|
|
|
11
10
|
#ifndef RCTVdoPlayerUIView_h
|
|
12
11
|
#define RCTVdoPlayerUIView_h
|
|
13
12
|
|
|
14
|
-
|
|
15
|
-
#endif /* RCTVdoPlayerUIView_h */
|
|
16
|
-
|
|
17
13
|
@interface RCTVdoPlayerUIView : VdoCipherRNView
|
|
18
14
|
|
|
15
|
+
- (void)setFullscreen:(BOOL)val;
|
|
16
|
+
|
|
19
17
|
@end
|
|
18
|
+
|
|
19
|
+
#endif /* RCTVdoPlayerUIView_h */
|
|
@@ -16,8 +16,9 @@ class RCTVdoPlayerUIView: VdoCipherRNView {
|
|
|
16
16
|
var activityView: UIActivityIndicatorView?
|
|
17
17
|
|
|
18
18
|
override func setEmbedInfo(_ embedInfo: [String: Any]) {
|
|
19
|
+
guard shouldApplyEmbedInfo(embedInfo) else { return }
|
|
19
20
|
super.setEmbedInfo(embedInfo)
|
|
20
|
-
|
|
21
|
+
|
|
21
22
|
EventEmitter.sharedInstance.dispatch(name: EventName.EVENT_LOADING, params: nil)
|
|
22
23
|
if embedInfo["offline"] as? Bool == true {
|
|
23
24
|
self.parseOfflineCredentials(fromInfo: embedInfo)
|