vdocipher-rn-bridge 1.22.6 → 2.0.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.
Files changed (65) hide show
  1. package/VdoPlayerSupportView.tsx +12 -70
  2. package/VdoPlayerUIView.tsx +29 -90
  3. package/VdoPlayerView.tsx +36 -73
  4. package/android/build.gradle +23 -4
  5. package/android/src/main/AndroidManifest.xml +1 -2
  6. package/android/src/main/java/com/vdocipher/rnbridge/PlayerViewRegistry.java +34 -0
  7. package/android/src/main/java/com/vdocipher/rnbridge/ReactVdoPlayerUIView.java +7 -11
  8. package/android/src/main/java/com/vdocipher/rnbridge/{ReactVdoPlayerUIViewManager.java → ReactVdoPlayerUIViewManagerImpl.java} +66 -80
  9. package/android/src/main/java/com/vdocipher/rnbridge/ReactVdoPlayerView.java +8 -12
  10. package/android/src/main/java/com/vdocipher/rnbridge/{ReactVdoPlayerViewManager.java → ReactVdoPlayerViewManagerImpl.java} +61 -75
  11. package/android/src/main/java/com/vdocipher/rnbridge/TrackSelectionModuleImpl.java +64 -0
  12. package/android/src/main/java/com/vdocipher/rnbridge/Utils.java +27 -0
  13. package/android/src/main/java/com/vdocipher/rnbridge/{VdoDownloadModule.java → VdoDownloadModuleImpl.java} +23 -50
  14. package/android/src/main/java/com/vdocipher/rnbridge/VdoEventEmitter.java +51 -17
  15. package/android/src/main/java/com/vdocipher/rnbridge/VdoPlayerModuleImpl.java +28 -0
  16. package/android/src/main/java/com/vdocipher/rnbridge/{VdoPlayerSettingsModule.java → VdoPlayerSettingsModuleImpl.java} +3 -8
  17. package/android/src/main/java/com/vdocipher/rnbridge/{VdoPreCacheManagerModule.java → VdoPreCacheManagerModuleImpl.java} +3 -10
  18. package/android/src/main/java/com/vdocipher/rnbridge/{VdocipherRnBridgeModule.java → VdocipherRnBridgeModuleImpl.java} +5 -16
  19. package/android/src/main/java/com/vdocipher/rnbridge/VdocipherRnBridgePackage.java +13 -27
  20. package/android/src/newarch/java/com/vdocipher/rnbridge/ReactVdoPlayerUIViewManager.java +195 -0
  21. package/android/src/newarch/java/com/vdocipher/rnbridge/ReactVdoPlayerViewManager.java +174 -0
  22. package/android/src/newarch/java/com/vdocipher/rnbridge/TrackSelectionModule.java +61 -0
  23. package/android/src/newarch/java/com/vdocipher/rnbridge/VdoDownloadModule.java +129 -0
  24. package/android/src/newarch/java/com/vdocipher/rnbridge/VdoPlayerModule.java +29 -0
  25. package/android/src/newarch/java/com/vdocipher/rnbridge/VdoPlayerSettingsModule.java +42 -0
  26. package/android/src/newarch/java/com/vdocipher/rnbridge/VdoPreCacheManagerModule.java +43 -0
  27. package/android/src/newarch/java/com/vdocipher/rnbridge/VdocipherRnBridgeModule.java +44 -0
  28. package/android/src/oldarch/java/com/vdocipher/rnbridge/ReactVdoPlayerUIViewManager.java +114 -0
  29. package/android/src/oldarch/java/com/vdocipher/rnbridge/ReactVdoPlayerViewManager.java +109 -0
  30. package/android/src/oldarch/java/com/vdocipher/rnbridge/TrackSelectionModule.java +59 -0
  31. package/android/src/oldarch/java/com/vdocipher/rnbridge/VdoDownloadModule.java +132 -0
  32. package/android/src/oldarch/java/com/vdocipher/rnbridge/VdoPlayerModule.java +29 -0
  33. package/android/src/oldarch/java/com/vdocipher/rnbridge/VdoPlayerSettingsModule.java +40 -0
  34. package/android/src/oldarch/java/com/vdocipher/rnbridge/VdoPreCacheManagerModule.java +40 -0
  35. package/android/src/oldarch/java/com/vdocipher/rnbridge/VdocipherRnBridgeModule.java +40 -0
  36. package/downloads.ts +5 -5
  37. package/ios/AssetList.swift +27 -0
  38. package/ios/RCTVdoPlayerUIView.h +4 -4
  39. package/ios/RCTVdoPlayerUIView.swift +2 -1
  40. package/ios/RCTVdoPlayerUIViewComponentView.mm +127 -0
  41. package/ios/RCTVdoPlayerView.swift +1 -0
  42. package/ios/RCTVdoPlayerViewComponentView.mm +127 -0
  43. package/ios/VdoCipherRNView.h +16 -3
  44. package/ios/VdoCipherRNView.swift +45 -9
  45. package/ios/VdoDownload.swift +74 -76
  46. package/ios/VdoPlayerCommandDispatch.h +52 -0
  47. package/ios/VdoPreCacheManager.swift +1 -1
  48. package/ios/VdocipherRnBridgeViewManager.mm +234 -0
  49. package/ios/VdocipherRnBridgeViewManager.swift +4 -4
  50. package/package.json +46 -3
  51. package/react-native-vdocipher-rn-bridge.podspec +1 -1
  52. package/specs/NativeTrackSelection.ts +38 -0
  53. package/specs/NativeVdoDownload.ts +76 -0
  54. package/specs/NativeVdoEventEmitter.ts +12 -0
  55. package/specs/NativeVdoPlayer.ts +11 -0
  56. package/specs/NativeVdoPlayerSettings.ts +13 -0
  57. package/specs/NativeVdoPreCacheManager.ts +12 -0
  58. package/specs/NativeVdocipherRnBridge.ts +11 -0
  59. package/specs/RCTVdoPlayerUIViewNativeComponent.ts +93 -0
  60. package/specs/RCTVdoPlayerViewNativeComponent.ts +84 -0
  61. package/tsconfig.json +1 -1
  62. package/type.ts +84 -90
  63. package/android/src/main/java/com/vdocipher/rnbridge/TrackSelectionModule.java +0 -126
  64. package/android/src/main/java/com/vdocipher/rnbridge/VdoPlayerModule.java +0 -54
  65. package/ios/VdocipherRnBridgeViewManager.m +0 -126
