vdocipher-rn-bridge 1.16.0 → 1.17.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/CHANGELOG.md +14 -0
- package/VdoPlayerUIView.tsx +10 -10
- package/VdoPlayerView.tsx +170 -70
- package/android/build.gradle +3 -3
- package/android/src/main/java/com/vdocipher/rnbridge/ReactVdoPlayerUIView.java +13 -7
- package/android/src/main/java/com/vdocipher/rnbridge/VdoDownloadModule.java +67 -0
- package/downloadMonitor.ts +2 -2
- package/downloads.ts +41 -1
- package/index.ts +4 -1
- package/ios/Podfile +10 -0
- package/ios/Podfile.lock +3 -0
- package/ios/Pods/Manifest.lock +3 -0
- package/ios/Pods/Pods.xcodeproj/project.pbxproj +397 -0
- package/ios/Pods/Pods.xcodeproj/xcuserdata/mansisharma.xcuserdatad/xcschemes/Pods-VdocipherRnBridge.xcscheme +58 -0
- package/ios/Pods/Pods.xcodeproj/xcuserdata/mansisharma.xcuserdatad/xcschemes/xcschememanagement.plist +16 -0
- package/ios/Pods/Target Support Files/Pods-VdocipherRnBridge/Pods-VdocipherRnBridge-Info.plist +26 -0
- package/ios/Pods/Target Support Files/Pods-VdocipherRnBridge/Pods-VdocipherRnBridge-acknowledgements.markdown +3 -0
- package/ios/Pods/Target Support Files/Pods-VdocipherRnBridge/Pods-VdocipherRnBridge-acknowledgements.plist +29 -0
- package/ios/Pods/Target Support Files/Pods-VdocipherRnBridge/Pods-VdocipherRnBridge-dummy.m +5 -0
- package/ios/Pods/Target Support Files/Pods-VdocipherRnBridge/Pods-VdocipherRnBridge-umbrella.h +16 -0
- package/ios/Pods/Target Support Files/Pods-VdocipherRnBridge/Pods-VdocipherRnBridge.debug.xcconfig +8 -0
- package/ios/Pods/Target Support Files/Pods-VdocipherRnBridge/Pods-VdocipherRnBridge.modulemap +6 -0
- package/ios/Pods/Target Support Files/Pods-VdocipherRnBridge/Pods-VdocipherRnBridge.release.xcconfig +8 -0
- package/ios/RCTVdoPlayerUIView.h +19 -0
- package/ios/RCTVdoPlayerUIView.swift +36 -0
- package/ios/RCTVdoPlayerView.h +18 -0
- package/ios/RCTVdoPlayerView.swift +47 -0
- package/ios/TrackSelection.swift +64 -0
- package/ios/VdoCipherRNView.h +18 -0
- package/ios/VdoCipherRNView.swift +391 -0
- package/ios/VdoDownload.swift +453 -0
- package/ios/VdoEventEmitter.swift +157 -0
- package/ios/VdoPlaybackProperties.h +19 -0
- package/ios/VdoPlaybackProperties.swift +21 -0
- package/ios/VdocipherRnBridge.h +2 -10
- package/ios/VdocipherRnBridgeViewManager.m +106 -0
- package/ios/VdocipherRnBridgeViewManager.swift +90 -0
- package/package.json +3 -2
- package/react-native-vdocipher-rn-bridge.podspec +36 -0
- package/type.ts +23 -0
- package/ios/VdocipherRnBridge.m +0 -13
- package/ios/VdocipherRnBridge.xcodeproj/project.pbxproj +0 -259
- package/ios/VdocipherRnBridge.xcworkspace/contents.xcworkspacedata +0 -9
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,18 @@
|
|
|
1
1
|
## Changelog
|
|
2
|
+
### 1.17.1
|
|
3
|
+
* Added support for offline downloads in iOS
|
|
4
|
+
|
|
5
|
+
### 1.17.0
|
|
6
|
+
* Added support for iOS with native iOS sdk version as 2.4.3
|
|
7
|
+
* Updated VdoCipher Android SDK dependency to 1.22.1.
|
|
8
|
+
* Added option to pause and resume downloads.
|
|
9
|
+
* Bug fixes:
|
|
10
|
+
* minHeight getting overridden by sdk.
|
|
11
|
+
* NullPointerException when downloading using invalid params.
|
|
12
|
+
* IllegalStateException when opening new screen from player screen and coming back.
|
|
13
|
+
* NullPointerException on some devices when going fullscreen by using prop method in PlayerUI.
|
|
14
|
+
* ForegroundServiceStartNotAllowedException coming in Android 12 and above.
|
|
15
|
+
|
|
2
16
|
### 1.16.0
|
|
3
17
|
* Updated VdoCipher Android SDK dependency to 1.21.0.
|
|
4
18
|
* Added support for `windowLayoutInDisplayCutoutMode` with inbuilt player UI.
|
package/VdoPlayerUIView.tsx
CHANGED
|
@@ -79,25 +79,25 @@
|
|
|
79
79
|
* @deprecated
|
|
80
80
|
* Use {@link enterFullscreenV2} instead.
|
|
81
81
|
*/
|
|
82
|
-
|
|
82
|
+
enterFullscreen = () => {}
|
|
83
83
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
84
|
+
enterFullscreenV2 = () => {
|
|
85
|
+
if (this._root) {
|
|
86
|
+
this._root.setNativeProps({fullscreen: true});
|
|
87
|
+
}
|
|
87
88
|
}
|
|
88
|
-
}
|
|
89
89
|
|
|
90
90
|
/**
|
|
91
91
|
* @deprecated
|
|
92
92
|
* Use {@link exitFullscreenV2} instead.
|
|
93
93
|
*/
|
|
94
|
-
|
|
94
|
+
exitFullscreen = () => {}
|
|
95
95
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
96
|
+
exitFullscreenV2 = () => {
|
|
97
|
+
if (this._root) {
|
|
98
|
+
this._root.setNativeProps({fullscreen: false});
|
|
99
|
+
}
|
|
99
100
|
}
|
|
100
|
-
}
|
|
101
101
|
|
|
102
102
|
getPlaybackProperties = () => {
|
|
103
103
|
if (this._root) {
|
package/VdoPlayerView.tsx
CHANGED
|
@@ -3,11 +3,11 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import React, { Component, Fragment } from 'react';
|
|
5
5
|
import { InferProps } from 'prop-types';
|
|
6
|
-
import { BackHandler, NativeModules, StyleSheet, Dimensions} from 'react-native';
|
|
6
|
+
import { BackHandler, NativeModules, StyleSheet, Dimensions, NativeEventEmitter, Platform} 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, VdoPlayer } = NativeModules;
|
|
10
|
+
const { TrackSelection, VdoPlayer, VdoEventEmitter } = NativeModules;
|
|
11
11
|
|
|
12
12
|
const VdoViewPropTypes = VdoType.VdoPropTypes;
|
|
13
13
|
|
|
@@ -21,6 +21,7 @@ class VdoPlayerView extends Component<MyProps, MyState> {
|
|
|
21
21
|
_propRef: number;
|
|
22
22
|
_vdoPlayerView: any;
|
|
23
23
|
static propTypes: typeof VdoViewPropTypes;
|
|
24
|
+
eventEmitter: NativeEventEmitter;
|
|
24
25
|
|
|
25
26
|
constructor(props: MyProps) {
|
|
26
27
|
super(props);
|
|
@@ -30,6 +31,7 @@ class VdoPlayerView extends Component<MyProps, MyState> {
|
|
|
30
31
|
}
|
|
31
32
|
this.handleBackButtonClick = this.handleBackButtonClick.bind(this);
|
|
32
33
|
this._propRef = 1;
|
|
34
|
+
this.eventEmitter = new NativeEventEmitter(VdoEventEmitter);
|
|
33
35
|
}
|
|
34
36
|
|
|
35
37
|
componentDidMount() {
|
|
@@ -37,80 +39,151 @@ class VdoPlayerView extends Component<MyProps, MyState> {
|
|
|
37
39
|
if (this.props.style?.resizeMode) {
|
|
38
40
|
this._vdoPlayerView.setResizeMode(this.props.style.resizeMode);
|
|
39
41
|
}
|
|
42
|
+
|
|
43
|
+
this.eventEmitter.addListener('onInitSuccess', this._onInitSuccess)
|
|
44
|
+
|
|
45
|
+
this.eventEmitter.addListener('onVdoLoading', (data) => {
|
|
46
|
+
this._onLoading(this.props.embedInfo, data);
|
|
47
|
+
})
|
|
48
|
+
|
|
49
|
+
this.eventEmitter.addListener('onVdoLoadError', (data) => {
|
|
50
|
+
this._onLoadError(this.props.embedInfo, data);
|
|
51
|
+
})
|
|
52
|
+
|
|
53
|
+
this.eventEmitter.addListener('onVdoProgress', this._onProgress)
|
|
54
|
+
this.eventEmitter.addListener('onVdoLoaded', (data) => {
|
|
55
|
+
this._onLoaded(this.props.embedInfo, data);
|
|
56
|
+
})
|
|
57
|
+
|
|
58
|
+
this.eventEmitter.addListener('onVdoTracksChanged', (data) => {
|
|
59
|
+
this._onTracksChanged(data);
|
|
60
|
+
})
|
|
61
|
+
|
|
62
|
+
this.eventEmitter.addListener('onVdoMediaEnded', (data) => {
|
|
63
|
+
this._onMediaEnded(this.props.embedInfo, data);
|
|
64
|
+
})
|
|
65
|
+
|
|
66
|
+
this.eventEmitter.addListener('onVdoPlayerStateChanged', (data) => {
|
|
67
|
+
this._onPlayerStateChanged(data);
|
|
68
|
+
})
|
|
69
|
+
|
|
70
|
+
this.eventEmitter.addListener('onVdoEnterFullscreen', this._onEnterFullscreen)
|
|
71
|
+
|
|
72
|
+
this.eventEmitter.addListener('onVdoExitFullscreen', this._onExitFullscreen)
|
|
73
|
+
|
|
74
|
+
this.eventEmitter.addListener('onVdoPlaybackSpeedChanged', (data) => {
|
|
75
|
+
this._onPlaybackSpeedChanged(data);
|
|
76
|
+
})
|
|
40
77
|
}
|
|
41
78
|
|
|
42
79
|
componentWillUnmount() {
|
|
43
80
|
BackHandler.removeEventListener('hardwareBackPress', this.handleBackButtonClick);
|
|
81
|
+
this.eventEmitter.removeAllListeners('onInitSuccess');
|
|
82
|
+
this.eventEmitter.removeAllListeners('onVdoLoading');
|
|
83
|
+
this.eventEmitter.removeAllListeners('onVdoLoadError');
|
|
84
|
+
this.eventEmitter.removeAllListeners('onVdoLoaded');
|
|
85
|
+
this.eventEmitter.removeAllListeners('onVdoProgress');
|
|
86
|
+
this.eventEmitter.removeAllListeners('onVdoTracksChanged');
|
|
87
|
+
this.eventEmitter.removeAllListeners('onVdoMediaEnded');
|
|
88
|
+
this.eventEmitter.removeAllListeners('onVdoPlayerStateChanged');
|
|
89
|
+
this.eventEmitter.removeAllListeners('onVdoEnterFullscreen');
|
|
90
|
+
this.eventEmitter.removeAllListeners('onVdoExitFullscreen');
|
|
91
|
+
this.eventEmitter.removeAllListeners('onVdoPlaybackSpeedChanged');
|
|
44
92
|
}
|
|
45
93
|
|
|
46
94
|
handleBackButtonClick() {
|
|
47
95
|
if (!this.state.isInPictureInPictureMode && this.state.fullscreen && !(this.props.showNativeControls === false)) {
|
|
48
96
|
this._vdoPlayerView.handleBackButtonClick();
|
|
49
97
|
return true;
|
|
50
|
-
}
|
|
98
|
+
}
|
|
51
99
|
}
|
|
52
100
|
|
|
53
101
|
seek = (seekTargetMs: number) => {
|
|
54
|
-
|
|
55
|
-
|
|
102
|
+
if (this._vdoPlayerView) {
|
|
103
|
+
this._vdoPlayerView.seek(seekTargetMs);
|
|
104
|
+
}
|
|
56
105
|
}
|
|
57
|
-
}
|
|
58
106
|
|
|
59
107
|
/**
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
108
|
+
* @deprecated
|
|
109
|
+
* Use {@link enterFullscreenV2} instead.
|
|
110
|
+
*/
|
|
63
111
|
enterFullscreen = () => {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
112
|
+
if (Platform.OS == "ios" ) {
|
|
113
|
+
console.warn("Method not supported for iOS");
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
116
|
+
if (this.props.showNativeControls === false) {
|
|
117
|
+
console.warn('enterFullscreen method is deprecated. We advise handling fullscreen changes manually or utilizing our player with native controls which handles fullscreen automatically.');
|
|
118
|
+
} else {
|
|
119
|
+
console.warn('enterFullscreen method is deprecated. Please use enterFullscreenV2 instead.');
|
|
120
|
+
}
|
|
121
|
+
if (this._vdoPlayerView) {
|
|
122
|
+
this._vdoPlayerView.enterFullscreen();
|
|
123
|
+
}
|
|
68
124
|
}
|
|
69
|
-
if (this._vdoPlayerView) {
|
|
70
|
-
this._vdoPlayerView.enterFullscreen();
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
125
|
|
|
74
126
|
/**
|
|
75
|
-
|
|
76
|
-
|
|
127
|
+
* Works only with player with native controls
|
|
128
|
+
*/
|
|
77
129
|
enterFullscreenV2 = () => {
|
|
78
|
-
|
|
79
|
-
|
|
130
|
+
if (Platform.OS == "ios" ) {
|
|
131
|
+
console.warn("Method not supported for iOS");
|
|
132
|
+
return;
|
|
133
|
+
}
|
|
134
|
+
if (this._vdoPlayerView && !(this.props.showNativeControls === false)) {
|
|
135
|
+
this._vdoPlayerView.enterFullscreenV2();
|
|
136
|
+
}
|
|
80
137
|
}
|
|
81
|
-
}
|
|
82
138
|
|
|
83
139
|
/**
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
140
|
+
* @deprecated
|
|
141
|
+
* Use {@link exitFullscreenV2} instead.
|
|
142
|
+
*/
|
|
87
143
|
exitFullscreen = () => {
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
144
|
+
if (Platform.OS == "ios" ) {
|
|
145
|
+
console.warn("Method not supported for iOS");
|
|
146
|
+
return;
|
|
147
|
+
}
|
|
148
|
+
if (this.props.showNativeControls === false) {
|
|
149
|
+
console.warn('exitFullscreen method is deprecated. We advise handling fullscreen changes manually or utilizing our player with native controls which handles fullscreen automatically.');
|
|
150
|
+
} else {
|
|
151
|
+
console.warn('exitFullscreen method is deprecated. Please use exitFullscreenV2 instead.');
|
|
152
|
+
}
|
|
153
|
+
if (this._vdoPlayerView) {
|
|
154
|
+
this._vdoPlayerView.exitFullscreen();
|
|
155
|
+
}
|
|
95
156
|
}
|
|
96
|
-
}
|
|
97
157
|
|
|
98
|
-
|
|
158
|
+
/**
|
|
99
159
|
* Works only with player with native controls
|
|
100
160
|
*/
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
161
|
+
exitFullscreenV2 = () => {
|
|
162
|
+
if (Platform.OS == "ios" ) {
|
|
163
|
+
console.warn("Method not supported for iOS");
|
|
164
|
+
return;
|
|
165
|
+
}
|
|
166
|
+
if (this._vdoPlayerView && !(this.props.showNativeControls === false)) {
|
|
167
|
+
this._vdoPlayerView.exitFullscreenV2();
|
|
168
|
+
}
|
|
169
|
+
}
|
|
106
170
|
|
|
107
171
|
getPlaybackProperties = () => {
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
172
|
+
if (Platform.OS == "ios" ) {
|
|
173
|
+
console.warn("Method not supported for iOS");
|
|
174
|
+
return;
|
|
175
|
+
}
|
|
176
|
+
if (this._vdoPlayerView) {
|
|
177
|
+
this._vdoPlayerView.getPlaybackProperties();
|
|
178
|
+
}
|
|
179
|
+
}
|
|
112
180
|
|
|
113
181
|
isAdaptive = async() => {
|
|
182
|
+
if (Platform.OS == "ios" ) {
|
|
183
|
+
return new Promise(function(resolve, reject) {
|
|
184
|
+
reject("Method not supported for iOS");
|
|
185
|
+
});
|
|
186
|
+
}
|
|
114
187
|
return new Promise(async(resolve) => { await TrackSelection.isAdaptive((isAdaptive: boolean) => {
|
|
115
188
|
resolve(isAdaptive);
|
|
116
189
|
});
|
|
@@ -118,37 +191,60 @@ class VdoPlayerView extends Component<MyProps, MyState> {
|
|
|
118
191
|
}
|
|
119
192
|
|
|
120
193
|
getVideoQualities = async() => {
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
194
|
+
if (Platform.OS == "ios" ) {
|
|
195
|
+
return new Promise(function(resolve, reject) {
|
|
196
|
+
reject("Method not supported for iOS");
|
|
197
|
+
});
|
|
198
|
+
}
|
|
199
|
+
return new Promise(async(resolve) => { await TrackSelection.getVideoQualities((videoQualities: Array<VdoType.VideoQuality>) => {
|
|
200
|
+
resolve(videoQualities);
|
|
201
|
+
});
|
|
202
|
+
});
|
|
203
|
+
}
|
|
126
204
|
|
|
127
205
|
getSelectedVideoQuality = async() => {
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
206
|
+
if (Platform.OS == "ios" ) {
|
|
207
|
+
return new Promise(function(resolve, reject) {
|
|
208
|
+
reject("Method not supported for iOS");
|
|
209
|
+
});
|
|
210
|
+
}
|
|
211
|
+
return new Promise(async(resolve) => { await TrackSelection.getSelectedVideoQuality((selectedVideoQuality: VdoType.VideoQuality) => {
|
|
212
|
+
resolve(selectedVideoQuality);
|
|
213
|
+
});
|
|
214
|
+
});
|
|
215
|
+
}
|
|
133
216
|
|
|
134
217
|
setVideoQuality = (videoQuality: VdoType.VideoQuality) => {
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
218
|
+
if (Platform.OS == "ios" ) {
|
|
219
|
+
console.warn("Method not supported for iOS");
|
|
220
|
+
return;
|
|
221
|
+
}
|
|
222
|
+
if (this._vdoPlayerView) {
|
|
223
|
+
this._vdoPlayerView.setVideoQuality(videoQuality);
|
|
224
|
+
}
|
|
225
|
+
}
|
|
139
226
|
|
|
140
227
|
enableAdaptiveVideo = () => {
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
228
|
+
if (Platform.OS == "ios" ) {
|
|
229
|
+
console.warn("Method not supported for iOS");
|
|
230
|
+
return;
|
|
231
|
+
}
|
|
232
|
+
if (this._vdoPlayerView) {
|
|
233
|
+
this._vdoPlayerView.enableAdaptiveVideo();
|
|
234
|
+
}
|
|
235
|
+
}
|
|
145
236
|
|
|
146
237
|
getSelectedAudioQuality = async() => {
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
238
|
+
if (Platform.OS == "ios" ) {
|
|
239
|
+
return new Promise(function(resolve, reject) {
|
|
240
|
+
reject("Method not supported for iOS");
|
|
241
|
+
});
|
|
242
|
+
}
|
|
243
|
+
return new Promise(async(resolve) => { await TrackSelection.getSelectedAudioQuality((selectedAudioQuality: VdoType.AudioQuality) => {
|
|
244
|
+
resolve(selectedAudioQuality);
|
|
245
|
+
});
|
|
246
|
+
});
|
|
247
|
+
}
|
|
152
248
|
|
|
153
249
|
getCaptionLanguages = async() => {
|
|
154
250
|
return new Promise(async(resolve) => { await TrackSelection.getCaptionLanguages((captionLanguages: Array<VdoType.CaptionLanguage>) => {
|
|
@@ -184,10 +280,14 @@ class VdoPlayerView extends Component<MyProps, MyState> {
|
|
|
184
280
|
}
|
|
185
281
|
|
|
186
282
|
setAspectRatio = (aspectRatio: number) => {
|
|
187
|
-
|
|
188
|
-
|
|
283
|
+
if (Platform.OS == "ios" ) {
|
|
284
|
+
console.warn("Method not supported for iOS");
|
|
285
|
+
return;
|
|
286
|
+
}
|
|
287
|
+
if (this._vdoPlayerView) {
|
|
288
|
+
this._vdoPlayerView.setAspectRatio(aspectRatio);
|
|
289
|
+
}
|
|
189
290
|
}
|
|
190
|
-
}
|
|
191
291
|
|
|
192
292
|
getPlaybackPropertiesV2 = async() => {
|
|
193
293
|
return new Promise(async(resolve) => { await VdoPlayer.getPlaybackPropertiesV2((playbackProperties: VdoType.PlaybackProperty) => {
|
|
@@ -331,7 +431,7 @@ class VdoPlayerView extends Component<MyProps, MyState> {
|
|
|
331
431
|
(
|
|
332
432
|
<VdoPlayerUIView ref={vdoPlayerView => this._vdoPlayerView = vdoPlayerView}
|
|
333
433
|
{...this.props}
|
|
334
|
-
style={this.props.style ? [this.props.style
|
|
434
|
+
style={this.props.style ? [styles.playerWithUserStyles, this.props.style] : styles.player}
|
|
335
435
|
onInitSuccess={this._onInitSuccess}
|
|
336
436
|
onInitFailure={this._onInitFailure}
|
|
337
437
|
onVdoLoading={((embedInfo: VdoType.EmbedInfo | VdoType.OfflineEmbedInfo) => (event: any) => this._onLoading(embedInfo, event))(this.props.embedInfo)}
|
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.17.1"
|
|
22
|
+
def releaseVersionCode = 22
|
|
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.
|
|
89
|
+
implementation 'com.vdocipher.aegis:vdocipher-android:1.22.1'
|
|
90
90
|
}
|
|
@@ -91,7 +91,9 @@ public class ReactVdoPlayerUIView extends FrameLayout implements LifecycleEventL
|
|
|
91
91
|
try {
|
|
92
92
|
fragmentManager.beginTransaction().replace(getId(), vdoPlayerUIFragment, "VdoPlayerUIFragmentRN").commitAllowingStateLoss();
|
|
93
93
|
fragmentManager.executePendingTransactions();
|
|
94
|
-
|
|
94
|
+
if (isRunningOnTv(activity)) {
|
|
95
|
+
vdoPlayerControlView = vdoPlayerUIFragment.requireView().findViewById(R.id.vdo_player_control_view);
|
|
96
|
+
}
|
|
95
97
|
// initialize the playerFragment; a VdoPlayer instance will be received
|
|
96
98
|
// in onInitializationSuccess() callback
|
|
97
99
|
vdoPlayerUIFragment.initialize(initializationListener);
|
|
@@ -178,7 +180,7 @@ public class ReactVdoPlayerUIView extends FrameLayout implements LifecycleEventL
|
|
|
178
180
|
}
|
|
179
181
|
|
|
180
182
|
public void setKeyDownEvent(KeyEvent event) {
|
|
181
|
-
if (! vdoPlayerControlView.controllerVisible()) {
|
|
183
|
+
if (vdoPlayerControlView != null && ! vdoPlayerControlView.controllerVisible()) {
|
|
182
184
|
vdoPlayerControlView.onKeyDown(event.getKeyCode(), event);
|
|
183
185
|
}
|
|
184
186
|
}
|
|
@@ -381,15 +383,19 @@ public class ReactVdoPlayerUIView extends FrameLayout implements LifecycleEventL
|
|
|
381
383
|
|
|
382
384
|
|
|
383
385
|
public void setFullscreen(boolean setFullscreen) {
|
|
384
|
-
if (
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
386
|
+
if (vdoPlayerUIFragment != null) {
|
|
387
|
+
if (setFullscreen) {
|
|
388
|
+
vdoPlayerUIFragment.enterFullScreen();
|
|
389
|
+
} else {
|
|
390
|
+
vdoPlayerUIFragment.exitFullScreen();
|
|
391
|
+
}
|
|
388
392
|
}
|
|
389
393
|
}
|
|
390
394
|
|
|
391
395
|
public void setBackpressCalled() {
|
|
392
|
-
vdoPlayerUIFragment
|
|
396
|
+
if (vdoPlayerUIFragment != null) {
|
|
397
|
+
vdoPlayerUIFragment.setBackPressCalled();
|
|
398
|
+
}
|
|
393
399
|
}
|
|
394
400
|
|
|
395
401
|
// InitializationListener impl
|
|
@@ -56,10 +56,27 @@ public class VdoDownloadModule extends ReactContextBaseJavaModule implements Vdo
|
|
|
56
56
|
return "VdoDownload";
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
+
@ReactMethod
|
|
60
|
+
public void addListener(String eventName) {
|
|
61
|
+
// Keep: Required for RN built in Event Emitter Calls.
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
@ReactMethod
|
|
65
|
+
public void removeListeners(Integer count) {
|
|
66
|
+
// Keep: Required for RN built in Event Emitter Calls.
|
|
67
|
+
}
|
|
68
|
+
|
|
59
69
|
@ReactMethod
|
|
60
70
|
public void getDownloadOptions(ReadableMap optionParams,
|
|
61
71
|
Callback errorCallback,
|
|
62
72
|
Callback successCallback) {
|
|
73
|
+
if (optionParams == null) {
|
|
74
|
+
ErrorDescription errDesc = new ErrorDescription(
|
|
75
|
+
ErrorCodes.NULL_INIT_PARAMS, "Option Params not received ", -1);
|
|
76
|
+
errorCallback.invoke(
|
|
77
|
+
makeErrorDescriptionMap(errDesc)
|
|
78
|
+
);
|
|
79
|
+
}
|
|
63
80
|
String otp = optionParams.getString("otp");
|
|
64
81
|
String playbackInfo = optionParams.getString("playbackInfo");
|
|
65
82
|
String customPlayerId = null;
|
|
@@ -175,6 +192,56 @@ public class VdoDownloadModule extends ReactContextBaseJavaModule implements Vdo
|
|
|
175
192
|
}
|
|
176
193
|
}
|
|
177
194
|
|
|
195
|
+
@ReactMethod
|
|
196
|
+
public void stop(ReadableArray stopIds,
|
|
197
|
+
Callback errorCallback,
|
|
198
|
+
Callback successCallback) {
|
|
199
|
+
try {
|
|
200
|
+
// Read mediaIds to stop
|
|
201
|
+
final String[] mediaIdsToStop;
|
|
202
|
+
if (stopIds == null) {
|
|
203
|
+
mediaIdsToStop = new String[0];
|
|
204
|
+
} else {
|
|
205
|
+
mediaIdsToStop = new String[stopIds.size()];
|
|
206
|
+
for (int i = 0; i < stopIds.size(); i++) {
|
|
207
|
+
mediaIdsToStop[i] = stopIds.getString(i);
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
VdoDownloadManager vdoDownloadManager = VdoDownloadManager.getInstance(getReactApplicationContext());
|
|
212
|
+
vdoDownloadManager.stopDownloads(mediaIdsToStop);
|
|
213
|
+
successCallback.invoke();
|
|
214
|
+
} catch (RuntimeException e) {
|
|
215
|
+
Log.e(TAG, "error stopping: " + Log.getStackTraceString(e));
|
|
216
|
+
errorCallback.invoke(e.getClass().getName(), e.getMessage());
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
@ReactMethod
|
|
221
|
+
public void resume(ReadableArray resumeIds,
|
|
222
|
+
Callback errorCallback,
|
|
223
|
+
Callback successCallback) {
|
|
224
|
+
try {
|
|
225
|
+
// Read mediaIds to resume
|
|
226
|
+
final String[] mediaIdsToResume;
|
|
227
|
+
if (resumeIds == null) {
|
|
228
|
+
mediaIdsToResume = new String[0];
|
|
229
|
+
} else {
|
|
230
|
+
mediaIdsToResume = new String[resumeIds.size()];
|
|
231
|
+
for (int i = 0; i < resumeIds.size(); i++) {
|
|
232
|
+
mediaIdsToResume[i] = resumeIds.getString(i);
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
VdoDownloadManager vdoDownloadManager = VdoDownloadManager.getInstance(getReactApplicationContext());
|
|
237
|
+
vdoDownloadManager.resumeDownloads(mediaIdsToResume);
|
|
238
|
+
successCallback.invoke();
|
|
239
|
+
} catch (RuntimeException e) {
|
|
240
|
+
Log.e(TAG, "error resuming: " + Log.getStackTraceString(e));
|
|
241
|
+
errorCallback.invoke(e.getClass().getName(), e.getMessage());
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
|
|
178
245
|
@Override
|
|
179
246
|
public void onCatalystInstanceDestroy() {
|
|
180
247
|
super.onCatalystInstanceDestroy();
|
package/downloadMonitor.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { NativeEventEmitter } from 'react-native';
|
|
1
|
+
import { NativeEventEmitter, NativeModules } from 'react-native';
|
|
2
2
|
import { DownloadStatus } from './type';
|
|
3
3
|
|
|
4
|
-
const eventEmitter = new NativeEventEmitter();
|
|
4
|
+
const eventEmitter = new NativeEventEmitter(NativeModules.VdoDownload);
|
|
5
5
|
|
|
6
6
|
const nativeEvents = ['onQueued', 'onChanged', 'onCompleted', 'onFailed', 'onDeleted'];
|
|
7
7
|
|
package/downloads.ts
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* 4. Manage downloads (query or delete downloads)
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
import { NativeModules } from 'react-native';
|
|
9
|
+
import { NativeModules, Platform } from 'react-native';
|
|
10
10
|
import addEventListener from './downloadMonitor';
|
|
11
11
|
import * as VdoTypes from './type';
|
|
12
12
|
|
|
@@ -14,6 +14,10 @@ const { VdoDownload } = NativeModules;
|
|
|
14
14
|
|
|
15
15
|
const getDownloadOptions = (optionParams: VdoTypes.OfflineOptionParams) => {
|
|
16
16
|
|
|
17
|
+
if (optionParams.customPlayerId != null && Platform.OS == "ios") {
|
|
18
|
+
console.warn("customPlayerId will not be used for ios, instead default Custom Player config will be used");
|
|
19
|
+
}
|
|
20
|
+
|
|
17
21
|
return new Promise(function(resolve, reject) {
|
|
18
22
|
VdoDownload.getDownloadOptions(
|
|
19
23
|
optionParams,
|
|
@@ -32,6 +36,7 @@ const getDownloadOptions = (optionParams: VdoTypes.OfflineOptionParams) => {
|
|
|
32
36
|
|
|
33
37
|
const getEnqueueFn = (nativeId: string) => (downloadOptions: {selections: Array<number>}) => {
|
|
34
38
|
|
|
39
|
+
|
|
35
40
|
return new Promise<void>(function(resolve, reject) {
|
|
36
41
|
const requestOptions = {
|
|
37
42
|
selections: downloadOptions.selections
|
|
@@ -53,6 +58,7 @@ const getEnqueueFn = (nativeId: string) => (downloadOptions: {selections: Array<
|
|
|
53
58
|
|
|
54
59
|
const query = (queryFilters: {mediaId: Array<string>, status: Array<string>}) => {
|
|
55
60
|
|
|
61
|
+
|
|
56
62
|
return new Promise(function(resolve, reject) {
|
|
57
63
|
VdoDownload.query(
|
|
58
64
|
queryFilters,
|
|
@@ -83,12 +89,46 @@ const remove = (mediaIds: Array<string>) => {
|
|
|
83
89
|
});
|
|
84
90
|
};
|
|
85
91
|
|
|
92
|
+
const stop = (mediaIds: Array<string>) => {
|
|
93
|
+
|
|
94
|
+
return new Promise<void>(function(resolve, reject) {
|
|
95
|
+
VdoDownload.stop(
|
|
96
|
+
mediaIds,
|
|
97
|
+
(exception: string, msg: string) => {
|
|
98
|
+
reject({exception, msg});
|
|
99
|
+
},
|
|
100
|
+
() => {
|
|
101
|
+
// Stop request posted
|
|
102
|
+
resolve();
|
|
103
|
+
}
|
|
104
|
+
);
|
|
105
|
+
});
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
const resume = (mediaIds: Array<string>) => {
|
|
109
|
+
|
|
110
|
+
return new Promise<void>(function(resolve, reject) {
|
|
111
|
+
VdoDownload.resume(
|
|
112
|
+
mediaIds,
|
|
113
|
+
(exception: string, msg: string) => {
|
|
114
|
+
reject({exception, msg});
|
|
115
|
+
},
|
|
116
|
+
() => {
|
|
117
|
+
// Resume request posted
|
|
118
|
+
resolve();
|
|
119
|
+
}
|
|
120
|
+
);
|
|
121
|
+
});
|
|
122
|
+
};
|
|
123
|
+
|
|
86
124
|
export default VdoDownload;
|
|
87
125
|
|
|
88
126
|
module.exports = {
|
|
89
127
|
getDownloadOptions,
|
|
90
128
|
query,
|
|
91
129
|
remove,
|
|
130
|
+
stop,
|
|
131
|
+
resume,
|
|
92
132
|
addEventListener
|
|
93
133
|
};
|
|
94
134
|
|
package/index.ts
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* }
|
|
10
10
|
* })
|
|
11
11
|
*/
|
|
12
|
-
import { NativeModules } from 'react-native';
|
|
12
|
+
import { NativeModules, Platform } from 'react-native';
|
|
13
13
|
import VdoPlayerView from './VdoPlayerView';
|
|
14
14
|
import VdoDownload from './downloads';
|
|
15
15
|
import { EmbedInfo } from './type';
|
|
@@ -17,6 +17,9 @@
|
|
|
17
17
|
const { VdocipherRnBridge } = NativeModules;
|
|
18
18
|
|
|
19
19
|
const startVideoScreen = (params: {embedInfo: EmbedInfo}, setPictureInPictureSupport: boolean = false) => {
|
|
20
|
+
if (Platform.OS == "ios" && setPictureInPictureSupport == true) {
|
|
21
|
+
console.warn("setPictureInPictureSupport not supported for ios");
|
|
22
|
+
}
|
|
20
23
|
VdocipherRnBridge.startVideoScreen(params, setPictureInPictureSupport);
|
|
21
24
|
}
|
|
22
25
|
|
package/ios/Podfile
ADDED
package/ios/Podfile.lock
ADDED