vdocipher-rn-bridge 1.13.2 → 1.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +11 -0
- package/VdoPlayerUIView.tsx +25 -1
- package/VdoPlayerView.tsx +8 -1
- package/android/build.gradle +3 -3
- package/android/src/main/AndroidManifest.xml +2 -1
- package/android/src/main/java/com/vdocipher/rnbridge/AudioFocusManager.java +59 -0
- package/android/src/main/java/com/vdocipher/rnbridge/ReactVdoPlayerUIView.java +141 -5
- package/android/src/main/java/com/vdocipher/rnbridge/ReactVdoPlayerUIViewManager.java +36 -1
- package/android/src/main/java/com/vdocipher/rnbridge/ReactVdoPlayerView.java +45 -13
- package/android/src/main/java/com/vdocipher/rnbridge/ReactVdoPlayerViewManager.java +8 -5
- package/android/src/main/java/com/vdocipher/rnbridge/TrackSelectionModule.java +56 -16
- package/android/src/main/java/com/vdocipher/rnbridge/VdoPlayerActivity.java +19 -129
- package/android/src/main/java/com/vdocipher/rnbridge/VdoPlayerModule.java +54 -0
- package/android/src/main/java/com/vdocipher/rnbridge/VdocipherRnBridgeModule.java +36 -35
- package/android/src/main/java/com/vdocipher/rnbridge/VdocipherRnBridgePackage.java +10 -2
- package/android/src/main/res/layout/activity_vdo_player.xml +1 -9
- package/index.ts +3 -3
- package/ios/.DS_Store +0 -0
- package/package.json +2 -2
- package/type.ts +5 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,15 @@
|
|
|
1
1
|
## Changelog
|
|
2
|
+
### 1.15.0
|
|
3
|
+
* Updated VdoCipher android sdk dependency to 1.19.6
|
|
4
|
+
* Added PlayerUI for fullscreen player
|
|
5
|
+
* Added PIP support for fullscreen player
|
|
6
|
+
* Added range for react-native peer dependency
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### 1.14.0
|
|
10
|
+
* Added `getPlaybackPropertiesV2` method to get totalPlayed and totalCovered properties
|
|
11
|
+
* Added track selection APIs for Player UI
|
|
12
|
+
|
|
2
13
|
### 1.13.2
|
|
3
14
|
* Updated VdoCipher android sdk dependency to 1.19.4
|
|
4
15
|
* Updated playerConfig to customPlayer Id
|
package/VdoPlayerUIView.tsx
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
import React, { Component } from 'react';
|
|
5
5
|
import {requireNativeComponent, Platform} from 'react-native';
|
|
6
6
|
import { InferProps } from 'prop-types';
|
|
7
|
-
import { VdoPropTypes } from './type';
|
|
7
|
+
import { CaptionLanguage, VdoPropTypes, VideoQuality } from './type';
|
|
8
8
|
|
|
9
9
|
const VdoViewPropTypes = VdoPropTypes;
|
|
10
10
|
type MyProps = InferProps<typeof VdoViewPropTypes>;
|
|
@@ -111,6 +111,30 @@
|
|
|
111
111
|
}
|
|
112
112
|
}
|
|
113
113
|
|
|
114
|
+
setVideoQuality = (videoQuality: VideoQuality) => {
|
|
115
|
+
if (this._root) {
|
|
116
|
+
this._root.setNativeProps({videoQuality: videoQuality});
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
enableAdaptiveVideo = () => {
|
|
121
|
+
if (this._root) {
|
|
122
|
+
this._root.setNativeProps({adaptiveVideo: this._propRef++});
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
setCaptionLanguage = (captionLanguage: CaptionLanguage) => {
|
|
127
|
+
if (this._root) {
|
|
128
|
+
this._root.setNativeProps({captionLanguage: captionLanguage});
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
disableCaptions = () => {
|
|
133
|
+
if (this._root) {
|
|
134
|
+
this._root.setNativeProps({disableCaptions: this._propRef++});
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
|
|
114
138
|
render() {
|
|
115
139
|
return (
|
|
116
140
|
<RCTVdoPlayerUIView ref={(component: any) => this._root = component}
|
package/VdoPlayerView.tsx
CHANGED
|
@@ -7,7 +7,7 @@ import { BackHandler, NativeModules, StyleSheet, Dimensions} from 'react-native'
|
|
|
7
7
|
import VdoPlayerSupportView from './VdoPlayerSupportView';
|
|
8
8
|
import VdoPlayerUIView from './VdoPlayerUIView';
|
|
9
9
|
import * as VdoType from './type';
|
|
10
|
-
const { TrackSelection } = NativeModules;
|
|
10
|
+
const { TrackSelection, VdoPlayer } = NativeModules;
|
|
11
11
|
|
|
12
12
|
const VdoViewPropTypes = VdoType.VdoPropTypes;
|
|
13
13
|
|
|
@@ -155,6 +155,13 @@ class VdoPlayerView extends Component<MyProps, MyState> {
|
|
|
155
155
|
}
|
|
156
156
|
}
|
|
157
157
|
|
|
158
|
+
getPlaybackPropertiesV2 = async() => {
|
|
159
|
+
return new Promise(async(resolve) => { await VdoPlayer.getPlaybackPropertiesV2((playbackProperties: VdoType.PlaybackProperty) => {
|
|
160
|
+
resolve(playbackProperties);
|
|
161
|
+
});
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
|
|
158
165
|
_onInitSuccess = (event: any) => {
|
|
159
166
|
if (this.props.onInitializationSuccess) {
|
|
160
167
|
this.props.onInitializationSuccess(event.nativeEvent);
|
package/android/build.gradle
CHANGED
|
@@ -18,8 +18,8 @@ apply plugin: 'com.android.library'
|
|
|
18
18
|
// TODO read from package.json
|
|
19
19
|
// "releaseVersionName" must be the same as "version" in package.json
|
|
20
20
|
// "releaseVersionCode" must increment by 1 with every release
|
|
21
|
-
def releaseVersionName = "1.
|
|
22
|
-
def releaseVersionCode =
|
|
21
|
+
def releaseVersionName = "1.15.0"
|
|
22
|
+
def releaseVersionCode = 19
|
|
23
23
|
|
|
24
24
|
android {
|
|
25
25
|
compileSdkVersion 33
|
|
@@ -86,5 +86,5 @@ repositories {
|
|
|
86
86
|
dependencies {
|
|
87
87
|
compileOnly 'com.facebook.react:react-native:+'
|
|
88
88
|
implementation 'androidx.appcompat:appcompat:1.3.1'
|
|
89
|
-
implementation 'com.vdocipher.aegis:vdocipher-android:1.19.
|
|
89
|
+
implementation 'com.vdocipher.aegis:vdocipher-android:1.19.6'
|
|
90
90
|
}
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
<activity android:name=".VdoPlayerActivity"
|
|
7
7
|
android:theme="@style/Theme.AppCompat.DayNight.NoActionBar"
|
|
8
8
|
android:screenOrientation="sensorLandscape"
|
|
9
|
-
android:configChanges="keyboardHidden|orientation|screenSize"
|
|
9
|
+
android:configChanges="keyboard|keyboardHidden|orientation|screenSize|smallestScreenSize|screenLayout"
|
|
10
|
+
android:supportsPictureInPicture="true"/>
|
|
10
11
|
</application>
|
|
11
12
|
</manifest>
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
package com.vdocipher.aegis.ui.view.internal;
|
|
2
|
+
|
|
3
|
+
import android.content.Context;
|
|
4
|
+
import android.media.AudioAttributes;
|
|
5
|
+
import android.media.AudioFocusRequest;
|
|
6
|
+
import android.media.AudioManager;
|
|
7
|
+
import android.os.Build;
|
|
8
|
+
import androidx.appcompat.app.AppCompatActivity;
|
|
9
|
+
|
|
10
|
+
import androidx.annotation.NonNull;
|
|
11
|
+
|
|
12
|
+
import java.lang.ref.WeakReference;
|
|
13
|
+
|
|
14
|
+
public class AudioFocusManager {
|
|
15
|
+
private final WeakReference<AudioManager> audioManager;
|
|
16
|
+
private final AudioManager.OnAudioFocusChangeListener audioFocusChangeListener;
|
|
17
|
+
private AudioFocusRequest audioFocusRequest;
|
|
18
|
+
|
|
19
|
+
public AudioFocusManager(@NonNull AppCompatActivity activity, AudioManager.OnAudioFocusChangeListener audioFocusChangeListener) {
|
|
20
|
+
AudioManager am = (AudioManager) activity.getSystemService(Context.AUDIO_SERVICE);
|
|
21
|
+
audioManager = new WeakReference<>(am);
|
|
22
|
+
this.audioFocusChangeListener = audioFocusChangeListener;
|
|
23
|
+
init();
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
private void init() {
|
|
27
|
+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
|
28
|
+
AudioAttributes audioAttributes = new AudioAttributes.Builder()
|
|
29
|
+
.setUsage(AudioAttributes.USAGE_MEDIA)
|
|
30
|
+
.setContentType(AudioAttributes.CONTENT_TYPE_MOVIE)
|
|
31
|
+
.build();
|
|
32
|
+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
|
33
|
+
audioFocusRequest = new AudioFocusRequest.Builder(AudioManager.AUDIOFOCUS_GAIN)
|
|
34
|
+
.setAudioAttributes(audioAttributes)
|
|
35
|
+
.setAcceptsDelayedFocusGain(true)
|
|
36
|
+
.setOnAudioFocusChangeListener(audioFocusChangeListener)
|
|
37
|
+
.build();
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
public boolean requestAudioFocus() {
|
|
43
|
+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
|
44
|
+
//must supply an AudioFocusRequest parameter
|
|
45
|
+
return AudioManager.AUDIOFOCUS_REQUEST_GRANTED == audioManager.get().requestAudioFocus(audioFocusRequest);
|
|
46
|
+
} else {
|
|
47
|
+
return AudioManager.AUDIOFOCUS_REQUEST_GRANTED == audioManager.get().requestAudioFocus(audioFocusChangeListener, AudioManager.STREAM_MUSIC, AudioManager.AUDIOFOCUS_GAIN);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
public void abandonAudioFocus() {
|
|
52
|
+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
|
53
|
+
audioManager.get().abandonAudioFocusRequest(audioFocusRequest);
|
|
54
|
+
} else {
|
|
55
|
+
audioManager.get().abandonAudioFocus(audioFocusChangeListener);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
}
|
|
@@ -3,6 +3,7 @@ package com.vdocipher.rnbridge;
|
|
|
3
3
|
import androidx.appcompat.app.AppCompatActivity;
|
|
4
4
|
import androidx.core.util.Consumer;
|
|
5
5
|
import androidx.fragment.app.FragmentManager;
|
|
6
|
+
import androidx.fragment.app.Fragment;
|
|
6
7
|
|
|
7
8
|
import android.content.res.Configuration;
|
|
8
9
|
import android.util.Log;
|
|
@@ -23,12 +24,18 @@ import com.vdocipher.aegis.ui.view.VdoPlayerControlView;
|
|
|
23
24
|
import com.vdocipher.aegis.ui.view.VdoPlayerUIFragment;
|
|
24
25
|
import android.os.Handler;
|
|
25
26
|
import android.os.Bundle;
|
|
26
|
-
|
|
27
|
+
import android.os.Looper;
|
|
27
28
|
import androidx.core.util.Consumer;
|
|
28
29
|
import android.graphics.Color;
|
|
29
30
|
import static com.vdocipher.rnbridge.Utils.*;
|
|
30
31
|
import com.vdocipher.aegis.player.PlayerHost;
|
|
31
32
|
import androidx.core.app.PictureInPictureModeChangedInfo;
|
|
33
|
+
import com.facebook.react.bridge.Callback;
|
|
34
|
+
import com.facebook.react.bridge.WritableMap;
|
|
35
|
+
import com.facebook.react.bridge.Arguments;
|
|
36
|
+
|
|
37
|
+
import com.facebook.react.bridge.WritableArray;
|
|
38
|
+
import com.facebook.react.bridge.ReadableMap;
|
|
32
39
|
|
|
33
40
|
|
|
34
41
|
public class ReactVdoPlayerUIView extends FrameLayout implements LifecycleEventListener, Consumer<Configuration> {
|
|
@@ -52,6 +59,10 @@ public class ReactVdoPlayerUIView extends FrameLayout implements LifecycleEventL
|
|
|
52
59
|
|
|
53
60
|
private Consumer<PictureInPictureModeChangedInfo> pictureModeChangedInfoConsumer;
|
|
54
61
|
|
|
62
|
+
private Track[] availableTracks;
|
|
63
|
+
private Track[] selectedTracks;
|
|
64
|
+
private Handler mainHandler;
|
|
65
|
+
|
|
55
66
|
private int resizeMode = PlayerHost.RESIZE_MODE_FIT;
|
|
56
67
|
|
|
57
68
|
public ReactVdoPlayerUIView(ThemedReactContext context) {
|
|
@@ -64,6 +75,8 @@ public class ReactVdoPlayerUIView extends FrameLayout implements LifecycleEventL
|
|
|
64
75
|
context.addLifecycleEventListener(this);
|
|
65
76
|
activity.addOnConfigurationChangedListener(this);
|
|
66
77
|
|
|
78
|
+
mainHandler = new Handler(Looper.getMainLooper());
|
|
79
|
+
|
|
67
80
|
eventEmitter = new VdoEventEmitter(context);
|
|
68
81
|
|
|
69
82
|
int orientation = getResources().getConfiguration().orientation;
|
|
@@ -103,9 +116,16 @@ public class ReactVdoPlayerUIView extends FrameLayout implements LifecycleEventL
|
|
|
103
116
|
vdoPlayer.stop();
|
|
104
117
|
}
|
|
105
118
|
if (fragmentManager != null && !fragmentManager.isDestroyed()) {
|
|
106
|
-
|
|
107
|
-
|
|
119
|
+
try {
|
|
120
|
+
Fragment fragment = fragmentManager.findFragmentById(vdoPlayerUIFragment.getId());
|
|
121
|
+
if (fragment != null) {
|
|
122
|
+
fragmentManager.beginTransaction().remove(fragment).commitAllowingStateLoss();
|
|
123
|
+
}
|
|
124
|
+
} catch(IllegalStateException e) {
|
|
125
|
+
e.printStackTrace();
|
|
126
|
+
}
|
|
108
127
|
}
|
|
128
|
+
vdoPlayerUIFragment = null;
|
|
109
129
|
}
|
|
110
130
|
|
|
111
131
|
public void getPlaybackProperties() {
|
|
@@ -118,6 +138,23 @@ public class ReactVdoPlayerUIView extends FrameLayout implements LifecycleEventL
|
|
|
118
138
|
}
|
|
119
139
|
}
|
|
120
140
|
|
|
141
|
+
public void getPlaybackPropertiesV2(Callback callback) {
|
|
142
|
+
WritableMap playbackProperties = Arguments.createMap();
|
|
143
|
+
if (vdoPlayer != null) {
|
|
144
|
+
mainHandler.post(() -> {
|
|
145
|
+
Object tp = vdoPlayer.getPlaybackProperty("totalPlayed");
|
|
146
|
+
long totalPlayed = (tp instanceof Long) ? (long)tp : 0L;
|
|
147
|
+
Object tc = vdoPlayer.getPlaybackProperty("totalCovered");
|
|
148
|
+
long totalCovered = (tc instanceof Long) ? (long)tc : 0L;
|
|
149
|
+
playbackProperties.putInt("totalPlayed", (int)totalPlayed);
|
|
150
|
+
playbackProperties.putInt("totalCovered", (int)totalCovered);
|
|
151
|
+
callback.invoke(playbackProperties);
|
|
152
|
+
});
|
|
153
|
+
} else {
|
|
154
|
+
callback.invoke(playbackProperties);
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
|
|
121
158
|
public void setPlayWhenReady(boolean playWhenReady) {
|
|
122
159
|
this.playWhenReady = playWhenReady;
|
|
123
160
|
if (vdoPlayer != null) {
|
|
@@ -164,6 +201,102 @@ public class ReactVdoPlayerUIView extends FrameLayout implements LifecycleEventL
|
|
|
164
201
|
}
|
|
165
202
|
}
|
|
166
203
|
|
|
204
|
+
public void isAdaptive(Callback callback) {
|
|
205
|
+
|
|
206
|
+
if (vdoPlayer != null) {
|
|
207
|
+
mainHandler.post(() -> {
|
|
208
|
+
boolean isAdaptive = vdoPlayer.isAdaptive();
|
|
209
|
+
callback.invoke(isAdaptive);
|
|
210
|
+
});
|
|
211
|
+
} else {
|
|
212
|
+
callback.invoke(false);
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
public void getVideoQualities(Callback callback) {
|
|
217
|
+
WritableArray availableVideoQualities = Arguments.createArray();
|
|
218
|
+
if (this.availableTracks != null) {
|
|
219
|
+
availableVideoQualities = makeAvailableTrackMapArray(this.availableTracks, Track.TYPE_VIDEO);
|
|
220
|
+
}
|
|
221
|
+
callback.invoke(availableVideoQualities);
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
public void getSelectedVideoQuality(Callback callback) {
|
|
225
|
+
WritableMap selectedVideoQuality = Arguments.createMap();
|
|
226
|
+
if (this.selectedTracks != null) {
|
|
227
|
+
selectedVideoQuality = makeSelectedVideoTrackMap(this.selectedTracks);
|
|
228
|
+
}
|
|
229
|
+
callback.invoke(selectedVideoQuality);
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
public void getSelectedAudioQuality(Callback callback) {
|
|
233
|
+
WritableMap selectedAudioQuality = Arguments.createMap();
|
|
234
|
+
if (this.selectedTracks != null) {
|
|
235
|
+
selectedAudioQuality = makeSelectedAudioTrackMap(this.selectedTracks);
|
|
236
|
+
}
|
|
237
|
+
callback.invoke(selectedAudioQuality);
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
public void getCaptionLanguages(Callback callback) {
|
|
241
|
+
WritableArray availableCaptionLanguages = Arguments.createArray();
|
|
242
|
+
if (this.availableTracks != null) {
|
|
243
|
+
availableCaptionLanguages = makeAvailableTrackMapArray(this.availableTracks, Track.TYPE_CAPTIONS);
|
|
244
|
+
}
|
|
245
|
+
callback.invoke(availableCaptionLanguages);
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
public void getSelectedCaptionLanguage(Callback callback) {
|
|
249
|
+
WritableMap selectedCaptionLanguage = Arguments.createMap();
|
|
250
|
+
if (this.selectedTracks != null) {
|
|
251
|
+
selectedCaptionLanguage = makeSelectedCaptionTrackMap(this.selectedTracks);
|
|
252
|
+
}
|
|
253
|
+
callback.invoke(selectedCaptionLanguage);
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
public void getDuration(Callback callback) {
|
|
257
|
+
|
|
258
|
+
if (vdoPlayer != null) {
|
|
259
|
+
mainHandler.post(() -> {
|
|
260
|
+
double videoDuration = vdoPlayer.getDuration();
|
|
261
|
+
WritableMap videoDurationMap = Arguments.createMap();
|
|
262
|
+
videoDurationMap.putDouble("duration", videoDuration);
|
|
263
|
+
callback.invoke(videoDurationMap);
|
|
264
|
+
});
|
|
265
|
+
} else {
|
|
266
|
+
callback.invoke(0);
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
public void setSelectedTrack(ReadableMap selectedTrackMap) {
|
|
271
|
+
Track selectedTrack = makeTrack(selectedTrackMap, availableTracks);
|
|
272
|
+
|
|
273
|
+
if (vdoPlayer != null && selectedTrack != null) {
|
|
274
|
+
mainHandler.post(() -> {
|
|
275
|
+
vdoPlayer.setSelectedTracks(new Track[]{selectedTrack});
|
|
276
|
+
});
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
public void enableAdaptiveVideo() {
|
|
281
|
+
Track selectedTrack = Track.SET_ADAPTIVE;
|
|
282
|
+
|
|
283
|
+
if (vdoPlayer != null) {
|
|
284
|
+
mainHandler.post(() -> {
|
|
285
|
+
vdoPlayer.setSelectedTracks(new Track[]{selectedTrack});
|
|
286
|
+
});
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
public void disableCaptions() {
|
|
291
|
+
Track selectedTrack = Track.DISABLE_CAPTIONS;
|
|
292
|
+
|
|
293
|
+
if (vdoPlayer != null) {
|
|
294
|
+
mainHandler.post(() -> {
|
|
295
|
+
vdoPlayer.setSelectedTracks(new Track[]{selectedTrack});
|
|
296
|
+
});
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
|
|
167
300
|
@Override
|
|
168
301
|
public void setId(int id) {
|
|
169
302
|
super.setId(id);
|
|
@@ -246,6 +379,8 @@ public class ReactVdoPlayerUIView extends FrameLayout implements LifecycleEventL
|
|
|
246
379
|
public void onInitializationSuccess(PlayerHost playerHost, VdoPlayer player, boolean restored) {
|
|
247
380
|
Log.d(TAG, "init success");
|
|
248
381
|
vdoPlayer = player;
|
|
382
|
+
availableTracks = vdoPlayer.getAvailableTracks();
|
|
383
|
+
selectedTracks = vdoPlayer.getSelectedTracks();
|
|
249
384
|
vdoPlayer.addPlaybackEventListener(playbackListener);
|
|
250
385
|
eventEmitter.initSuccess(restored);
|
|
251
386
|
|
|
@@ -280,8 +415,9 @@ public class ReactVdoPlayerUIView extends FrameLayout implements LifecycleEventL
|
|
|
280
415
|
}
|
|
281
416
|
|
|
282
417
|
@Override
|
|
283
|
-
public void onTracksChanged(Track[]
|
|
284
|
-
|
|
418
|
+
public void onTracksChanged(Track[] tracksAvailable, Track[] tracksSelected) {
|
|
419
|
+
availableTracks = tracksAvailable;
|
|
420
|
+
selectedTracks = tracksSelected;
|
|
285
421
|
eventEmitter.tracksChanged(availableTracks, selectedTracks);
|
|
286
422
|
}
|
|
287
423
|
|
|
@@ -13,6 +13,7 @@ import com.vdocipher.aegis.player.VdoInitParams;
|
|
|
13
13
|
import java.util.Map;
|
|
14
14
|
|
|
15
15
|
import javax.annotation.Nullable;
|
|
16
|
+
import java.util.concurrent.CopyOnWriteArraySet;
|
|
16
17
|
|
|
17
18
|
import static com.vdocipher.rnbridge.Utils.getTechOverride;
|
|
18
19
|
|
|
@@ -21,6 +22,9 @@ public class ReactVdoPlayerUIViewManager extends ViewGroupManager<ReactVdoPlayer
|
|
|
21
22
|
|
|
22
23
|
private static final String REACT_CLASS = "RCTVdoPlayerUIView";
|
|
23
24
|
|
|
25
|
+
private ReactVdoPlayerUIView playerView;
|
|
26
|
+
private CopyOnWriteArraySet<Listener> listeners = new CopyOnWriteArraySet<>();
|
|
27
|
+
|
|
24
28
|
@Override
|
|
25
29
|
public String getName() {
|
|
26
30
|
return REACT_CLASS;
|
|
@@ -28,11 +32,18 @@ public class ReactVdoPlayerUIViewManager extends ViewGroupManager<ReactVdoPlayer
|
|
|
28
32
|
|
|
29
33
|
@Override
|
|
30
34
|
public ReactVdoPlayerUIView createViewInstance(ThemedReactContext context) {
|
|
31
|
-
|
|
35
|
+
playerView = new ReactVdoPlayerUIView(context);
|
|
32
36
|
Log.d(TAG, "created " + playerView.toString());
|
|
37
|
+
for (Listener listener : listeners) {
|
|
38
|
+
listener.onVideoPlayerViewInitialised(playerView);
|
|
39
|
+
}
|
|
33
40
|
return playerView;
|
|
34
41
|
}
|
|
35
42
|
|
|
43
|
+
public void addListener(Listener listener) {
|
|
44
|
+
listeners.add(listener);
|
|
45
|
+
}
|
|
46
|
+
|
|
36
47
|
@Nullable
|
|
37
48
|
@Override
|
|
38
49
|
public Map<String, Object> getExportedCustomDirectEventTypeConstants() {
|
|
@@ -162,4 +173,28 @@ public class ReactVdoPlayerUIViewManager extends ViewGroupManager<ReactVdoPlayer
|
|
|
162
173
|
public void setAspectRatio(ReactVdoPlayerUIView vdoPlayerView, float aspectRatio) {
|
|
163
174
|
vdoPlayerView.setAspectRatio(aspectRatio);
|
|
164
175
|
}
|
|
176
|
+
|
|
177
|
+
@ReactProp(name = "videoQuality")
|
|
178
|
+
public void setVideoQuality(ReactVdoPlayerUIView vdoPlayerView, ReadableMap videoQuality) {
|
|
179
|
+
vdoPlayerView.setSelectedTrack(videoQuality);
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
@ReactProp(name = "adaptiveVideo")
|
|
183
|
+
public void enableAdaptiveVideo(ReactVdoPlayerUIView vdoPlayerView, int ref) {
|
|
184
|
+
vdoPlayerView.enableAdaptiveVideo();
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
@ReactProp(name = "captionLanguage")
|
|
188
|
+
public void setCaptionLanguage(ReactVdoPlayerUIView vdoPlayerView, ReadableMap captionLanguage) {
|
|
189
|
+
vdoPlayerView.setSelectedTrack(captionLanguage);
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
@ReactProp(name = "disableCaptions")
|
|
193
|
+
public void disableCaptions(ReactVdoPlayerUIView vdoPlayerView, int ref) {
|
|
194
|
+
vdoPlayerView.disableCaptions();
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
public interface Listener {
|
|
198
|
+
void onVideoPlayerViewInitialised(ReactVdoPlayerUIView vdoPlayerView);
|
|
199
|
+
}
|
|
165
200
|
}
|
|
@@ -7,6 +7,7 @@ import android.widget.FrameLayout;
|
|
|
7
7
|
import android.content.pm.ActivityInfo;
|
|
8
8
|
import androidx.appcompat.app.AppCompatActivity;
|
|
9
9
|
import androidx.fragment.app.FragmentManager;
|
|
10
|
+
import androidx.fragment.app.Fragment;
|
|
10
11
|
|
|
11
12
|
import android.view.LayoutInflater;
|
|
12
13
|
|
|
@@ -22,6 +23,7 @@ import com.vdocipher.aegis.player.VdoPlayer.PlaybackEventListener;
|
|
|
22
23
|
import com.vdocipher.aegis.player.VdoInitParams;
|
|
23
24
|
import com.vdocipher.aegis.ui.view.VdoPlayerUIFragment;
|
|
24
25
|
import android.media.AudioManager;
|
|
26
|
+
import com.vdocipher.aegis.ui.view.internal.AudioFocusManager;
|
|
25
27
|
import android.content.Context;
|
|
26
28
|
|
|
27
29
|
import androidx.core.app.PictureInPictureModeChangedInfo;
|
|
@@ -48,7 +50,7 @@ public class ReactVdoPlayerView extends FrameLayout implements LifecycleEventLis
|
|
|
48
50
|
private final ThemedReactContext themedReactContext;
|
|
49
51
|
private final VdoEventEmitter eventEmitter;
|
|
50
52
|
private VdoPlayerUIFragment vdoPlayerUIFragment;
|
|
51
|
-
private
|
|
53
|
+
private AudioFocusManager audioFocusManager;
|
|
52
54
|
private FragmentManager fragmentManager;
|
|
53
55
|
|
|
54
56
|
private VdoPlayer vdoPlayer;
|
|
@@ -68,7 +70,7 @@ public class ReactVdoPlayerView extends FrameLayout implements LifecycleEventLis
|
|
|
68
70
|
|
|
69
71
|
private AppCompatActivity activity;
|
|
70
72
|
|
|
71
|
-
|
|
73
|
+
private Consumer<PictureInPictureModeChangedInfo> pictureModeChangedInfoConsumer;
|
|
72
74
|
|
|
73
75
|
private Track[] availableTracks;
|
|
74
76
|
private Track[] selectedTracks;
|
|
@@ -94,7 +96,7 @@ public class ReactVdoPlayerView extends FrameLayout implements LifecycleEventLis
|
|
|
94
96
|
}
|
|
95
97
|
|
|
96
98
|
setPictureInPictureSupport();
|
|
97
|
-
|
|
99
|
+
audioFocusManager = new AudioFocusManager(activity, audioFocusChangeListener);
|
|
98
100
|
|
|
99
101
|
}
|
|
100
102
|
|
|
@@ -124,9 +126,16 @@ public class ReactVdoPlayerView extends FrameLayout implements LifecycleEventLis
|
|
|
124
126
|
vdoPlayer.stop();
|
|
125
127
|
}
|
|
126
128
|
if (fragmentManager != null && !fragmentManager.isDestroyed()) {
|
|
127
|
-
|
|
128
|
-
|
|
129
|
+
try {
|
|
130
|
+
Fragment fragment = fragmentManager.findFragmentById(vdoPlayerUIFragment.getId());
|
|
131
|
+
if (fragment != null) {
|
|
132
|
+
fragmentManager.beginTransaction().remove(fragment).commitAllowingStateLoss();
|
|
133
|
+
}
|
|
134
|
+
} catch(IllegalStateException e) {
|
|
135
|
+
e.printStackTrace();
|
|
136
|
+
}
|
|
129
137
|
}
|
|
138
|
+
vdoPlayerUIFragment = null;
|
|
130
139
|
}
|
|
131
140
|
|
|
132
141
|
public boolean setFullscreen(boolean enterFullscreen) {
|
|
@@ -176,6 +185,23 @@ public class ReactVdoPlayerView extends FrameLayout implements LifecycleEventLis
|
|
|
176
185
|
}
|
|
177
186
|
}
|
|
178
187
|
|
|
188
|
+
public void getPlaybackPropertiesV2(Callback callback) {
|
|
189
|
+
WritableMap playbackProperties = Arguments.createMap();
|
|
190
|
+
if (vdoPlayer != null) {
|
|
191
|
+
mainHandler.post(() -> {
|
|
192
|
+
Object tp = vdoPlayer.getPlaybackProperty("totalPlayed");
|
|
193
|
+
long totalPlayed = (tp instanceof Long) ? (long)tp : 0L;
|
|
194
|
+
Object tc = vdoPlayer.getPlaybackProperty("totalCovered");
|
|
195
|
+
long totalCovered = (tc instanceof Long) ? (long)tc : 0L;
|
|
196
|
+
playbackProperties.putInt("totalPlayed", (int)totalPlayed);
|
|
197
|
+
playbackProperties.putInt("totalCovered", (int)totalCovered);
|
|
198
|
+
callback.invoke(playbackProperties);
|
|
199
|
+
});
|
|
200
|
+
} else {
|
|
201
|
+
callback.invoke(playbackProperties);
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
|
|
179
205
|
public void setPlayWhenReady(boolean playWhenReady) {
|
|
180
206
|
this.playWhenReady = playWhenReady;
|
|
181
207
|
if (vdoPlayer != null) {
|
|
@@ -245,12 +271,14 @@ public class ReactVdoPlayerView extends FrameLayout implements LifecycleEventLis
|
|
|
245
271
|
*/
|
|
246
272
|
private void updatePlaybackState(
|
|
247
273
|
@PlaybackStateCompat.State int state, long position, float playBackSpeed) {
|
|
274
|
+
if (mSession == null) return;
|
|
248
275
|
long actions = mSession.getController().getPlaybackState().getActions();
|
|
249
276
|
updatePlaybackState(state, actions, position, playBackSpeed);
|
|
250
277
|
}
|
|
251
278
|
|
|
252
279
|
private void updatePlaybackState(
|
|
253
280
|
@PlaybackStateCompat.State int state, long playbackActions, long position, float playBackSpeed) {
|
|
281
|
+
if (mSession == null) return;
|
|
254
282
|
PlaybackStateCompat.Builder builder =
|
|
255
283
|
new PlaybackStateCompat.Builder()
|
|
256
284
|
.setActions(playbackActions)
|
|
@@ -420,6 +448,14 @@ public class ReactVdoPlayerView extends FrameLayout implements LifecycleEventLis
|
|
|
420
448
|
if (vdoPlayer != null) {
|
|
421
449
|
vdoPlayer.setPlayWhenReady(false);
|
|
422
450
|
}
|
|
451
|
+
if (audioFocusManager != null) {
|
|
452
|
+
audioFocusManager.abandonAudioFocus();
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
if (mSession != null) {
|
|
456
|
+
//release media session
|
|
457
|
+
mSession.release();
|
|
458
|
+
}
|
|
423
459
|
super.onDetachedFromWindow();
|
|
424
460
|
}
|
|
425
461
|
|
|
@@ -475,7 +511,6 @@ public class ReactVdoPlayerView extends FrameLayout implements LifecycleEventLis
|
|
|
475
511
|
pendingInitParams = null;
|
|
476
512
|
}
|
|
477
513
|
|
|
478
|
-
initializeMediaSession();
|
|
479
514
|
}
|
|
480
515
|
|
|
481
516
|
@Override
|
|
@@ -494,10 +529,6 @@ public class ReactVdoPlayerView extends FrameLayout implements LifecycleEventLis
|
|
|
494
529
|
}
|
|
495
530
|
}
|
|
496
531
|
|
|
497
|
-
private boolean requestAudioFocus(AudioManager audioManager) {
|
|
498
|
-
return AudioManager.AUDIOFOCUS_REQUEST_GRANTED == audioManager.requestAudioFocus(audioFocusChangeListener, AudioManager.STREAM_MUSIC, AudioManager.AUDIOFOCUS_GAIN);
|
|
499
|
-
}
|
|
500
|
-
|
|
501
532
|
private final AudioManager.OnAudioFocusChangeListener audioFocusChangeListener = new AudioManager.OnAudioFocusChangeListener() {
|
|
502
533
|
@Override
|
|
503
534
|
public void onAudioFocusChange(int focusChange) {
|
|
@@ -536,12 +567,12 @@ private final VdoPlayer.PlaybackEventListener playbackListener = new VdoPlayer.P
|
|
|
536
567
|
|
|
537
568
|
if (playing) {
|
|
538
569
|
//Request audio focus and notify other players to stop playback.
|
|
539
|
-
if (
|
|
570
|
+
if ((audioFocusManager != null && audioFocusManager.requestAudioFocus())) {
|
|
540
571
|
Log.i(TAG, "Audio focus not granted");
|
|
541
572
|
}
|
|
542
|
-
} else if (playerState == VdoPlayer.STATE_ENDED) {
|
|
573
|
+
} else if (playerState == VdoPlayer.STATE_ENDED && audioFocusManager != null) {
|
|
543
574
|
// Abandon audio focus when playback complete
|
|
544
|
-
|
|
575
|
+
audioFocusManager.abandonAudioFocus();
|
|
545
576
|
}
|
|
546
577
|
eventEmitter.playerStateChanged(playWhenReady, playerState);
|
|
547
578
|
}
|
|
@@ -578,6 +609,7 @@ private final VdoPlayer.PlaybackEventListener playbackListener = new VdoPlayer.P
|
|
|
578
609
|
vdoPlayer.setPlaybackSpeed(pendingPlaybackSpeed);
|
|
579
610
|
pendingPlaybackSpeed = 0;
|
|
580
611
|
}
|
|
612
|
+
initializeMediaSession();
|
|
581
613
|
eventEmitter.loaded(vdoInitParams, vdoPlayer.getCurrentMedia());
|
|
582
614
|
}
|
|
583
615
|
|
|
@@ -13,6 +13,7 @@ import com.vdocipher.aegis.media.Track;
|
|
|
13
13
|
import java.util.Map;
|
|
14
14
|
|
|
15
15
|
import javax.annotation.Nullable;
|
|
16
|
+
import java.util.concurrent.CopyOnWriteArraySet;
|
|
16
17
|
|
|
17
18
|
import static com.vdocipher.rnbridge.Utils.getTechOverride;
|
|
18
19
|
import com.facebook.react.bridge.ReadableMap;
|
|
@@ -23,7 +24,7 @@ public class ReactVdoPlayerViewManager extends ViewGroupManager<ReactVdoPlayerVi
|
|
|
23
24
|
private static final String REACT_CLASS = "RCTVdoPlayerView";
|
|
24
25
|
|
|
25
26
|
private ReactVdoPlayerView playerView;
|
|
26
|
-
private
|
|
27
|
+
private CopyOnWriteArraySet<Listener> listeners = new CopyOnWriteArraySet<>();
|
|
27
28
|
|
|
28
29
|
@Override
|
|
29
30
|
public String getName() {
|
|
@@ -34,12 +35,14 @@ public class ReactVdoPlayerViewManager extends ViewGroupManager<ReactVdoPlayerVi
|
|
|
34
35
|
public ReactVdoPlayerView createViewInstance(ThemedReactContext context) {
|
|
35
36
|
playerView = new ReactVdoPlayerView(context);
|
|
36
37
|
Log.d(TAG, "created " + playerView.toString());
|
|
37
|
-
|
|
38
|
+
for (Listener listener : listeners) {
|
|
39
|
+
listener.onVideoPlayerViewInitialised(playerView);
|
|
40
|
+
}
|
|
38
41
|
return playerView;
|
|
39
42
|
}
|
|
40
43
|
|
|
41
|
-
public void
|
|
42
|
-
|
|
44
|
+
public void addListener(Listener listener) {
|
|
45
|
+
listeners.add(listener);
|
|
43
46
|
}
|
|
44
47
|
|
|
45
48
|
@Nullable
|
|
@@ -168,7 +171,7 @@ public class ReactVdoPlayerViewManager extends ViewGroupManager<ReactVdoPlayerVi
|
|
|
168
171
|
vdoPlayerView.disableCaptions();
|
|
169
172
|
}
|
|
170
173
|
|
|
171
|
-
public interface
|
|
174
|
+
public interface Listener {
|
|
172
175
|
void onVideoPlayerViewInitialised(ReactVdoPlayerView vdoPlayerView);
|
|
173
176
|
}
|
|
174
177
|
|
|
@@ -8,74 +8,109 @@ import com.facebook.react.bridge.Callback;
|
|
|
8
8
|
import android.util.Log;
|
|
9
9
|
import com.facebook.react.uimanager.annotations.ReactProp;
|
|
10
10
|
|
|
11
|
-
public class TrackSelectionModule extends ReactContextBaseJavaModule implements ReactVdoPlayerViewManager.
|
|
11
|
+
public class TrackSelectionModule extends ReactContextBaseJavaModule implements ReactVdoPlayerViewManager.Listener, ReactVdoPlayerUIViewManager.Listener {
|
|
12
12
|
private static final String TAG = "TrackSelectionModule";
|
|
13
13
|
|
|
14
14
|
private ReactVdoPlayerView vdoPlayerView;
|
|
15
|
+
private ReactVdoPlayerUIView vdoPlayerUIView;
|
|
15
16
|
|
|
16
17
|
@Override
|
|
17
18
|
public String getName() {
|
|
18
19
|
return "TrackSelection";
|
|
19
20
|
}
|
|
20
21
|
|
|
21
|
-
public TrackSelectionModule(ReactApplicationContext reactContext, ReactVdoPlayerViewManager vdoPlayerViewManager) {
|
|
22
|
+
public TrackSelectionModule(ReactApplicationContext reactContext, ReactVdoPlayerViewManager vdoPlayerViewManager, ReactVdoPlayerUIViewManager vdoPlayerUIViewManager) {
|
|
22
23
|
super(reactContext);
|
|
23
24
|
if (vdoPlayerViewManager != null) {
|
|
24
|
-
vdoPlayerViewManager.
|
|
25
|
+
vdoPlayerViewManager.addListener(this);
|
|
26
|
+
}
|
|
27
|
+
if (vdoPlayerUIViewManager != null) {
|
|
28
|
+
vdoPlayerUIViewManager.addListener(this);
|
|
25
29
|
}
|
|
26
30
|
}
|
|
27
31
|
|
|
28
32
|
@ReactMethod
|
|
29
33
|
public void isAdaptive(com.facebook.react.bridge.Callback callback) {
|
|
30
|
-
if (vdoPlayerView == null) {
|
|
34
|
+
if (vdoPlayerView == null && vdoPlayerUIView == null) {
|
|
31
35
|
return;
|
|
32
36
|
}
|
|
33
|
-
vdoPlayerView
|
|
37
|
+
if (vdoPlayerView != null) {
|
|
38
|
+
vdoPlayerView.isAdaptive(callback);
|
|
39
|
+
} else {
|
|
40
|
+
vdoPlayerUIView.isAdaptive(callback);
|
|
41
|
+
}
|
|
34
42
|
}
|
|
35
43
|
|
|
36
44
|
@ReactMethod
|
|
37
45
|
public void getVideoQualities(com.facebook.react.bridge.Callback callback) {
|
|
38
|
-
if (vdoPlayerView == null) {
|
|
46
|
+
if (vdoPlayerView == null && vdoPlayerUIView == null) {
|
|
39
47
|
return;
|
|
40
48
|
}
|
|
41
|
-
vdoPlayerView
|
|
49
|
+
if (vdoPlayerView != null) {
|
|
50
|
+
vdoPlayerView.getVideoQualities(callback);
|
|
51
|
+
} else {
|
|
52
|
+
vdoPlayerUIView.getVideoQualities(callback);
|
|
53
|
+
}
|
|
42
54
|
}
|
|
43
55
|
|
|
44
56
|
@ReactMethod
|
|
45
57
|
public void getSelectedVideoQuality(com.facebook.react.bridge.Callback callback) {
|
|
46
|
-
if (vdoPlayerView == null) {
|
|
58
|
+
if (vdoPlayerView == null && vdoPlayerUIView == null) {
|
|
47
59
|
return;
|
|
48
60
|
}
|
|
49
|
-
vdoPlayerView
|
|
61
|
+
if (vdoPlayerView != null) {
|
|
62
|
+
vdoPlayerView.getSelectedVideoQuality(callback);
|
|
63
|
+
} else {
|
|
64
|
+
vdoPlayerUIView.getSelectedVideoQuality(callback);
|
|
65
|
+
}
|
|
50
66
|
}
|
|
51
67
|
|
|
52
68
|
@ReactMethod
|
|
53
69
|
public void getSelectedAudioQuality(com.facebook.react.bridge.Callback callback) {
|
|
54
|
-
if (vdoPlayerView == null) {
|
|
70
|
+
if (vdoPlayerView == null && vdoPlayerUIView == null) {
|
|
55
71
|
return;
|
|
56
72
|
}
|
|
57
|
-
vdoPlayerView
|
|
73
|
+
if (vdoPlayerView != null) {
|
|
74
|
+
vdoPlayerView.getSelectedAudioQuality(callback);
|
|
75
|
+
} else {
|
|
76
|
+
vdoPlayerUIView.getSelectedAudioQuality(callback);
|
|
77
|
+
}
|
|
58
78
|
}
|
|
59
79
|
|
|
60
80
|
@ReactMethod
|
|
61
81
|
public void getCaptionLanguages(com.facebook.react.bridge.Callback callback) {
|
|
62
|
-
if (vdoPlayerView == null) {
|
|
82
|
+
if (vdoPlayerView == null && vdoPlayerUIView == null) {
|
|
63
83
|
return;
|
|
64
84
|
}
|
|
65
|
-
vdoPlayerView
|
|
85
|
+
if (vdoPlayerView != null) {
|
|
86
|
+
vdoPlayerView.getCaptionLanguages(callback);
|
|
87
|
+
} else {
|
|
88
|
+
vdoPlayerUIView.getCaptionLanguages(callback);
|
|
89
|
+
}
|
|
66
90
|
}
|
|
67
91
|
|
|
68
92
|
@ReactMethod
|
|
69
93
|
public void getSelectedCaptionLanguage(com.facebook.react.bridge.Callback callback) {
|
|
70
|
-
if (vdoPlayerView == null) {
|
|
94
|
+
if (vdoPlayerView == null && vdoPlayerUIView == null) {
|
|
71
95
|
return;
|
|
72
96
|
}
|
|
73
|
-
vdoPlayerView
|
|
97
|
+
if (vdoPlayerView != null) {
|
|
98
|
+
vdoPlayerView.getSelectedCaptionLanguage(callback);
|
|
99
|
+
} else {
|
|
100
|
+
vdoPlayerUIView.getSelectedCaptionLanguage(callback);
|
|
101
|
+
}
|
|
74
102
|
}
|
|
75
103
|
|
|
76
104
|
@ReactMethod()
|
|
77
105
|
public void getDuration(com.facebook.react.bridge.Callback callback) {
|
|
78
|
-
vdoPlayerView
|
|
106
|
+
if (vdoPlayerView == null && vdoPlayerUIView == null) {
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
if (vdoPlayerView != null) {
|
|
110
|
+
vdoPlayerView.getDuration(callback);
|
|
111
|
+
} else {
|
|
112
|
+
vdoPlayerUIView.getDuration(callback);
|
|
113
|
+
}
|
|
79
114
|
}
|
|
80
115
|
|
|
81
116
|
@Override
|
|
@@ -83,4 +118,9 @@ public class TrackSelectionModule extends ReactContextBaseJavaModule implements
|
|
|
83
118
|
this.vdoPlayerView = vdoPlayerView;
|
|
84
119
|
}
|
|
85
120
|
|
|
121
|
+
@Override
|
|
122
|
+
public void onVideoPlayerViewInitialised(ReactVdoPlayerUIView vdoPlayerUIView) {
|
|
123
|
+
this.vdoPlayerUIView = vdoPlayerUIView;
|
|
124
|
+
}
|
|
125
|
+
|
|
86
126
|
}
|
|
@@ -18,26 +18,31 @@ import com.vdocipher.aegis.media.Track;
|
|
|
18
18
|
import com.vdocipher.aegis.player.VdoPlayer;
|
|
19
19
|
import com.vdocipher.aegis.player.VdoInitParams;
|
|
20
20
|
import com.vdocipher.aegis.player.PlayerHost;
|
|
21
|
-
import com.vdocipher.aegis.
|
|
21
|
+
import com.vdocipher.aegis.ui.view.VdoPlayerUIFragment;
|
|
22
|
+
|
|
23
|
+
import androidx.annotation.RequiresApi;
|
|
24
|
+
import android.app.PictureInPictureParams;
|
|
22
25
|
|
|
23
26
|
public class VdoPlayerActivity extends AppCompatActivity implements PlayerHost.InitializationListener {
|
|
24
27
|
|
|
25
28
|
private static final String TAG = "VdoPlayerActivity";
|
|
26
29
|
|
|
27
30
|
private static final String EXTRA_VDOPARAMS = "vdoparams";
|
|
31
|
+
private static final String PIP_SUPPORT = "pipsupport";
|
|
28
32
|
|
|
29
33
|
private VdoPlayer player;
|
|
30
|
-
private
|
|
31
|
-
private VdoPlayerControlView playerControlView;
|
|
34
|
+
private VdoPlayerUIFragment playerFragment;
|
|
32
35
|
private String eventLogString = "";
|
|
33
36
|
|
|
34
37
|
private int currentOrientation;
|
|
35
38
|
|
|
36
39
|
private VdoInitParams vdoParams;
|
|
40
|
+
private boolean setPictureInPictureSupport = false;
|
|
37
41
|
|
|
38
|
-
public static Intent getStartIntent(Context context, VdoInitParams vdoParams) {
|
|
42
|
+
public static Intent getStartIntent(Context context, VdoInitParams vdoParams, boolean setPictureInPictureSupport) {
|
|
39
43
|
Intent intent = new Intent(context, VdoPlayerActivity.class);
|
|
40
44
|
intent.putExtra(EXTRA_VDOPARAMS, vdoParams);
|
|
45
|
+
intent.putExtra(PIP_SUPPORT, setPictureInPictureSupport);
|
|
41
46
|
return intent;
|
|
42
47
|
}
|
|
43
48
|
|
|
@@ -47,30 +52,22 @@ public class VdoPlayerActivity extends AppCompatActivity implements PlayerHost.I
|
|
|
47
52
|
Log.v(TAG, "onCreate called");
|
|
48
53
|
setContentView(R.layout.activity_vdo_player);
|
|
49
54
|
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
|
|
50
|
-
getWindow().getDecorView().setOnSystemUiVisibilityChangeListener(uiVisibilityListener);
|
|
51
55
|
|
|
52
56
|
if (getSupportActionBar() != null) {
|
|
53
57
|
getSupportActionBar().hide();
|
|
54
58
|
}
|
|
55
59
|
|
|
56
|
-
// first check if otp and playbackInfo are already available from a previous instance
|
|
57
|
-
if (savedInstanceState != null) {
|
|
58
|
-
vdoParams = savedInstanceState.getParcelable(EXTRA_VDOPARAMS);
|
|
59
|
-
}
|
|
60
|
-
|
|
61
60
|
// expect in intent if not obtained yet
|
|
62
61
|
if (vdoParams == null) {
|
|
63
62
|
Intent intent = getIntent();
|
|
64
63
|
vdoParams = intent.getParcelableExtra(EXTRA_VDOPARAMS);
|
|
64
|
+
setPictureInPictureSupport = intent.getBooleanExtra(PIP_SUPPORT, false);
|
|
65
65
|
}
|
|
66
66
|
|
|
67
|
-
playerFragment = (
|
|
68
|
-
playerControlView = (VdoPlayerControlView)findViewById(R.id.player_control_view);
|
|
67
|
+
playerFragment = (VdoPlayerUIFragment)getSupportFragmentManager().findFragmentById(R.id.online_vdo_player_fragment);
|
|
69
68
|
|
|
70
69
|
currentOrientation = getResources().getConfiguration().orientation;
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
playerControlView.setFullscreenState(currentOrientation == Configuration.ORIENTATION_LANDSCAPE);
|
|
70
|
+
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE);
|
|
74
71
|
|
|
75
72
|
initializePlayer();
|
|
76
73
|
}
|
|
@@ -84,7 +81,6 @@ public class VdoPlayerActivity extends AppCompatActivity implements PlayerHost.I
|
|
|
84
81
|
@Override
|
|
85
82
|
protected void onStop() {
|
|
86
83
|
Log.v(TAG, "onStop called");
|
|
87
|
-
disablePlayerUI();
|
|
88
84
|
super.onStop();
|
|
89
85
|
}
|
|
90
86
|
|
|
@@ -118,30 +114,12 @@ public class VdoPlayerActivity extends AppCompatActivity implements PlayerHost.I
|
|
|
118
114
|
eventLogString += (msg + "\n");
|
|
119
115
|
}
|
|
120
116
|
|
|
121
|
-
private void showControls(boolean show) {
|
|
122
|
-
Log.v(TAG, (show ? "show" : "hide") + " controls");
|
|
123
|
-
if (show) {
|
|
124
|
-
playerControlView.show();
|
|
125
|
-
} else {
|
|
126
|
-
playerControlView.hide();
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
private void disablePlayerUI() {
|
|
131
|
-
// showControls(false);
|
|
132
|
-
}
|
|
133
|
-
|
|
134
117
|
@Override
|
|
135
118
|
public void onInitializationSuccess(PlayerHost playerHost, VdoPlayer player, boolean wasRestored) {
|
|
136
119
|
Log.i(TAG, "onInitializationSuccess");
|
|
137
120
|
log("onInitializationSuccess");
|
|
138
121
|
this.player = player;
|
|
139
122
|
player.addPlaybackEventListener(playbackListener);
|
|
140
|
-
playerControlView.setPlayer(player);
|
|
141
|
-
showControls(true);
|
|
142
|
-
|
|
143
|
-
playerControlView.setFullscreenActionListener(fullscreenToggleListener);
|
|
144
|
-
playerControlView.setControllerVisibilityListener(visibilityListener);
|
|
145
123
|
|
|
146
124
|
// load a media to the player
|
|
147
125
|
player.load(vdoParams);
|
|
@@ -212,107 +190,19 @@ public class VdoPlayerActivity extends AppCompatActivity implements PlayerHost.I
|
|
|
212
190
|
}
|
|
213
191
|
};
|
|
214
192
|
|
|
215
|
-
private VdoPlayerControlView.FullscreenActionListener fullscreenToggleListener = new VdoPlayerControlView.FullscreenActionListener() {
|
|
216
|
-
@Override
|
|
217
|
-
public boolean onFullscreenAction(boolean enterFullscreen) {
|
|
218
|
-
showFullScreen(enterFullscreen);
|
|
219
|
-
return true;
|
|
220
|
-
}
|
|
221
|
-
};
|
|
222
|
-
|
|
223
|
-
private VdoPlayerControlView.ControllerVisibilityListener visibilityListener = new VdoPlayerControlView.ControllerVisibilityListener() {
|
|
224
|
-
@Override
|
|
225
|
-
public void onControllerVisibilityChange(int visibility) {
|
|
226
|
-
Log.i(TAG, "controller visibility " + visibility);
|
|
227
|
-
if (currentOrientation == Configuration.ORIENTATION_LANDSCAPE) {
|
|
228
|
-
if (visibility != View.VISIBLE) {
|
|
229
|
-
showSystemUi(false);
|
|
230
|
-
}
|
|
231
|
-
}
|
|
232
|
-
}
|
|
233
|
-
};
|
|
234
|
-
|
|
235
|
-
@Override
|
|
236
|
-
public void onConfigurationChanged(Configuration newConfig) {
|
|
237
|
-
final int newOrientation = newConfig.orientation;
|
|
238
|
-
final int oldOrientation = currentOrientation;
|
|
239
|
-
currentOrientation = newOrientation;
|
|
240
|
-
Log.i(TAG, "new orientation " +
|
|
241
|
-
(newOrientation == Configuration.ORIENTATION_PORTRAIT ? "PORTRAIT" :
|
|
242
|
-
newOrientation == Configuration.ORIENTATION_LANDSCAPE ? "LANDSCAPE" : "UNKNOWN"));
|
|
243
|
-
super.onConfigurationChanged(newConfig);
|
|
244
|
-
if (newOrientation == oldOrientation) {
|
|
245
|
-
Log.i(TAG, "orientation unchanged");
|
|
246
|
-
} else if (newOrientation == Configuration.ORIENTATION_LANDSCAPE) {
|
|
247
|
-
setLayout(true);
|
|
248
|
-
// hide system windows
|
|
249
|
-
showSystemUi(false);
|
|
250
|
-
showControls(false);
|
|
251
|
-
} else {
|
|
252
|
-
setLayout(false);
|
|
253
|
-
// show system windows
|
|
254
|
-
showSystemUi(true);
|
|
255
|
-
}
|
|
256
|
-
}
|
|
257
|
-
|
|
258
|
-
private void setLayout(boolean landscape) {
|
|
259
|
-
if (landscape) {
|
|
260
|
-
// hide other views
|
|
261
|
-
(findViewById(R.id.online_vdo_player_fragment)).setLayoutParams(new RelativeLayout.LayoutParams(
|
|
262
|
-
RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.MATCH_PARENT));
|
|
263
|
-
playerControlView.setFitsSystemWindows(true);
|
|
264
|
-
getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE
|
|
265
|
-
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
|
|
266
|
-
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN);
|
|
267
|
-
} else {
|
|
268
|
-
// show other views
|
|
269
|
-
(findViewById(R.id.online_vdo_player_fragment)).setLayoutParams(new RelativeLayout.LayoutParams(
|
|
270
|
-
RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.WRAP_CONTENT));
|
|
271
|
-
playerControlView.setFitsSystemWindows(false);
|
|
272
|
-
playerControlView.setPadding(0,0,0,0);
|
|
273
|
-
}
|
|
274
|
-
}
|
|
275
|
-
|
|
276
193
|
@Override
|
|
277
194
|
public void onBackPressed() {
|
|
278
195
|
super.onBackPressed();
|
|
279
196
|
}
|
|
280
197
|
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT);
|
|
289
|
-
}
|
|
290
|
-
}
|
|
291
|
-
|
|
292
|
-
private void showSystemUi(boolean show) {
|
|
293
|
-
Log.v(TAG, (show ? "show" : "hide") + " system ui");
|
|
294
|
-
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
|
|
295
|
-
if (!show) {
|
|
296
|
-
getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE
|
|
297
|
-
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
|
|
298
|
-
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
|
|
299
|
-
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
|
|
300
|
-
| View.SYSTEM_UI_FLAG_FULLSCREEN);
|
|
301
|
-
} else {
|
|
302
|
-
getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE);
|
|
303
|
-
}
|
|
198
|
+
@RequiresApi(api = Build.VERSION_CODES.O)
|
|
199
|
+
@Override
|
|
200
|
+
protected void onUserLeaveHint() {
|
|
201
|
+
super.onUserLeaveHint();
|
|
202
|
+
// switch to PiP mode if the user presses the home or recent button,
|
|
203
|
+
if (setPictureInPictureSupport) {
|
|
204
|
+
enterPictureInPictureMode(new PictureInPictureParams.Builder().build());
|
|
304
205
|
}
|
|
305
206
|
}
|
|
306
207
|
|
|
307
|
-
private View.OnSystemUiVisibilityChangeListener uiVisibilityListener = new View.OnSystemUiVisibilityChangeListener() {
|
|
308
|
-
@Override
|
|
309
|
-
public void onSystemUiVisibilityChange(int visibility) {
|
|
310
|
-
Log.v(TAG, "onSystemUiVisibilityChange");
|
|
311
|
-
// show player controls when system ui is showing
|
|
312
|
-
if ((visibility & View.SYSTEM_UI_FLAG_FULLSCREEN) == 0) {
|
|
313
|
-
Log.v(TAG, "system ui visible, making controls visible");
|
|
314
|
-
showControls(true);
|
|
315
|
-
}
|
|
316
|
-
}
|
|
317
|
-
};
|
|
318
208
|
}
|
|
@@ -0,0 +1,54 @@
|
|
|
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
|
+
|
|
11
|
+
public class VdoPlayerModule extends ReactContextBaseJavaModule implements ReactVdoPlayerViewManager.Listener, ReactVdoPlayerUIViewManager.Listener {
|
|
12
|
+
private static final String TAG = "VdoPlayerModule";
|
|
13
|
+
|
|
14
|
+
private ReactVdoPlayerView vdoPlayerView;
|
|
15
|
+
private ReactVdoPlayerUIView vdoPlayerUIView;
|
|
16
|
+
|
|
17
|
+
@Override
|
|
18
|
+
public String getName() {
|
|
19
|
+
return "VdoPlayer";
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
public VdoPlayerModule(ReactApplicationContext reactContext, ReactVdoPlayerViewManager vdoPlayerViewManager, ReactVdoPlayerUIViewManager vdoPlayerUIViewManager) {
|
|
23
|
+
super(reactContext);
|
|
24
|
+
if (vdoPlayerViewManager != null) {
|
|
25
|
+
vdoPlayerViewManager.addListener(this);
|
|
26
|
+
}
|
|
27
|
+
if (vdoPlayerUIViewManager != null) {
|
|
28
|
+
vdoPlayerUIViewManager.addListener(this);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
@ReactMethod()
|
|
33
|
+
public void getPlaybackPropertiesV2(com.facebook.react.bridge.Callback callback) {
|
|
34
|
+
if (vdoPlayerView == null && vdoPlayerUIView == null) {
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
if (vdoPlayerView != null) {
|
|
38
|
+
vdoPlayerView.getPlaybackPropertiesV2(callback);
|
|
39
|
+
} else {
|
|
40
|
+
vdoPlayerUIView.getPlaybackPropertiesV2(callback);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
@Override
|
|
45
|
+
public void onVideoPlayerViewInitialised(ReactVdoPlayerView vdoPlayerView) {
|
|
46
|
+
this.vdoPlayerView = vdoPlayerView;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
@Override
|
|
50
|
+
public void onVideoPlayerViewInitialised(ReactVdoPlayerUIView vdoPlayerUIView) {
|
|
51
|
+
this.vdoPlayerUIView = vdoPlayerUIView;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
}
|
|
@@ -10,6 +10,7 @@ import com.facebook.react.bridge.ReadableMap;
|
|
|
10
10
|
import com.vdocipher.aegis.player.VdoInitParams;
|
|
11
11
|
|
|
12
12
|
import static com.vdocipher.rnbridge.Utils.getTechOverride;
|
|
13
|
+
import java.util.HashMap;
|
|
13
14
|
|
|
14
15
|
public class VdocipherRnBridgeModule extends ReactContextBaseJavaModule {
|
|
15
16
|
|
|
@@ -32,7 +33,7 @@ public class VdocipherRnBridgeModule extends ReactContextBaseJavaModule {
|
|
|
32
33
|
|
|
33
34
|
// todo error event handling
|
|
34
35
|
@ReactMethod
|
|
35
|
-
public void startVideoScreen(ReadableMap embedParams) {
|
|
36
|
+
public void startVideoScreen(ReadableMap embedParams, boolean setPictureInPictureSupport) {
|
|
36
37
|
ReadableMap embedInfo = embedParams.getMap("embedInfo");
|
|
37
38
|
Activity currentActivity = getCurrentActivity();
|
|
38
39
|
if (currentActivity == null) {
|
|
@@ -42,30 +43,30 @@ public class VdocipherRnBridgeModule extends ReactContextBaseJavaModule {
|
|
|
42
43
|
final VdoInitParams vdoParams;
|
|
43
44
|
boolean enableAutoResume = embedInfo.hasKey("enableAutoResume") && embedInfo.getBoolean("enableAutoResume");
|
|
44
45
|
String preferredCaptionsLanguage = embedInfo.hasKey("preferredCaptionsLanguage") ?
|
|
45
|
-
|
|
46
|
+
embedInfo.getString("preferredCaptionsLanguage") : null;
|
|
47
|
+
String safetyNetApiKey = embedInfo.hasKey("safetyNetApiKey") ?
|
|
48
|
+
embedInfo.getString("safetyNetApiKey") : null;
|
|
49
|
+
boolean allowAdbDebugging = !embedInfo.hasKey("allowAdbDebugging") ||
|
|
50
|
+
embedInfo.getBoolean("allowAdbDebugging");
|
|
51
|
+
|
|
52
|
+
VdoInitParams.Builder builder = new VdoInitParams.Builder();
|
|
53
|
+
|
|
54
|
+
if (enableAutoResume) {
|
|
55
|
+
builder.enableAutoResume();
|
|
56
|
+
}
|
|
57
|
+
if (safetyNetApiKey != null) {
|
|
58
|
+
builder.setSafetyNetApiKey(safetyNetApiKey);
|
|
59
|
+
}
|
|
60
|
+
if (preferredCaptionsLanguage != null) {
|
|
61
|
+
builder.setPreferredCaptionsLanguage(preferredCaptionsLanguage);
|
|
62
|
+
}
|
|
46
63
|
|
|
47
64
|
if (offline) {
|
|
48
65
|
String mediaId = embedInfo.hasKey("mediaId") ? embedInfo.getString("mediaId") : null;
|
|
49
|
-
String safetyNetApiKey = embedInfo.hasKey("safetyNetApiKey") ?
|
|
50
|
-
embedInfo.getString("safetyNetApiKey") : null;
|
|
51
|
-
boolean allowAdbDebugging = !embedInfo.hasKey("allowAdbDebugging") ||
|
|
52
|
-
embedInfo.getBoolean("allowAdbDebugging");
|
|
53
|
-
|
|
54
66
|
|
|
55
|
-
|
|
56
|
-
.setOfflinePlayback(mediaId)
|
|
67
|
+
builder.setOfflinePlayback(mediaId)
|
|
57
68
|
.setAllowAdbDebugging(allowAdbDebugging);
|
|
58
69
|
|
|
59
|
-
if (enableAutoResume) {
|
|
60
|
-
builder.enableAutoResume();
|
|
61
|
-
}
|
|
62
|
-
if (safetyNetApiKey != null) {
|
|
63
|
-
builder.setSafetyNetApiKey(safetyNetApiKey);
|
|
64
|
-
}
|
|
65
|
-
if (preferredCaptionsLanguage != null) {
|
|
66
|
-
builder.setPreferredCaptionsLanguage(preferredCaptionsLanguage);
|
|
67
|
-
}
|
|
68
|
-
vdoParams = builder.build();
|
|
69
70
|
} else {
|
|
70
71
|
String otp = embedInfo.hasKey("otp") ? embedInfo.getString("otp") : null;
|
|
71
72
|
String playbackInfo = embedInfo.hasKey("playbackInfo") ? embedInfo.getString("playbackInfo") : null;
|
|
@@ -78,38 +79,38 @@ public class VdocipherRnBridgeModule extends ReactContextBaseJavaModule {
|
|
|
78
79
|
int bufferingGoalMs = embedInfo.hasKey("bufferingGoalMs") ?
|
|
79
80
|
embedInfo.getInt("bufferingGoalMs") : 0;
|
|
80
81
|
String[] overrides = getTechOverride(embedInfo);
|
|
81
|
-
String
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
82
|
+
String customPlayerId = null;
|
|
83
|
+
if (embedInfo.hasKey("customPlayerId")) {
|
|
84
|
+
customPlayerId = embedInfo.getString("customPlayerId");
|
|
85
|
+
} else if (embedInfo.hasKey("playerConfig")) {
|
|
86
|
+
customPlayerId = embedInfo.getString("playerConfig");
|
|
87
|
+
}
|
|
85
88
|
|
|
86
|
-
|
|
87
|
-
.setOtp(otp)
|
|
89
|
+
builder.setOtp(otp)
|
|
88
90
|
.setPlaybackInfo(playbackInfo)
|
|
89
91
|
.setAllowAdbDebugging(allowAdbDebugging)
|
|
90
92
|
.setForceLowestBitrate(forceLowestBitrate)
|
|
91
93
|
.setForceHighestSupportedBitrate(forceHighestSupportedBitrate)
|
|
92
94
|
.setMaxVideoBitrateKbps(maxVideoBitrateKbps);
|
|
93
95
|
|
|
94
|
-
if (enableAutoResume) {
|
|
95
|
-
builder.enableAutoResume();
|
|
96
|
-
}
|
|
97
96
|
if (bufferingGoalMs > 0) {
|
|
98
97
|
builder.setBufferingGoalMs(bufferingGoalMs);
|
|
99
98
|
}
|
|
100
99
|
if (overrides != null) {
|
|
101
100
|
builder.setTechOverride(overrides);
|
|
102
101
|
}
|
|
103
|
-
if (
|
|
104
|
-
builder.
|
|
105
|
-
}
|
|
106
|
-
if (preferredCaptionsLanguage != null) {
|
|
107
|
-
builder.setPreferredCaptionsLanguage(preferredCaptionsLanguage);
|
|
102
|
+
if (customPlayerId != null) {
|
|
103
|
+
builder.setCustomPlayer(customPlayerId);
|
|
108
104
|
}
|
|
109
|
-
vdoParams = builder.build();
|
|
110
105
|
}
|
|
111
106
|
|
|
112
|
-
|
|
107
|
+
HashMap<String, Object> map = new HashMap<>();
|
|
108
|
+
map.put("showFullScreen", false);
|
|
109
|
+
builder.updateConfig(map);
|
|
110
|
+
|
|
111
|
+
vdoParams = builder.build();
|
|
112
|
+
|
|
113
|
+
Intent intent = VdoPlayerActivity.getStartIntent(currentActivity, vdoParams, setPictureInPictureSupport);
|
|
113
114
|
currentActivity.startActivity(intent);
|
|
114
115
|
}
|
|
115
116
|
}
|
|
@@ -12,16 +12,21 @@ import com.facebook.react.bridge.JavaScriptModule;
|
|
|
12
12
|
|
|
13
13
|
public class VdocipherRnBridgePackage implements ReactPackage {
|
|
14
14
|
private ReactVdoPlayerViewManager vdoPlayerViewManager;
|
|
15
|
+
private ReactVdoPlayerUIViewManager vdoPlayerUIViewManager;
|
|
15
16
|
|
|
16
17
|
@Override
|
|
17
18
|
public List<NativeModule> createNativeModules(ReactApplicationContext reactContext) {
|
|
18
19
|
if (vdoPlayerViewManager == null) {
|
|
19
20
|
vdoPlayerViewManager = new ReactVdoPlayerViewManager();
|
|
20
21
|
}
|
|
22
|
+
if (vdoPlayerUIViewManager == null) {
|
|
23
|
+
vdoPlayerUIViewManager = new ReactVdoPlayerUIViewManager();
|
|
24
|
+
}
|
|
21
25
|
return Arrays.<NativeModule>asList(
|
|
22
26
|
new VdocipherRnBridgeModule(reactContext),
|
|
23
27
|
new VdoDownloadModule(reactContext),
|
|
24
|
-
new TrackSelectionModule(reactContext, vdoPlayerViewManager)
|
|
28
|
+
new TrackSelectionModule(reactContext, vdoPlayerViewManager, vdoPlayerUIViewManager),
|
|
29
|
+
new VdoPlayerModule(reactContext, vdoPlayerViewManager, vdoPlayerUIViewManager));
|
|
25
30
|
}
|
|
26
31
|
|
|
27
32
|
// Deprecated from RN 0.47
|
|
@@ -34,8 +39,11 @@ public class VdocipherRnBridgePackage implements ReactPackage {
|
|
|
34
39
|
if (vdoPlayerViewManager == null) {
|
|
35
40
|
vdoPlayerViewManager = new ReactVdoPlayerViewManager();
|
|
36
41
|
}
|
|
42
|
+
if (vdoPlayerUIViewManager == null) {
|
|
43
|
+
vdoPlayerUIViewManager = new ReactVdoPlayerUIViewManager();
|
|
44
|
+
}
|
|
37
45
|
return Arrays.<ViewManager>asList(
|
|
38
|
-
|
|
46
|
+
vdoPlayerUIViewManager,
|
|
39
47
|
vdoPlayerViewManager
|
|
40
48
|
);
|
|
41
49
|
}
|
|
@@ -12,20 +12,12 @@
|
|
|
12
12
|
android:layout_width="match_parent"
|
|
13
13
|
android:layout_height="wrap_content">
|
|
14
14
|
<fragment
|
|
15
|
-
android:name="com.vdocipher.aegis.
|
|
15
|
+
android:name="com.vdocipher.aegis.ui.view.VdoPlayerUIFragment"
|
|
16
16
|
android:id="@+id/online_vdo_player_fragment"
|
|
17
17
|
android:layout_width="match_parent"
|
|
18
18
|
android:layout_height="wrap_content"
|
|
19
19
|
android:layout_gravity="center"
|
|
20
20
|
android:keepScreenOn="true"/>
|
|
21
|
-
<com.vdocipher.rnbridge.VdoPlayerControlView
|
|
22
|
-
android:id="@+id/player_control_view"
|
|
23
|
-
android:layout_alignTop="@id/online_vdo_player_fragment"
|
|
24
|
-
android:layout_alignBottom="@id/online_vdo_player_fragment"
|
|
25
|
-
android:layout_alignLeft="@id/online_vdo_player_fragment"
|
|
26
|
-
android:layout_alignRight="@id/online_vdo_player_fragment"
|
|
27
|
-
android:layout_width="match_parent"
|
|
28
|
-
android:layout_height="wrap_content" />
|
|
29
21
|
</RelativeLayout>
|
|
30
22
|
|
|
31
23
|
</LinearLayout>
|
package/index.ts
CHANGED
|
@@ -16,9 +16,9 @@
|
|
|
16
16
|
|
|
17
17
|
const { VdocipherRnBridge } = NativeModules;
|
|
18
18
|
|
|
19
|
-
const startVideoScreen = (params: {embedInfo: EmbedInfo}) => {
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
const startVideoScreen = (params: {embedInfo: EmbedInfo}, setPictureInPictureSupport: boolean = false) => {
|
|
20
|
+
VdocipherRnBridge.startVideoScreen(params, setPictureInPictureSupport);
|
|
21
|
+
}
|
|
22
22
|
|
|
23
23
|
export {
|
|
24
24
|
startVideoScreen,
|
package/ios/.DS_Store
CHANGED
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vdocipher-rn-bridge",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.15.0",
|
|
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": {
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"author": "",
|
|
13
13
|
"license": "",
|
|
14
14
|
"peerDependencies": {
|
|
15
|
-
"react-native": "
|
|
15
|
+
"react-native": "0.68 - 0.71"
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
18
|
"deprecated-react-native-prop-types": "^2.3.0",
|
package/type.ts
CHANGED
|
@@ -101,6 +101,11 @@ export interface CaptionLanguage {
|
|
|
101
101
|
label: string;
|
|
102
102
|
}
|
|
103
103
|
|
|
104
|
+
export interface PlaybackProperty {
|
|
105
|
+
totalPlayed: number;
|
|
106
|
+
totalCovered: number;
|
|
107
|
+
}
|
|
108
|
+
|
|
104
109
|
export const VdoPropTypes = {
|
|
105
110
|
/* Native only */
|
|
106
111
|
onInitSuccess: PropTypes.func,
|