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,195 @@
|
|
|
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
|
+
import androidx.annotation.NonNull;
|
|
14
|
+
|
|
15
|
+
import java.util.Map;
|
|
16
|
+
|
|
17
|
+
import javax.annotation.Nullable;
|
|
18
|
+
import java.util.concurrent.CopyOnWriteArraySet;
|
|
19
|
+
|
|
20
|
+
import com.facebook.react.uimanager.ViewManagerDelegate;
|
|
21
|
+
import com.facebook.react.viewmanagers.VdoPlayerUIViewManagerInterface;
|
|
22
|
+
import com.facebook.react.viewmanagers.VdoPlayerUIViewManagerDelegate;
|
|
23
|
+
|
|
24
|
+
import static com.vdocipher.rnbridge.Utils.getTechOverride;
|
|
25
|
+
import com.facebook.react.module.annotations.ReactModule;
|
|
26
|
+
import com.facebook.react.bridge.ReactApplicationContext;
|
|
27
|
+
|
|
28
|
+
import com.vdocipher.rnbridge.ReactVdoPlayerUIViewManagerImpl;
|
|
29
|
+
import com.facebook.react.bridge.ReadableArray;
|
|
30
|
+
import com.facebook.react.bridge.Arguments;
|
|
31
|
+
import com.facebook.react.bridge.WritableArray;
|
|
32
|
+
|
|
33
|
+
@ReactModule(name = ReactVdoPlayerUIViewManagerImpl.NEW_ARCH_REACT_CLASS)
|
|
34
|
+
public class ReactVdoPlayerUIViewManager extends ViewGroupManager<ReactVdoPlayerUIView>
|
|
35
|
+
implements VdoPlayerUIViewManagerInterface<ReactVdoPlayerUIView> {
|
|
36
|
+
private static final String TAG = "RctVdoPlayerUIViewMngr";
|
|
37
|
+
private ReactVdoPlayerUIViewManagerImpl reactVdoPlayerUIViewManagerImpl;
|
|
38
|
+
|
|
39
|
+
private static final int COMMAND_PLAY = 1;
|
|
40
|
+
private static final int COMMAND_PAUSE = 2;
|
|
41
|
+
private static final int COMMAND_SEEK = 3;
|
|
42
|
+
private static final int COMMAND_ENTER_FULLSCREEN = 4;
|
|
43
|
+
private static final int COMMAND_EXIT_FULLSCREEN = 5;
|
|
44
|
+
private static final int COMMAND_HANDLE_BACK_PRESS = 6;
|
|
45
|
+
private static final int COMMAND_KEY_DOWN_EVENT = 7;
|
|
46
|
+
private static final int COMMAND_HANDLE_PLAYBACK_SPEED = 8;
|
|
47
|
+
private static final int COMMAND_DISABLE_CAPTIONS = 9;
|
|
48
|
+
private static final int COMMAND_ENABLE_ADAPTIVE_VIDEO = 10;
|
|
49
|
+
private static final int COMMAND_SET_VIDEO_QUALITY = 11;
|
|
50
|
+
private static final int COMMAND_SET_CAPTION_LANGUAGE = 12;
|
|
51
|
+
|
|
52
|
+
private final ViewManagerDelegate<ReactVdoPlayerUIView> mDelegate;
|
|
53
|
+
|
|
54
|
+
public ReactVdoPlayerUIViewManager(ReactApplicationContext context, PlayerViewRegistry registry) {
|
|
55
|
+
mDelegate = new VdoPlayerUIViewManagerDelegate<>(this);
|
|
56
|
+
reactVdoPlayerUIViewManagerImpl = new ReactVdoPlayerUIViewManagerImpl(registry);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
@Nullable
|
|
60
|
+
@Override
|
|
61
|
+
protected ViewManagerDelegate<ReactVdoPlayerUIView> getDelegate() {
|
|
62
|
+
return mDelegate;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
@NonNull
|
|
66
|
+
@Override
|
|
67
|
+
public String getName() {
|
|
68
|
+
return ReactVdoPlayerUIViewManagerImpl.NEW_ARCH_REACT_CLASS;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
@NonNull
|
|
72
|
+
@Override
|
|
73
|
+
public ReactVdoPlayerUIView createViewInstance(ThemedReactContext context) {
|
|
74
|
+
return reactVdoPlayerUIViewManagerImpl.createViewInstance(context);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
@Nullable
|
|
78
|
+
@Override
|
|
79
|
+
public Map<String, Object> getExportedCustomDirectEventTypeConstants() {
|
|
80
|
+
return reactVdoPlayerUIViewManagerImpl.getExportedCustomDirectEventTypeConstants();
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
@Override
|
|
84
|
+
public void onDropViewInstance(ReactVdoPlayerUIView view) {
|
|
85
|
+
reactVdoPlayerUIViewManagerImpl.onDropViewInstance(view);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
@Override
|
|
89
|
+
public Map<String, Integer> getCommandsMap() {
|
|
90
|
+
return MapBuilder.<String, Integer>builder()
|
|
91
|
+
.put("play", COMMAND_PLAY)
|
|
92
|
+
.put("pause", COMMAND_PAUSE)
|
|
93
|
+
.put("seek", COMMAND_SEEK)
|
|
94
|
+
.put("enterFullscreen", COMMAND_ENTER_FULLSCREEN)
|
|
95
|
+
.put("exitFullscreen", COMMAND_EXIT_FULLSCREEN)
|
|
96
|
+
.put("handleBackPress", COMMAND_HANDLE_BACK_PRESS)
|
|
97
|
+
.put("keyDownEvent", COMMAND_KEY_DOWN_EVENT)
|
|
98
|
+
.put("playbackSpeed", COMMAND_HANDLE_PLAYBACK_SPEED)
|
|
99
|
+
.put("disableCaptions", COMMAND_DISABLE_CAPTIONS)
|
|
100
|
+
.put("enableAdaptiveVideo", COMMAND_ENABLE_ADAPTIVE_VIDEO)
|
|
101
|
+
.put("setVideoQuality", COMMAND_SET_VIDEO_QUALITY)
|
|
102
|
+
.put("setCaptionLanguage", COMMAND_SET_CAPTION_LANGUAGE)
|
|
103
|
+
.build();
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
@Override
|
|
107
|
+
public void receiveCommand(
|
|
108
|
+
ReactVdoPlayerUIView view,
|
|
109
|
+
String commandId,
|
|
110
|
+
@Nullable ReadableArray args) {
|
|
111
|
+
reactVdoPlayerUIViewManagerImpl.receiveCommand(view, commandId, args);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
@Override
|
|
115
|
+
@ReactProp(name = "embedInfo")
|
|
116
|
+
public void setEmbedInfo(ReactVdoPlayerUIView vdoPlayerView, @Nullable ReadableMap embedInfo) {
|
|
117
|
+
reactVdoPlayerUIViewManagerImpl.setEmbedInfo(vdoPlayerView, embedInfo);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
@Override
|
|
121
|
+
@ReactProp(name = "resizeMode")
|
|
122
|
+
public void setResizeMode(ReactVdoPlayerUIView vdoPlayerView, String resizeMode) {
|
|
123
|
+
reactVdoPlayerUIViewManagerImpl.setResizeMode(vdoPlayerView, resizeMode);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
@Override
|
|
127
|
+
@ReactProp(name = "aspectRatio")
|
|
128
|
+
public void setAspectRatio(ReactVdoPlayerUIView vdoPlayerView, float aspectRatio) {
|
|
129
|
+
reactVdoPlayerUIViewManagerImpl.setAspectRatio(vdoPlayerView, aspectRatio);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
@Override
|
|
133
|
+
@ReactProp(name = "autoPlay")
|
|
134
|
+
public void setAutoPlay(ReactVdoPlayerUIView vdoPlayerView, boolean autoPlay) {
|
|
135
|
+
reactVdoPlayerUIViewManagerImpl.setAutoPlay(vdoPlayerView, autoPlay);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
public void play(ReactVdoPlayerUIView view) {
|
|
139
|
+
reactVdoPlayerUIViewManagerImpl.receiveCommand(view, "play", null);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
public void pause(ReactVdoPlayerUIView view) {
|
|
143
|
+
reactVdoPlayerUIViewManagerImpl.receiveCommand(view, "pause", null);
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
public void seek(ReactVdoPlayerUIView view, int seekTargetMs) {
|
|
147
|
+
WritableArray args = Arguments.createArray();
|
|
148
|
+
args.pushInt(seekTargetMs);
|
|
149
|
+
reactVdoPlayerUIViewManagerImpl.receiveCommand(view, "seek", args);
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
public void enterFullscreen(ReactVdoPlayerUIView view) {
|
|
153
|
+
reactVdoPlayerUIViewManagerImpl.receiveCommand(view, "enterFullscreen", null);
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
public void exitFullscreen(ReactVdoPlayerUIView view) {
|
|
157
|
+
reactVdoPlayerUIViewManagerImpl.receiveCommand(view, "exitFullscreen", null);
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
public void playbackSpeed(ReactVdoPlayerUIView view, double speed) {
|
|
161
|
+
WritableArray args = Arguments.createArray();
|
|
162
|
+
args.pushDouble(speed);
|
|
163
|
+
reactVdoPlayerUIViewManagerImpl.receiveCommand(view, "playbackSpeed", args);
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
public void disableCaptions(ReactVdoPlayerUIView view) {
|
|
167
|
+
reactVdoPlayerUIViewManagerImpl.receiveCommand(view, "disableCaptions", null);
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
public void enableAdaptiveVideo(ReactVdoPlayerUIView view) {
|
|
171
|
+
reactVdoPlayerUIViewManagerImpl.receiveCommand(view, "enableAdaptiveVideo", null);
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
public void setVideoQuality(ReactVdoPlayerUIView view, String track) {
|
|
175
|
+
WritableArray args = Arguments.createArray();
|
|
176
|
+
args.pushString(track);
|
|
177
|
+
reactVdoPlayerUIViewManagerImpl.receiveCommand(view, "setVideoQuality", args);
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
public void setCaptionLanguage(ReactVdoPlayerUIView view, String caption) {
|
|
181
|
+
WritableArray args = Arguments.createArray();
|
|
182
|
+
args.pushString(caption);
|
|
183
|
+
reactVdoPlayerUIViewManagerImpl.receiveCommand(view, "setCaptionLanguage", args);
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
// Required by the generated interface; iOS-only behaviour, so these no-op on Android.
|
|
187
|
+
public void setScreenFocused(ReactVdoPlayerUIView view) {
|
|
188
|
+
reactVdoPlayerUIViewManagerImpl.receiveCommand(view, "setScreenFocused", null);
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
public void setScreenBlurred(ReactVdoPlayerUIView view) {
|
|
192
|
+
reactVdoPlayerUIViewManagerImpl.receiveCommand(view, "setScreenBlurred", null);
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
}
|
|
@@ -0,0 +1,174 @@
|
|
|
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
|
+
import androidx.annotation.NonNull;
|
|
14
|
+
|
|
15
|
+
import java.util.Map;
|
|
16
|
+
|
|
17
|
+
import javax.annotation.Nullable;
|
|
18
|
+
import java.util.concurrent.CopyOnWriteArraySet;
|
|
19
|
+
|
|
20
|
+
import com.facebook.react.uimanager.ViewManagerDelegate;
|
|
21
|
+
import com.facebook.react.viewmanagers.VdoPlayerViewManagerInterface;
|
|
22
|
+
import com.facebook.react.viewmanagers.VdoPlayerViewManagerDelegate;
|
|
23
|
+
|
|
24
|
+
import static com.vdocipher.rnbridge.Utils.getTechOverride;
|
|
25
|
+
import com.facebook.react.module.annotations.ReactModule;
|
|
26
|
+
import com.facebook.react.bridge.ReactApplicationContext;
|
|
27
|
+
|
|
28
|
+
import com.vdocipher.rnbridge.ReactVdoPlayerViewManagerImpl;
|
|
29
|
+
import com.facebook.react.bridge.ReadableArray;
|
|
30
|
+
import com.facebook.react.bridge.Arguments;
|
|
31
|
+
import com.facebook.react.bridge.WritableArray;
|
|
32
|
+
|
|
33
|
+
@ReactModule(name = ReactVdoPlayerViewManagerImpl.NEW_ARCH_REACT_CLASS)
|
|
34
|
+
public class ReactVdoPlayerViewManager extends ViewGroupManager<ReactVdoPlayerView>
|
|
35
|
+
implements VdoPlayerViewManagerInterface<ReactVdoPlayerView> {
|
|
36
|
+
private static final String TAG = "ReactVdoPlayerViewMngr";
|
|
37
|
+
private ReactVdoPlayerViewManagerImpl reactVdoPlayerViewManagerImpl;
|
|
38
|
+
|
|
39
|
+
private static final int COMMAND_PLAY = 1;
|
|
40
|
+
private static final int COMMAND_PAUSE = 2;
|
|
41
|
+
private static final int COMMAND_SEEK = 3;
|
|
42
|
+
private static final int COMMAND_ENTER_FULLSCREEN = 4;
|
|
43
|
+
private static final int COMMAND_EXIT_FULLSCREEN = 5;
|
|
44
|
+
private static final int COMMAND_HANDLE_PLAYBACK_SPEED = 6;
|
|
45
|
+
private static final int COMMAND_DISABLE_CAPTIONS = 9;
|
|
46
|
+
private static final int COMMAND_ENABLE_ADAPTIVE_VIDEO = 10;
|
|
47
|
+
private static final int COMMAND_SET_VIDEO_QUALITY = 11;
|
|
48
|
+
private static final int COMMAND_SET_CAPTION_LANGUAGE = 12;
|
|
49
|
+
|
|
50
|
+
private final ViewManagerDelegate<ReactVdoPlayerView> mDelegate;
|
|
51
|
+
|
|
52
|
+
public ReactVdoPlayerViewManager(ReactApplicationContext context, PlayerViewRegistry registry) {
|
|
53
|
+
mDelegate = new VdoPlayerViewManagerDelegate<>(this);
|
|
54
|
+
reactVdoPlayerViewManagerImpl = new ReactVdoPlayerViewManagerImpl(registry);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
@Nullable
|
|
58
|
+
@Override
|
|
59
|
+
protected ViewManagerDelegate<ReactVdoPlayerView> getDelegate() {
|
|
60
|
+
return mDelegate;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
@NonNull
|
|
64
|
+
@Override
|
|
65
|
+
public String getName() {
|
|
66
|
+
return ReactVdoPlayerViewManagerImpl.NEW_ARCH_REACT_CLASS;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
@NonNull
|
|
70
|
+
@Override
|
|
71
|
+
public ReactVdoPlayerView createViewInstance(ThemedReactContext context) {
|
|
72
|
+
return reactVdoPlayerViewManagerImpl.createViewInstance(context);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
@Nullable
|
|
76
|
+
@Override
|
|
77
|
+
public Map<String, Object> getExportedCustomDirectEventTypeConstants() {
|
|
78
|
+
return reactVdoPlayerViewManagerImpl.getExportedCustomDirectEventTypeConstants();
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
@Override
|
|
82
|
+
public void onDropViewInstance(ReactVdoPlayerView view) {
|
|
83
|
+
reactVdoPlayerViewManagerImpl.onDropViewInstance(view);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
@Override
|
|
87
|
+
public Map<String, Integer> getCommandsMap() {
|
|
88
|
+
return MapBuilder.<String, Integer>builder()
|
|
89
|
+
.put("play", COMMAND_PLAY)
|
|
90
|
+
.put("pause", COMMAND_PAUSE)
|
|
91
|
+
.put("seek", COMMAND_SEEK)
|
|
92
|
+
.put("enterFullscreen", COMMAND_ENTER_FULLSCREEN)
|
|
93
|
+
.put("exitFullscreen", COMMAND_EXIT_FULLSCREEN)
|
|
94
|
+
.put("playbackSpeed", COMMAND_HANDLE_PLAYBACK_SPEED)
|
|
95
|
+
.put("disableCaptions", COMMAND_DISABLE_CAPTIONS)
|
|
96
|
+
.put("enableAdaptiveVideo", COMMAND_ENABLE_ADAPTIVE_VIDEO)
|
|
97
|
+
.put("setVideoQuality", COMMAND_SET_VIDEO_QUALITY)
|
|
98
|
+
.put("setCaptionLanguage", COMMAND_SET_CAPTION_LANGUAGE)
|
|
99
|
+
.build();
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
@Override
|
|
103
|
+
public void receiveCommand(
|
|
104
|
+
ReactVdoPlayerView view,
|
|
105
|
+
String commandId,
|
|
106
|
+
@Nullable ReadableArray args) {
|
|
107
|
+
reactVdoPlayerViewManagerImpl.receiveCommand(view, commandId, args);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
@Override
|
|
111
|
+
@ReactProp(name = "embedInfo")
|
|
112
|
+
public void setEmbedInfo(ReactVdoPlayerView vdoPlayerView, @Nullable ReadableMap embedInfo) {
|
|
113
|
+
reactVdoPlayerViewManagerImpl.setEmbedInfo(vdoPlayerView, embedInfo);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
@Override
|
|
117
|
+
@ReactProp(name = "resizeMode")
|
|
118
|
+
public void setResizeMode(ReactVdoPlayerView vdoPlayerView, String resizeMode) {
|
|
119
|
+
reactVdoPlayerViewManagerImpl.setResizeMode(vdoPlayerView, resizeMode);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
@Override
|
|
123
|
+
@ReactProp(name = "aspectRatio")
|
|
124
|
+
public void setAspectRatio(ReactVdoPlayerView vdoPlayerView, float aspectRatio) {
|
|
125
|
+
reactVdoPlayerViewManagerImpl.setAspectRatio(vdoPlayerView, aspectRatio);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
@Override
|
|
129
|
+
@ReactProp(name = "autoPlay")
|
|
130
|
+
public void setAutoPlay(ReactVdoPlayerView vdoPlayerView, boolean autoPlay) {
|
|
131
|
+
reactVdoPlayerViewManagerImpl.setAutoPlay(vdoPlayerView, autoPlay);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
public void play(ReactVdoPlayerView view) {
|
|
135
|
+
reactVdoPlayerViewManagerImpl.receiveCommand(view, "play", null);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
public void pause(ReactVdoPlayerView view) {
|
|
139
|
+
reactVdoPlayerViewManagerImpl.receiveCommand(view, "pause", null);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
public void seek(ReactVdoPlayerView view, int seekTargetMs) {
|
|
143
|
+
WritableArray args = Arguments.createArray();
|
|
144
|
+
args.pushInt(seekTargetMs);
|
|
145
|
+
reactVdoPlayerViewManagerImpl.receiveCommand(view, "seek", args);
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
public void playbackSpeed(ReactVdoPlayerView view, double speed) {
|
|
149
|
+
WritableArray args = Arguments.createArray();
|
|
150
|
+
args.pushDouble(speed);
|
|
151
|
+
reactVdoPlayerViewManagerImpl.receiveCommand(view, "playbackSpeed", args);
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
public void enableAdaptiveVideo(ReactVdoPlayerView view) {
|
|
155
|
+
reactVdoPlayerViewManagerImpl.receiveCommand(view, "enableAdaptiveVideo", null);
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
public void setVideoQuality(ReactVdoPlayerView view, String track) {
|
|
159
|
+
WritableArray args = Arguments.createArray();
|
|
160
|
+
args.pushString(track);
|
|
161
|
+
reactVdoPlayerViewManagerImpl.receiveCommand(view, "setVideoQuality", args);
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
public void setCaptionLanguage(ReactVdoPlayerView view, String caption) {
|
|
165
|
+
WritableArray args = Arguments.createArray();
|
|
166
|
+
args.pushString(caption);
|
|
167
|
+
reactVdoPlayerViewManagerImpl.receiveCommand(view, "setCaptionLanguage", args);
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
public void disableCaptions(ReactVdoPlayerView view) {
|
|
171
|
+
reactVdoPlayerViewManagerImpl.receiveCommand(view, "disableCaptions", null);
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
package com.vdocipher.rnbridge;
|
|
2
|
+
|
|
3
|
+
import com.vdocipher.rnbridge.NativeTrackSelectionSpec;
|
|
4
|
+
import com.facebook.react.bridge.ReactApplicationContext;
|
|
5
|
+
import com.facebook.react.bridge.Callback;
|
|
6
|
+
import androidx.annotation.NonNull;
|
|
7
|
+
|
|
8
|
+
import com.vdocipher.rnbridge.TrackSelectionModuleImpl;
|
|
9
|
+
|
|
10
|
+
public class TrackSelectionModule extends NativeTrackSelectionSpec {
|
|
11
|
+
private static final String TAG = "TrackSelectionModule";
|
|
12
|
+
|
|
13
|
+
private TrackSelectionModuleImpl trackSelectionModuleImpl;
|
|
14
|
+
|
|
15
|
+
@Override
|
|
16
|
+
@NonNull
|
|
17
|
+
public String getName() {
|
|
18
|
+
return TrackSelectionModuleImpl.NAME;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
public TrackSelectionModule(ReactApplicationContext reactContext, PlayerViewRegistry registry) {
|
|
22
|
+
super(reactContext);
|
|
23
|
+
trackSelectionModuleImpl = new TrackSelectionModuleImpl(reactContext, registry);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
@Override
|
|
27
|
+
public void isAdaptive(com.facebook.react.bridge.Callback callback) {
|
|
28
|
+
trackSelectionModuleImpl.isAdaptive(callback);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
@Override
|
|
32
|
+
public void getVideoQualities(com.facebook.react.bridge.Callback callback) {
|
|
33
|
+
trackSelectionModuleImpl.getVideoQualities(callback);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
@Override
|
|
37
|
+
public void getSelectedVideoQuality(com.facebook.react.bridge.Callback callback) {
|
|
38
|
+
trackSelectionModuleImpl.getSelectedVideoQuality(callback);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
@Override
|
|
42
|
+
public void getSelectedAudioQuality(com.facebook.react.bridge.Callback callback) {
|
|
43
|
+
trackSelectionModuleImpl.getSelectedAudioQuality(callback);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
@Override
|
|
47
|
+
public void getCaptionLanguages(com.facebook.react.bridge.Callback callback) {
|
|
48
|
+
trackSelectionModuleImpl.getCaptionLanguages(callback);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
@Override
|
|
52
|
+
public void getSelectedCaptionLanguage(com.facebook.react.bridge.Callback callback) {
|
|
53
|
+
trackSelectionModuleImpl.getSelectedCaptionLanguage(callback);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
@Override
|
|
57
|
+
public void getDuration(com.facebook.react.bridge.Callback callback) {
|
|
58
|
+
trackSelectionModuleImpl.getDuration(callback);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
}
|
|
@@ -0,0 +1,129 @@
|
|
|
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
|
+
|
|
24
|
+
import java.io.File;
|
|
25
|
+
import java.util.HashMap;
|
|
26
|
+
|
|
27
|
+
import javax.annotation.Nullable;
|
|
28
|
+
|
|
29
|
+
import android.os.Handler;
|
|
30
|
+
import android.os.Looper;
|
|
31
|
+
|
|
32
|
+
import static com.vdocipher.rnbridge.Utils.*;
|
|
33
|
+
|
|
34
|
+
import com.vdocipher.rnbridge.NativeVdoDownloadSpec;
|
|
35
|
+
import com.vdocipher.rnbridge.VdoDownloadModuleImpl.EnqueueFailureCallback;
|
|
36
|
+
import com.vdocipher.rnbridge.VdoDownloadModuleImpl;
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Exposes apis to:
|
|
40
|
+
* <p>
|
|
41
|
+
* <li>Fetch available download options for a video in your VdoCipher dashboard
|
|
42
|
+
* <li>Download media assets to local storage
|
|
43
|
+
* <li>Track download progress
|
|
44
|
+
* <li>Manage downloads (query or delete downloads)
|
|
45
|
+
*/
|
|
46
|
+
|
|
47
|
+
public class VdoDownloadModule extends NativeVdoDownloadSpec {
|
|
48
|
+
private static final String TAG = "VdoDownloadModule";
|
|
49
|
+
|
|
50
|
+
private VdoDownloadModuleImpl vdoDownloadModuleImpl;
|
|
51
|
+
private Handler mainHandler;
|
|
52
|
+
|
|
53
|
+
public VdoDownloadModule(ReactApplicationContext reactContext) {
|
|
54
|
+
super(reactContext);
|
|
55
|
+
vdoDownloadModuleImpl = new VdoDownloadModuleImpl(reactContext);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
@Override
|
|
59
|
+
public String getName() {
|
|
60
|
+
return VdoDownloadModuleImpl.NAME;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
@Override
|
|
64
|
+
public void addListener(String eventName) {}
|
|
65
|
+
|
|
66
|
+
@Override
|
|
67
|
+
public void removeListeners(double count) {}
|
|
68
|
+
|
|
69
|
+
@Override
|
|
70
|
+
public void getDownloadOptions(ReadableMap optionParams,
|
|
71
|
+
Callback errorCallback,
|
|
72
|
+
Callback successCallback) {
|
|
73
|
+
vdoDownloadModuleImpl.getDownloadOptions(optionParams, errorCallback, successCallback);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
@Override
|
|
77
|
+
public void enqueueDownload(String nativeId,
|
|
78
|
+
ReadableMap requestOptions,
|
|
79
|
+
Callback errorCallback,
|
|
80
|
+
Callback successCallback) {
|
|
81
|
+
enqueueDownload(nativeId, requestOptions, new EnqueueFailureCallback(errorCallback), successCallback);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
@Override
|
|
85
|
+
public void query(ReadableMap queryFilters,
|
|
86
|
+
Callback errorCallback,
|
|
87
|
+
Callback successCallback) {
|
|
88
|
+
vdoDownloadModuleImpl.query(queryFilters, errorCallback, successCallback);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
@Override
|
|
92
|
+
public void remove(ReadableArray deleteIds,
|
|
93
|
+
Callback errorCallback,
|
|
94
|
+
Callback successCallback) {
|
|
95
|
+
vdoDownloadModuleImpl.remove(deleteIds, errorCallback, successCallback);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
@Override
|
|
99
|
+
public void stop(ReadableArray stopIds,
|
|
100
|
+
Callback errorCallback,
|
|
101
|
+
Callback successCallback) {
|
|
102
|
+
vdoDownloadModuleImpl.stop(stopIds, errorCallback, successCallback);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
@Override
|
|
106
|
+
public void resume(ReadableArray resumeIds,
|
|
107
|
+
Callback errorCallback,
|
|
108
|
+
Callback successCallback) {
|
|
109
|
+
vdoDownloadModuleImpl.resume(resumeIds, errorCallback, successCallback);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
@Override
|
|
113
|
+
public void isExpired(String mediaId,
|
|
114
|
+
Callback errorCallback,
|
|
115
|
+
Callback successCallback) {
|
|
116
|
+
vdoDownloadModuleImpl.isExpired(mediaId, errorCallback, successCallback);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
// Private
|
|
121
|
+
|
|
122
|
+
private void enqueueDownload(String nativeId,
|
|
123
|
+
ReadableMap requestOptions,
|
|
124
|
+
EnqueueFailureCallback errorCallback,
|
|
125
|
+
Callback successCallback) {
|
|
126
|
+
vdoDownloadModuleImpl.enqueueDownload(nativeId, requestOptions, errorCallback, successCallback);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
package com.vdocipher.rnbridge;
|
|
2
|
+
|
|
3
|
+
import com.facebook.react.bridge.ReactApplicationContext;
|
|
4
|
+
import com.facebook.react.bridge.Callback;
|
|
5
|
+
|
|
6
|
+
import com.vdocipher.rnbridge.NativeVdoPlayerSpec;
|
|
7
|
+
import com.vdocipher.rnbridge.VdoPlayerModuleImpl;
|
|
8
|
+
|
|
9
|
+
public class VdoPlayerModule extends NativeVdoPlayerSpec {
|
|
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
|
+
@Override
|
|
25
|
+
public void getPlaybackPropertiesV2(com.facebook.react.bridge.Callback callback) {
|
|
26
|
+
vdoPlayerModuleImpl.getPlaybackPropertiesV2(callback);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
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
|
+
|
|
18
|
+
import com.vdocipher.rnbridge.NativeVdoPlayerSettingsSpec;
|
|
19
|
+
import com.vdocipher.rnbridge.VdoPlayerSettingsModuleImpl;
|
|
20
|
+
|
|
21
|
+
public class VdoPlayerSettingsModule extends NativeVdoPlayerSettingsSpec {
|
|
22
|
+
private static final String TAG = "VdoPlayerSettingsModule";
|
|
23
|
+
|
|
24
|
+
private VdoPlayerSettingsModuleImpl vdoPlayerSettingsModuleImpl;
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
public VdoPlayerSettingsModule(ReactApplicationContext reactContext) {
|
|
28
|
+
super(reactContext);
|
|
29
|
+
vdoPlayerSettingsModuleImpl = new VdoPlayerSettingsModuleImpl(reactContext);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
@Override
|
|
33
|
+
public String getName() {
|
|
34
|
+
return VdoPlayerSettingsModuleImpl.NAME;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
@Override()
|
|
38
|
+
public void applySettings(ReadableMap playerSettings) {
|
|
39
|
+
vdoPlayerSettingsModuleImpl.applySettings(playerSettings);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
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
|
+
|
|
15
|
+
import com.vdocipher.rnbridge.NativeVdoPreCacheManagerSpec;
|
|
16
|
+
import com.vdocipher.rnbridge.VdoPreCacheManagerModuleImpl;
|
|
17
|
+
|
|
18
|
+
public class VdoPreCacheManagerModule extends NativeVdoPreCacheManagerSpec {
|
|
19
|
+
private static final String TAG = "VdoPlayerSettingsModule";
|
|
20
|
+
|
|
21
|
+
private VdoPreCacheManagerModuleImpl vdoPreCacheManagerModuleImpl;
|
|
22
|
+
|
|
23
|
+
@Override
|
|
24
|
+
public String getName() {
|
|
25
|
+
return VdoPreCacheManagerModuleImpl.NAME;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
public VdoPreCacheManagerModule(ReactApplicationContext reactContext) {
|
|
29
|
+
super(reactContext);
|
|
30
|
+
vdoPreCacheManagerModuleImpl = new VdoPreCacheManagerModuleImpl(reactContext);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
@Override()
|
|
34
|
+
public void cacheVideo(ReadableMap preCacheSettings) {
|
|
35
|
+
vdoPreCacheManagerModuleImpl.cacheVideo(preCacheSettings);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
@Override()
|
|
39
|
+
public void clearCache() {
|
|
40
|
+
vdoPreCacheManagerModuleImpl.clearCache();
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
}
|