@@ -2,97 +2,39 @@
2
2
  * VdoPlayerView component that can be dropped into a layout for video playback.
3
3
  */
4
4
  import React, { Component } from 'react';
5
- import { requireNativeComponent} from 'react-native';
6
- import { InferProps } from 'prop-types';
7
- import { VdoPropTypes, VideoQuality, CaptionLanguage } from './type';
5
+ import { VdoPlayerProps } from './type';
6
+ import RCTVdoPlayerView, { NativeProps as RCTVdoPlayerViewNativeProps } from "./specs/RCTVdoPlayerViewNativeComponent";
8
7
 
9
- const VdoViewPropTypes = VdoPropTypes;
10
- type MyProps = InferProps<typeof VdoViewPropTypes>;
8
+ type MyProps = VdoPlayerProps;
9
+ type MyState = { resizeMode?: string; aspectRatio?: number };
11
10
 
12
- class VdoPlayerSupportView extends Component<MyProps> {
11
+ class VdoPlayerSupportView extends Component<MyProps, MyState> {
13
12
  _propRef: number;
14
13
  _root: any;
15
14
 
16
15
  constructor(props: MyProps) {
17
16
  super(props);
18
17
  this._propRef = 1;
18
+ this.state = {};
19
19
  }
20
20
 
21
- seek = (seekTargetMs: number) => {
22
- if (this._root) {
23
- this._root.setNativeProps({seek: seekTargetMs});
24
- }
25
- }
26
-
27
- /**
28
- * @deprecated
29
- */
30
- enterFullscreen = () => {
31
- if (this._root) {
32
- this._root.setNativeProps({fullscreen: true});
33
- }
34
- }
35
-
36
- /**
37
- * @deprecated
38
- */
39
- exitFullscreen = () => {
40
- if (this._root) {
41
- this._root.setNativeProps({fullscreen: false});
42
- }
43
- }
44
-
45
- getPlaybackProperties = () => {
46
- if (this._root) {
47
- this._root.setNativeProps({playbackProperties: this._propRef++});
48
- }
49
- }
50
-
51
- setVideoQuality = (videoQuality: VideoQuality) => {
52
- if (this._root) {
53
- this._root.setNativeProps({videoQuality: videoQuality});
54
- }
55
- }
56
-
57
- enableAdaptiveVideo = () => {
58
- if (this._root) {
59
- this._root.setNativeProps({adaptiveVideo: this._propRef++});
60
- }
61
- }
62
-
63
- setCaptionLanguage = (captionLanguage: CaptionLanguage) => {
64
- if (this._root) {
65
- this._root.setNativeProps({captionLanguage: captionLanguage});
66
- }
67
- }
68
-
69
- disableCaptions = () => {
70
- if (this._root) {
71
- this._root.setNativeProps({disableCaptions: this._propRef++});
72
- }
73
- }
74
-
75
- setResizeMode = (resizeMode: String) => {
76
- if (this._root) {
77
- this._root.setNativeProps({resizeMode: resizeMode});
78
- }
21
+ setResizeMode = (resizeMode: string) => {
22
+ this.setState({ resizeMode });
79
23
  }
80
24
 
81
25
  setAspectRatio = (aspectRatio: number) => {
82
- if (this._root) {
83
- this._root.setNativeProps({aspectRatio: aspectRatio});
84
- }
26
+ this.setState({ aspectRatio });
85
27
  }
86
28
 
87
29
  render() {
88
30
  return (
89
31
  <RCTVdoPlayerView ref={(component: any) => this._root = component}
90
- {...this.props}
32
+ {...(this.props as unknown as RCTVdoPlayerViewNativeProps)}
33
+ resizeMode={this.state.resizeMode}
34
+ aspectRatio={this.state.aspectRatio}
91
35
  />
92
36
  );
93
37
  }
94
38
  }
95
39
 
96
- var RCTVdoPlayerView = requireNativeComponent('RCTVdoPlayerView');
97
-
98
40
  export default VdoPlayerSupportView;
@@ -2,20 +2,21 @@
2
2
  * VdoPlayerUIView component that can be dropped into a layout for video playback.
3
3
  */
4
4
  import React, { Component } from 'react';
5
- import {requireNativeComponent, Platform} from 'react-native';
6
- import { InferProps } from 'prop-types';
7
- import { CaptionLanguage, VdoPropTypes, VideoQuality } from './type';
5
+ import { findNodeHandle, Platform, UIManager} from 'react-native';
6
+ import { VdoPlayerProps } from './type';
7
+ import RCTVdoPlayerUIView, { NativeProps as RCTVdoPlayerUIViewNativeProps } from "./specs/RCTVdoPlayerUIViewNativeComponent";
8
8
 
9
- const VdoViewPropTypes = VdoPropTypes;
10
- type MyProps = InferProps<typeof VdoViewPropTypes>;
11
-
12
- class VdoPlayerUIView extends Component<MyProps> {
9
+ type MyProps = VdoPlayerProps;
10
+ type MyState = { resizeMode?: string; aspectRatio?: number };
11
+
12
+ class VdoPlayerUIView extends Component<MyProps, MyState> {
13
13
  _propRef: number;
14
14
  _root: any;
15
15
  _tvEventHandler: any;
16
16
  constructor(props: MyProps) {
17
17
  super(props);
18
18
  this._propRef = 1;
19
+ this.state = {};
19
20
  }
20
21
 
21
22
  componentDidMount() {
@@ -65,105 +66,43 @@
65
66
  }
66
67
  }
67
68
 
68
- setScreenFocused() {
69
- this._root.setNativeProps({screenFocused: true});
70
- }
71
-
72
- setScreenBlurred() {
73
- this._root.setNativeProps({screenFocused: false});
74
- }
75
-
76
69
  handleBackButtonClick() {
77
- this._root.setNativeProps({backpressCalled: this._propRef++});
78
- }
79
-
80
- seek = (seekTargetMs: number) => {
81
- if (this._root) {
82
- this._root.setNativeProps({seek: seekTargetMs});
83
- }
84
- }
85
-
86
- /**
87
- * @deprecated
88
- * Use {@link enterFullscreenV2} instead.
89
- */
90
- enterFullscreen = () => {}
91
-
92
- enterFullscreenV2 = () => {
93
- if (this._root) {
94
- this._root.setNativeProps({fullscreen: true});
95
- }
96
- }
97
-
98
- /**
99
- * @deprecated
100
- * Use {@link exitFullscreenV2} instead.
101
- */
102
- exitFullscreen = () => {}
103
-
104
- exitFullscreenV2 = () => {
105
- if (this._root) {
106
- this._root.setNativeProps({fullscreen: false});
107
- }
108
- }
109
-
110
- getPlaybackProperties = () => {
111
- if (this._root) {
112
- this._root.setNativeProps({playbackProperties: this._propRef++});
113
- }
70
+ // TODO: migrate to codegenNativeCommands; UIManager/findNodeHandle are deprecated on new arch.
71
+ UIManager.dispatchViewManagerCommand(
72
+ findNodeHandle(this._root),
73
+ 'handleBackPress',
74
+ []
75
+ );
114
76
  }
115
77
 
116
78
  setKeyDownEvent = (keyDownEvent: any) => {
117
- if (this._root) {
118
- this._root.setNativeProps({keyDownEvent: keyDownEvent});
119
- }
79
+ // TODO: migrate to codegenNativeCommands; UIManager/findNodeHandle are deprecated on new arch.
80
+ UIManager.dispatchViewManagerCommand(
81
+ findNodeHandle(this._root),
82
+ 'keyDownEvent',
83
+ [keyDownEvent] // Pass the event object
84
+ );
120
85
  }
121
86
 
122
- setResizeMode = (resizeMode: String) => {
123
- if (this._root) {
124
- this._root.setNativeProps({resizeMode: resizeMode});
125
- }
87
+ // Drive through state so the value applies on both old arch and Fabric.
88
+ // (setNativeProps is a no-op for custom views on the new architecture.)
89
+ setResizeMode = (resizeMode: string) => {
90
+ this.setState({ resizeMode });
126
91
  }
127
92
 
128
93
  setAspectRatio = (aspectRatio: number) => {
129
- if (this._root) {
130
- this._root.setNativeProps({aspectRatio: aspectRatio});
131
- }
94
+ this.setState({ aspectRatio });
132
95
  }
133
96
 
134
- setVideoQuality = (videoQuality: VideoQuality) => {
135
- if (this._root) {
136
- this._root.setNativeProps({videoQuality: videoQuality});
137
- }
138
- }
139
-
140
- enableAdaptiveVideo = () => {
141
- if (this._root) {
142
- this._root.setNativeProps({adaptiveVideo: this._propRef++});
143
- }
144
- }
145
-
146
- setCaptionLanguage = (captionLanguage: CaptionLanguage) => {
147
- if (this._root) {
148
- this._root.setNativeProps({captionLanguage: captionLanguage});
149
- }
150
- }
151
-
152
- disableCaptions = () => {
153
- if (this._root) {
154
- this._root.setNativeProps({disableCaptions: this._propRef++});
155
- }
156
- }
157
-
158
97
  render() {
159
98
  return (
160
99
  <RCTVdoPlayerUIView ref={(component: any) => this._root = component}
161
- {...this.props}
100
+ {...(this.props as unknown as RCTVdoPlayerUIViewNativeProps)}
101
+ resizeMode={this.state.resizeMode}
102
+ aspectRatio={this.state.aspectRatio}
162
103
  />
163
104
  );
164
105
  }
165
106
  }
166
-
167
- var RCTVdoPlayerUIView = requireNativeComponent('RCTVdoPlayerUIView');
168
-
107
+
169
108
  export default VdoPlayerUIView;
package/VdoPlayerView.tsx CHANGED
@@ -2,8 +2,9 @@
2
2
  * VdoPlayerView component that can be dropped into a layout for video playback.
3
3
  */
4
4
  import React, { Component, Fragment } from 'react';
5
- import { InferProps } from 'prop-types';
6
- import { BackHandler, NativeModules, StyleSheet, Dimensions, NativeEventEmitter, Platform} from 'react-native';
5
+ import { BackHandler, NativeModules, StyleSheet, Dimensions, NativeEventEmitter, Platform } from 'react-native';
6
+ import { Commands as VdoPlayerCommands } from './specs/RCTVdoPlayerViewNativeComponent';
7
+ import { Commands as VdoPlayerUICommands } from './specs/RCTVdoPlayerUIViewNativeComponent';
7
8
  import VdoPlayerSupportView from './VdoPlayerSupportView';
8
9
  import VdoPlayerUIView from './VdoPlayerUIView';
9
10
  import * as VdoType from './type';
@@ -14,7 +15,7 @@ const { TrackSelection, VdoPlayer, VdoEventEmitter } = NativeModules;
14
15
 
15
16
  const VdoViewPropTypes = VdoType.VdoPropTypes;
16
17
 
17
- type MyProps = InferProps<typeof VdoViewPropTypes>;
18
+ type MyProps = VdoType.VdoPlayerProps;
18
19
  type MyState = {
19
20
  fullscreen: boolean;
20
21
  isInPictureInPictureMode: false;
@@ -121,13 +122,13 @@ class VdoPlayerView extends Component<MyProps, MyState> {
121
122
 
122
123
  onScreenFocused = () => {
123
124
  if (this._vdoPlayerView) {
124
- this._vdoPlayerView.setScreenFocused();
125
+ VdoPlayerUICommands.setScreenFocused(this._vdoPlayerView._root);
125
126
  }
126
127
  };
127
128
 
128
129
  onScreenBlurred = () => {
129
130
  if (this._vdoPlayerView) {
130
- this._vdoPlayerView.setScreenBlurred();
131
+ VdoPlayerUICommands.setScreenBlurred(this._vdoPlayerView._root);
131
132
  }
132
133
  };
133
134
 
@@ -140,26 +141,7 @@ class VdoPlayerView extends Component<MyProps, MyState> {
140
141
 
141
142
  seek = (seekTargetMs: number) => {
142
143
  if (this._vdoPlayerView) {
143
- this._vdoPlayerView.seek(seekTargetMs);
144
- }
145
- }
146
-
147
- /**
148
- * @deprecated
149
- * Use {@link enterFullscreenV2} instead.
150
- */
151
- enterFullscreen = () => {
152
- if (Platform.OS == "ios" ) {
153
- console.warn("Method not supported for iOS");
154
- return;
155
- }
156
- if (this.props.showNativeControls === false) {
157
- console.warn('enterFullscreen method is deprecated. We advise handling fullscreen changes manually or utilizing our player with native controls which handles fullscreen automatically.');
158
- } else {
159
- console.warn('enterFullscreen method is deprecated. Please use enterFullscreenV2 instead.');
160
- }
161
- if (this._vdoPlayerView) {
162
- this._vdoPlayerView.enterFullscreen();
144
+ VdoPlayerCommands.seek(this._vdoPlayerView._root, seekTargetMs);
163
145
  }
164
146
  }
165
147
 
@@ -168,26 +150,7 @@ class VdoPlayerView extends Component<MyProps, MyState> {
168
150
  */
169
151
  enterFullscreenV2 = () => {
170
152
  if (this._vdoPlayerView && !(this.props.showNativeControls === false)) {
171
- this._vdoPlayerView.enterFullscreenV2();
172
- }
173
- }
174
-
175
- /**
176
- * @deprecated
177
- * Use {@link exitFullscreenV2} instead.
178
- */
179
- exitFullscreen = () => {
180
- if (Platform.OS == "ios" ) {
181
- console.warn("Method not supported for iOS");
182
- return;
183
- }
184
- if (this.props.showNativeControls === false) {
185
- console.warn('exitFullscreen method is deprecated. We advise handling fullscreen changes manually or utilizing our player with native controls which handles fullscreen automatically.');
186
- } else {
187
- console.warn('exitFullscreen method is deprecated. Please use exitFullscreenV2 instead.');
188
- }
189
- if (this._vdoPlayerView) {
190
- this._vdoPlayerView.exitFullscreen();
153
+ VdoPlayerUICommands.enterFullscreen(this._vdoPlayerView._root);
191
154
  }
192
155
  }
193
156
 
@@ -196,17 +159,25 @@ class VdoPlayerView extends Component<MyProps, MyState> {
196
159
  */
197
160
  exitFullscreenV2 = () => {
198
161
  if (this._vdoPlayerView && !(this.props.showNativeControls === false)) {
199
- this._vdoPlayerView.exitFullscreenV2();
162
+ VdoPlayerUICommands.exitFullscreen(this._vdoPlayerView._root);
200
163
  }
201
164
  }
202
165
 
203
- getPlaybackProperties = () => {
204
- if (Platform.OS == "ios" ) {
205
- console.warn("Method not supported for iOS");
206
- return;
166
+ play = () => {
167
+ if (this._vdoPlayerView) {
168
+ VdoPlayerCommands.play(this._vdoPlayerView._root);
207
169
  }
170
+ }
171
+
172
+ pause = () => {
208
173
  if (this._vdoPlayerView) {
209
- this._vdoPlayerView.getPlaybackProperties();
174
+ VdoPlayerCommands.pause(this._vdoPlayerView._root);
175
+ }
176
+ }
177
+
178
+ setPlaybackSpeed = (playbackSpeed: number) => {
179
+ if (this._vdoPlayerView) {
180
+ VdoPlayerCommands.playbackSpeed(this._vdoPlayerView._root, playbackSpeed);
210
181
  }
211
182
  }
212
183
 
@@ -231,15 +202,15 @@ class VdoPlayerView extends Component<MyProps, MyState> {
231
202
  });
232
203
  }
233
204
 
234
- setVideoQuality = (videoQuality: VdoType.VideoQuality) => {
205
+ setVideoQuality = (videoQuality: VdoType.VideoQuality) => {
235
206
  if (this._vdoPlayerView) {
236
- this._vdoPlayerView.setVideoQuality(videoQuality);
207
+ VdoPlayerCommands.setVideoQuality(this._vdoPlayerView._root, JSON.stringify(videoQuality));
237
208
  }
238
209
  }
239
210
 
240
- enableAdaptiveVideo = () => {
211
+ enableAdaptiveVideo = () => {
241
212
  if (this._vdoPlayerView) {
242
- this._vdoPlayerView.enableAdaptiveVideo();
213
+ VdoPlayerCommands.enableAdaptiveVideo(this._vdoPlayerView._root);
243
214
  }
244
215
  }
245
216
 
@@ -270,16 +241,16 @@ class VdoPlayerView extends Component<MyProps, MyState> {
270
241
  }
271
242
 
272
243
  setCaptionLanguage = (captionLanguage: VdoType.CaptionLanguage) => {
273
- if (this._vdoPlayerView) {
274
- this._vdoPlayerView.setCaptionLanguage(captionLanguage);
275
- }
276
- }
244
+ if (this._vdoPlayerView) {
245
+ VdoPlayerCommands.setCaptionLanguage(this._vdoPlayerView._root, JSON.stringify(captionLanguage));
246
+ }
247
+ }
277
248
 
278
249
  disableCaptions = () => {
279
- if (this._vdoPlayerView) {
280
- this._vdoPlayerView.disableCaptions();
281
- }
282
- }
250
+ if (this._vdoPlayerView) {
251
+ VdoPlayerCommands.disableCaptions(this._vdoPlayerView._root);
252
+ }
253
+ }
283
254
 
284
255
  getDuration = async() => {
285
256
  return new Promise(async(resolve) => { await TrackSelection.getDuration((duration: number) => {
@@ -377,12 +348,6 @@ class VdoPlayerView extends Component<MyProps, MyState> {
377
348
  }
378
349
  }
379
350
 
380
- _onPlaybackProperties = (event: any) => {
381
- if (this.props.onPlaybackProperties) {
382
- this.props.onPlaybackProperties(event.nativeEvent);
383
- }
384
- }
385
-
386
351
  _onEnterFullscreen = () => {
387
352
  this.setState({
388
353
  fullscreen: true
@@ -417,7 +382,7 @@ class VdoPlayerView extends Component<MyProps, MyState> {
417
382
  <Fragment>
418
383
  {
419
384
  this.props.showNativeControls === false ? (
420
- <VdoPlayerSupportView ref={vdoPlayerView => this._vdoPlayerView = vdoPlayerView}
385
+ <VdoPlayerSupportView ref={vdoPlayerView => { this._vdoPlayerView = vdoPlayerView; }}
421
386
  {...this.props}
422
387
  onInitSuccess={this._onInitSuccess}
423
388
  onInitFailure={this._onInitFailure}
@@ -431,14 +396,13 @@ class VdoPlayerView extends Component<MyProps, MyState> {
431
396
  onVdoTracksChanged={this._onTracksChanged}
432
397
  onVdoMediaEnded={((embedInfo: VdoType.EmbedInfo | VdoType.OfflineEmbedInfo) => (event: any) => this._onMediaEnded(embedInfo, event))(this.props.embedInfo)}
433
398
  onVdoError={((embedInfo: VdoType.EmbedInfo | VdoType.OfflineEmbedInfo) => (event: any) => this._onError(embedInfo, event))(this.props.embedInfo)}
434
- onVdoPlaybackProperties={this._onPlaybackProperties}
435
399
  onVdoEnterFullscreen={this._onEnterFullscreen}
436
400
  onVdoExitFullscreen={this._onExitFullscreen}
437
401
  onVdoPictureInPictureModeChanged={this._onPictureInPictureModeChanged}
438
402
  />
439
403
  ) :
440
404
  (
441
- <VdoPlayerUIView ref={vdoPlayerView => this._vdoPlayerView = vdoPlayerView}
405
+ <VdoPlayerUIView ref={vdoPlayerView => { this._vdoPlayerView = vdoPlayerView; }}
442
406
  {...this.props}
443
407
  style={this.props.style ? [styles.playerWithUserStyles, this.props.style] : styles.player}
444
408
  onInitSuccess={this._onInitSuccess}
@@ -453,7 +417,6 @@ class VdoPlayerView extends Component<MyProps, MyState> {
453
417
  onVdoTracksChanged={this._onTracksChanged}
454
418
  onVdoMediaEnded={((embedInfo: VdoType.EmbedInfo | VdoType.OfflineEmbedInfo) => (event: any) => this._onMediaEnded(embedInfo, event))(this.props.embedInfo)}
455
419
  onVdoError={((embedInfo: VdoType.EmbedInfo | VdoType.OfflineEmbedInfo) => (event: any) => this._onError(embedInfo, event))(this.props.embedInfo)}
456
- onVdoPlaybackProperties={this._onPlaybackProperties}
457
420
  onVdoEnterFullscreen={this._onEnterFullscreen}
458
421
  onVdoExitFullscreen={this._onExitFullscreen}
459
422
  onVdoPictureInPictureModeChanged={this._onPictureInPictureModeChanged}
@@ -8,17 +8,25 @@ buildscript {
8
8
  mavenCentral()
9
9
  }
10
10
  dependencies {
11
- classpath 'com.android.tools.build:gradle:8.13.0'
11
+ classpath 'com.android.tools.build:gradle:8.13.0'
12
12
  }
13
13
  }
14
14
 
15
15
  apply plugin: 'com.android.library'
16
16
 
17
+ if (project.hasProperty("newArchEnabled") && project.newArchEnabled == "true") {
18
+ apply plugin: "com.facebook.react"
19
+ }
20
+
17
21
  // TODO read from package.json
18
22
  // "releaseVersionName" must be the same as "version" in package.json
19
23
  // "releaseVersionCode" must increment by 1 with every release
20
- def releaseVersionName = "1.22.6"
21
- def releaseVersionCode = 56
24
+ def releaseVersionName = "2.0.0"
25
+ def releaseVersionCode = 58
26
+
27
+ def isNewArchitectureEnabled() {
28
+ return project.hasProperty("newArchEnabled") && project.newArchEnabled == "true"
29
+ }
22
30
 
23
31
  android {
24
32
  namespace = "com.vdocipher.rnbridge"
@@ -31,6 +39,17 @@ android {
31
39
  // Generate BuildConfig fields for library version info
32
40
  buildConfigField "int", "VDO_VERSION_CODE", "${releaseVersionCode}"
33
41
  buildConfigField "String", "VDO_VERSION_NAME", "\"${releaseVersionName}\""
42
+ buildConfigField("boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString())
43
+ }
44
+
45
+ sourceSets {
46
+ main {
47
+ if (isNewArchitectureEnabled()) {
48
+ java.srcDirs += ['src/newarch']
49
+ } else {
50
+ java.srcDirs += ['src/oldarch']
51
+ }
52
+ }
34
53
  }
35
54
 
36
55
  lint {
@@ -87,5 +106,5 @@ repositories {
87
106
  dependencies {
88
107
  compileOnly("com.facebook.react:react-native:+")
89
108
  implementation("androidx.appcompat:appcompat:1.3.1")
90
- implementation("com.vdocipher.aegis:vdocipher-android:1.29.6")
109
+ implementation("com.vdocipher.aegis:vdocipher-android:1.29.8")
91
110
  }
@@ -1,6 +1,5 @@
1
1
 
2
- <manifest xmlns:android="http://schemas.android.com/apk/res/android"
3
- package="com.vdocipher.rnbridge">
2
+ <manifest xmlns:android="http://schemas.android.com/apk/res/android">
4
3
 
5
4
  <application>
6
5
  <activity android:name=".VdoPlayerActivity"
@@ -0,0 +1,34 @@
1
+ package com.vdocipher.rnbridge;
2
+
3
+ public class PlayerViewRegistry {
4
+ private ReactVdoPlayerView playerView;
5
+ private ReactVdoPlayerUIView playerUIView;
6
+
7
+ public void setPlayerView(ReactVdoPlayerView view) {
8
+ this.playerView = view;
9
+ }
10
+
11
+ public void clearPlayerView(ReactVdoPlayerView view) {
12
+ if (this.playerView == view) {
13
+ this.playerView = null;
14
+ }
15
+ }
16
+
17
+ public void setPlayerUIView(ReactVdoPlayerUIView view) {
18
+ this.playerUIView = view;
19
+ }
20
+
21
+ public void clearPlayerUIView(ReactVdoPlayerUIView view) {
22
+ if (this.playerUIView == view) {
23
+ this.playerUIView = null;
24
+ }
25
+ }
26
+
27
+ public ReactVdoPlayerView getPlayerView() {
28
+ return playerView;
29
+ }
30
+
31
+ public ReactVdoPlayerUIView getPlayerUIView() {
32
+ return playerUIView;
33
+ }
34
+ }
@@ -193,16 +193,6 @@ public class ReactVdoPlayerUIView extends LinearLayout implements LifecycleEvent
193
193
  vdoPlayerUIFragment = null;
194
194
  }
195
195
 
196
- public void getPlaybackProperties() {
197
- if (vdoPlayer != null) {
198
- Object tp = vdoPlayer.getPlaybackProperty("totalPlayed");
199
- long totalPlayed = (tp instanceof Long) ? (long)tp : 0L;
200
- Object tc = vdoPlayer.getPlaybackProperty("totalCovered");
201
- long totalCovered = (tc instanceof Long) ? (long)tc : 0L;
202
- eventEmitter.playbackProperties(totalPlayed, totalCovered);
203
- }
204
- }
205
-
206
196
  public void getPlaybackPropertiesV2(Callback callback) {
207
197
  WritableMap playbackProperties = Arguments.createMap();
208
198
  if (vdoPlayer != null) {
@@ -227,6 +217,12 @@ public class ReactVdoPlayerUIView extends LinearLayout implements LifecycleEvent
227
217
  }
228
218
  }
229
219
 
220
+ public void setAutoPlay(boolean autoPlay) {
221
+ if (vdoPlayer == null) {
222
+ this.playWhenReady = autoPlay;
223
+ }
224
+ }
225
+
230
226
  public void setPlaybackSpeed(float playbackSpeed) {
231
227
  this.pendingPlaybackSpeed = playbackSpeed;
232
228
  if (vdoPlayer != null) {
@@ -383,7 +379,7 @@ public class ReactVdoPlayerUIView extends LinearLayout implements LifecycleEvent
383
379
  @Override
384
380
  public void setId(int id) {
385
381
  super.setId(id);
386
- eventEmitter.setViewId(id);
382
+ eventEmitter.setView(this);
387
383
  }
388
384
 
389
385
  @Override