vdocipher-rn-bridge 1.12.0 → 1.12.2

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 CHANGED
@@ -1,5 +1,11 @@
1
1
  ## Changelog
2
2
 
3
+ ### 1.12.2
4
+ * Bug fix
5
+
6
+ ### 1.12.1
7
+ * Adding support of pip in separate activity
8
+
3
9
  ### 1.12.0
4
10
  * Updated VdoCipher android sdk dependency to 1.19.1
5
11
  * Added track selection APIs
package/README.md CHANGED
@@ -1,513 +1,7 @@
1
-
2
1
  # vdocipher-rn-bridge
3
2
 
4
-
5
- ## Note:
6
-
7
- 1. IOS is not supported. Only Android support available. IOS support will be
8
- added in future.
9
- 2. Currently, it is not possible to get any events or callbacks from Android
10
- player activity. The video will open in a new _native_ activity outside of
11
- the react native setup. Back button will take the user from the player
12
- activity to home activity.
13
-
14
3
  React native library for integrating vdocipher android sdk into your react native app.
15
4
 
16
- ## Getting started
17
-
18
- `$ npm install vdocipher-rn-bridge --save`
19
-
20
- For installation you can choose either automatic or manual installation:
21
-
22
- **Note**: If your app uses react-native version >= 0.60.0, you can skip the linking
23
- instructions. No explicit linking is required as new rn versions use
24
- [autolinking](https://facebook.github.io/react-native/blog/2019/07/03/version-60) for native modules.
25
-
26
- ### Automatic installation
27
-
28
- `$ react-native link vdocipher-rn-bridge`
29
-
30
- ### Manual installation
31
-
32
-
33
- #### iOS
34
-
35
- iOS is currently not supported.
36
-
37
- #### Android
38
-
39
- 1. Open up `android/app/src/main/java/[...]/MainActivity.java`
40
- - Add `import com.vdocipher.rnbridge.VdocipherRnBridgePackage;` to the imports at the top of the file
41
- - Add `new VdocipherRnBridgePackage()` to the list returned by the `getPackages()` method
42
- 2. Append the following lines to `android/settings.gradle`:
43
- ```
44
- include ':vdocipher-rn-bridge'
45
- project(':vdocipher-rn-bridge').projectDir = new File(rootProject.projectDir, '../node_modules/vdocipher-rn-bridge/android')
46
- ```
47
- 3. Insert the following lines inside the dependencies block in `android/app/build.gradle`:
48
- ```
49
- compile project(':vdocipher-rn-bridge')
50
- ```
51
-
52
- ### Installation troubleshooting
53
- If you encounter a build error for android project like _'Cannot find com.vdocipher.aegis:vdocipher-android:X.X.X',_
54
- you may need to add the following maven repository to your **android/build.gradle** under **allprojects -> repositories**:
55
-
56
- ```
57
- maven {
58
- url "https://github.com/VdoCipher/maven-repo/raw/master/repo"
59
- }
60
- ```
61
-
62
-
63
- ### Try the demo app
64
-
65
- To run the example react-native app included in this repo, clone this repo to your
66
- development machine, and run the example app:
67
-
68
- `$ mkdir vdocipher-react-native && cd vdocipher-react-native`
69
-
70
- `$ git clone https://github.com/VdoCipher/vdocipher-react-native.git .`
71
-
72
- `$ npm install && cd example && npm install`
73
-
74
- `$ npx react-native run-android`
75
-
76
5
  ## Usage
77
6
 
78
- For detailed usage of the library, refer the link [here.](https://www.vdocipher.com/docs/mobile/react-native/getting-started)
79
-
80
- ### Launch a video in a fullscreen player
81
-
82
- ```javascript
83
- import { startVideoScreen } from 'vdocipher-rn-bridge';
84
-
85
- startVideoScreen({embedInfo: {otp: 'some-otp', playbackInfo: 'some-playbackInfo'}});
86
- ```
87
-
88
- ### Embed a video in your react native layout
89
-
90
- ```javascript
91
- import { VdoPlayerView } from 'vdocipher-rn-bridge';
92
-
93
- const embedInfo = {otp: 'some-otp', playbackInfo: 'some-playbackInfo'};
94
-
95
- // in JSX
96
-
97
- <VdoPlayerView
98
- style={{height: 200, width: '100%'}}
99
- embedInfo={embedInfo}
100
- />
101
- ```
102
-
103
- ### VdoPlayerView props
104
-
105
- * [embedInfo](#embedinfo)
106
- * [showNativeControls](#shownativecontrols)
107
- * [playWhenReady](#playwhenready)
108
- * [playbackSpeed](#playbackspeed)
109
-
110
- ### VdoPlayerView event props
111
-
112
- * [onInitializationSuccess](#oninitializationsuccess)
113
- * [onInitializationFailure](#oninitializationfailure)
114
- * [onLoading](#onloading)
115
- * [onLoaded](#onloaded)
116
- * [onLoadError](#onloadError)
117
- * [onPlayerStateChanged](#onplayerstatechanged)
118
- * [onProgress](#onprogress)
119
- * [onBufferUpdate](#onbufferUpdate)
120
- * [onPlaybackSpeedChanged](#onplaybackspeedchanged)
121
- * [onTracksChanged](#ontrackschanged)
122
- * [onMediaEnded](#onmediaended)
123
- * [onError](#onerror)
124
- * [onEnterFullscreen](#onenterfullscreen)
125
- * [onExitFullscreen](#onexitfullscreen)
126
- * [onPlaybackProperties](#onplaybackproperties)
127
- * [onPictureInPictureModeChanged](#onPictureInPictureModeChanged)
128
-
129
- ### VdoPlayerView methods
130
-
131
- * [seek](#seek)
132
- * [enterFullscreen](#enterfullscreen)
133
- * [exitFullscreen](#exitfullscreen)
134
- * [getPlaybackProperties](#getplaybackproperties)
135
- * [isAdaptive](#isAdaptive)
136
- * [getVideoQualities](#getVideoQualities)
137
- * [getSelectedVideoQuality](#getSelectedVideoQuality)
138
- * [setVideoQuality](#setVideoQuality)
139
- * [enableAdaptiveVideo](#enableAdaptiveVideo)
140
- * [getSelectedAudioQuality](#getSelectedAudioQuality)
141
- * [getCaptionLanguages](#getCaptionLanguages)
142
- * [getSelectedCaptionLanguage](#getSelectedCaptionLanguage)
143
- * [setCaptionLanguage](#setCaptionLanguage)
144
- * [disableCaptions](#disableCaptions)
145
- * [getDuration](#getDuration)
146
-
147
- ### Props
148
-
149
- #### embedInfo
150
-
151
- Property | Type | Description
152
- --- | --- | ---
153
- otp | string | a valid otp
154
- playbackInfo | string | a valid playbackInfo
155
- forceLowestBitrate | boolean | whether to force lowest bitrate; default: `false`
156
- forceHighestSupportedBitrate | boolean | whether to force highest supported bitrate; default: `false`
157
- maxVideoBitrateKbps | number | maximum allowed video bitrate in kbps
158
- bufferingGoalMs | number | buffering goal in milliseconds, NOT recommended to change this value for most use cases; cannot be set to a value less than 15000
159
- enableAutoResume | boolean | whether to auto resume from last saved position or play from the beginning, default: `false`.
160
- safetyNetApiKey | string | safetynet api key to be used for safetynet verification
161
- preferredCaptionsLanguage | string | language code for the preferred captions language
162
- playerConfig | string | player configuration id from dashboard to be used for player
163
- setPictureInPictureSupport | boolean | whether to enable picture in picture support, default: `false`.
164
-
165
- #### showNativeControls
166
-
167
- Controls whether natively embedded player controls are shown.
168
- * **true (default)** - show native controls
169
- * **false** - hide native controls
170
-
171
- #### playWhenReady
172
-
173
- Controls whether playback will progress if the player is in ready state.
174
- * **true (default)** - play when ready
175
- * **false** - pause playback
176
-
177
- #### playbackSpeed
178
-
179
- Controls the playback speed; can be used once the player is loaded.
180
- * **1.0 (default)** - play at normal speed of the video
181
- * **Other values** - slow down or speed up playback
182
-
183
- ### Event props
184
-
185
- #### onInitializationSuccess
186
- Callback function invoked when a native `VdoPlayer` is created.
187
-
188
- Typically, no handling is required when this is called. The internal player will automatically load the `embedInfo` provided in props.
189
-
190
- #### onInitializationFailure
191
- Callback function invoked when a `VdoPlayer` creation failed due to some reason. Playback will not happen.
192
-
193
- The error details are provided in the payload under `errorDescription`.
194
-
195
- Payload:
196
-
197
- Property | Type | Description
198
- --- | --- | ---
199
- errorDescription | object | error details
200
-
201
- `errorDescription`:
202
-
203
- Property | Type | Description
204
- --- | --- | ---
205
- errorCode | number | an integer identifying the error
206
- errorMsg | string | short message description of the error
207
- httpStatusCode | number | http status code if relevant, -1 otherwise
208
-
209
- #### onLoading
210
- Callback function invoked when a new video starts loading.
211
-
212
- #### onLoaded
213
- Callback function invoked when a new video has successfully loaded. Playback can begin now.
214
-
215
- #### onLoadError
216
- Callback function invoked when a video failed to load due to some reason.
217
-
218
- The error details are provided in the payload under `errorDescription`.
219
-
220
- Payload:
221
-
222
- Property | Type | Description
223
- --- | --- | ---
224
- errorDescription | object | error details
225
- embedInfo | object | embedInfo for which the error occurred
226
-
227
- `errorDescription`:
228
-
229
- Property | Type | Description
230
- --- | --- | ---
231
- errorCode | number | an integer identifying the error
232
- errorMsg | string | short message description of the error
233
- httpStatusCode | number | http status code if relevant, -1 otherwise
234
-
235
- #### onPlayerStateChanged
236
- Callback function invoked when player state changes.
237
-
238
- Payload:
239
-
240
- Property | Type | Description
241
- --- | --- | ---
242
- playerState | string | one of 'idle', 'buffering', 'ready' or 'ended'
243
- playWhenReady | boolean | whether playback will progress if playerState is 'ready'
244
-
245
- #### onProgress
246
- Callback function invoked to provided playback time updates.
247
-
248
- Payload:
249
-
250
- Property | Type | Description
251
- --- | --- | ---
252
- currentTime | number | current playback time in milliseconds
253
-
254
- #### onBufferUpdate
255
- Callback function invoked to provide buffered time updates.
256
-
257
- Payload:
258
-
259
- Property | Type | Description
260
- --- | --- | ---
261
- bufferTime | number | current buffered time in milliseconds
262
-
263
- #### onPlaybackSpeedChanged
264
- Callback function invoked when playback speed changes.
265
-
266
- Payload:
267
-
268
- Property | Type | Description
269
- --- | --- | ---
270
- playbackSpeed | number | current playback speed
271
-
272
- #### onTracksChanged
273
- Callback function invoked when available or selected track changes.
274
-
275
- Payload:
276
-
277
- Property | Type | Description
278
- --- | --- | ---
279
- availableTracks | object[] | array of available `track` objects
280
- selectedTracks | object[] | array of currently selected `track` objects
281
-
282
- `track`:
283
-
284
- Property | Type | Description
285
- --- | --- | ---
286
- id | number | an integer identifying the track
287
- type | string | one of 'audio', 'video', 'captions', 'combined' or 'unknown'
288
- language | string | optional: language of track if relevant
289
- bitrate | number | optional: bitrate in bps if relevant
290
- width | number | optional: width resolution if relevant
291
- height | number | optional: height resolution if relevant otherwise
292
- label | string | optional: Display name if relevant
293
-
294
- #### onMediaEnded
295
- Callback function invoked when a video reached end of playback.
296
-
297
- #### onError
298
- Callback function invoked when video playback is interrupted due to an error.
299
-
300
- The error details are provided in the payload under `errorDescription`.
301
-
302
- Payload:
303
-
304
- Property | Type | Description
305
- --- | --- | ---
306
- errorDescription | object | error details
307
- embedInfo | object | embedInfo for which the error occurred
308
-
309
- `errorDescription`:
310
-
311
- Property | Type | Description
312
- --- | --- | ---
313
- errorCode | number | an integer identifying the error
314
- errorMsg | string | short message description of the error
315
- httpStatusCode | number | http status code if relevant, -1 otherwise
316
-
317
- #### onEnterFullscreen
318
- Callback function invoked when the player enters fullscreen.
319
-
320
- #### onExitFullscreen
321
- Callback function invoked when the player exits fullscreen.
322
-
323
- #### onPlaybackProperties
324
- Callback function invoked when additional playback properties are requested using the `getPlaybackProperties` method.
325
-
326
- #### onPictureInPictureModeChanged
327
- Callback function invoked to handle UI when the player enters or exits pip mode
328
-
329
- Payload:
330
-
331
- Property | Type | Description
332
- --- | --- | ---
333
- isInPictureInPictureMode | boolean | is player in pip mode
334
-
335
- ### Methods
336
-
337
- Methods operate on a ref to the VdoPlayerView element. You can create a ref like this:
338
- ```
339
- <VdoPlayerView ref={player => this._player = player}
340
- ```
341
-
342
- #### seek
343
- `seek(seekTargetMs)`
344
- Set the seek target in milli seconds
345
-
346
- #### enterFullscreen
347
- `enterFullscreen()`
348
-
349
- Enter fullscreen mode.
350
-
351
- #### exitFullscreen
352
- `exitFullscreen()`
353
-
354
- Exit fullscreen mode.
355
-
356
- #### getPlaybackProperties
357
- `getPlaybackProperties()`
358
-
359
- Request additional playback properties. The callback `onPlaybackProperties` is invoked with the results.
360
-
361
- #### isAdaptive
362
- `isAdaptive()`
363
-
364
- Check whether the video is in adaptive mode or not
365
-
366
- #### getVideoQualities
367
- `getVideoQualities()`
368
-
369
- Get available video tracks
370
-
371
- Payload:
372
-
373
- Property | Type | Description
374
- --- | --- | ---
375
- videoQualities | object[] | array of available `track` objects
376
-
377
- `track`:
378
-
379
- Property | Type | Description
380
- --- | --- | ---
381
- id | number | an integer identifying the track
382
- bitrate | number | optional: bitrate in bps if relevant
383
- width | number | optional: width resolution if relevant
384
- height | number | optional: height resolution if relevant otherwise
385
-
386
- #### getSelectedVideoQuality
387
- `getSelectedVideoQuality()`
388
-
389
- Get selected video track
390
-
391
- Payload:
392
-
393
- Property | Type | Description
394
- --- | --- | ---
395
- selectedVideoQuality| object | selected `track` object
396
-
397
- `track`:
398
-
399
- Property | Type | Description
400
- --- | --- | ---
401
- id | number | an integer identifying the track
402
- bitrate | number | optional: bitrate in bps if relevant
403
- width | number | optional: width resolution if relevant
404
- height | number | optional: height resolution if relevant otherwise
405
-
406
- If this method returns `null`, it means the video is playing in adaptive mode
407
-
408
- #### setVideoQuality
409
- `setVideoQuality(videoQuality)`
410
-
411
- Set specified video track
412
-
413
- `videoQuality`:
414
-
415
- Property | Type | Description
416
- --- | --- | ---
417
- id | number | an integer identifying the track
418
- bitrate | number | optional: bitrate in bps if relevant
419
- width | number | optional: width resolution if relevant
420
- height | number | optional: height resolution if relevant otherwise
421
-
422
- #### enableAdaptiveVideo
423
- `enableAdaptiveVideo()`
424
-
425
- Run video in adaptive mode
426
-
427
- #### getSelectedAudioQuality
428
- `getSelectedAudioQuality()`
429
-
430
- Get selected audio track
431
-
432
- Payload:
433
-
434
- Property | Type | Description
435
- --- | --- | ---
436
- selectedAudioQuality| object | selected `track` object
437
-
438
- `track`:
439
-
440
- Property | Type | Description
441
- --- | --- | ---
442
- id | number | an integer identifying the track
443
- bitrate | number | optional: bitrate in bps if relevant
444
- width | number | optional: width resolution if relevant
445
- height | number | optional: height resolution if relevant otherwise
446
-
447
- #### getCaptionLanguages
448
- `getCaptionLanguages()`
449
-
450
- Get available caption tracks
451
-
452
- Payload:
453
-
454
- Property | Type | Description
455
- --- | --- | ---
456
- captionLanguages | object[] | array of available `track` objects
457
-
458
- `track`:
459
-
460
- Property | Type | Description
461
- --- | --- | ---
462
- id | number | an integer identifying the track
463
- language | string | optional: language of track if relevant
464
- label | string | optional: Display name if relevant
465
-
466
-
467
- #### getSelectedCaptionLanguage
468
- `getSelectedCaptionLanguage()`
469
-
470
- Get selected caption track
471
-
472
- Payload:
473
-
474
- Property | Type | Description
475
- --- | --- | ---
476
- selectedCaptionLanguage| object | selected `track` object
477
-
478
- `track`:
479
-
480
- Property | Type | Description
481
- --- | --- | ---
482
- id | number | an integer identifying the track
483
- language | string | optional: language of track if relevant
484
- label | string | optional: Display name if relevant
485
-
486
- #### setCaptionLanguage
487
- `setCaptionLanguage(captionLanguage)`
488
-
489
- Set specified caption track
490
-
491
- `captionLanguage`:
492
-
493
- Property | Type | Description
494
- --- | --- | ---
495
- id | number | an integer identifying the track
496
- language | string | optional: language of track if relevant
497
- label | string | optional: Display name if relevant
498
-
499
- #### disableCaptions
500
- `disableCaptions()`
501
-
502
- Disable captions
503
-
504
- #### getDuration
505
- `getDuration()`
506
-
507
- Get video duration
508
-
509
- Payload:
510
-
511
- Property | Type | Description
512
- --- | --- | ---
513
- duration | number | duration of the video in milliseconds
7
+ Usage instructions available on our [documentation page for React Native](https://www.vdocipher.com/docs/mobile/react-native/getting-started)
package/VdoPlayerView.js CHANGED
@@ -16,6 +16,7 @@
16
16
  this.state = {
17
17
  fullscreen: false,
18
18
  isInitialPortrait: true,
19
+ isInPictureInPictureMode: false
19
20
  }
20
21
  this.handleBackButtonClick = this.handleBackButtonClick.bind(this);
21
22
  this._propRef = 1;
@@ -30,8 +31,8 @@
30
31
  }
31
32
 
32
33
  handleBackButtonClick() {
33
- if (this.state.fullscreen && this.state.isInitialPortrait) {
34
- this._vdoPlayerView.handleBackButtonClick();
34
+ if (!this.state.isInPictureInPictureMode && this.state.fullscreen && this.state.isInitialPortrait) {
35
+ this._vdoPlayerView.handleBackButtonClick();
35
36
  return true;
36
37
  }
37
38
  }
@@ -238,6 +239,10 @@
238
239
  }
239
240
 
240
241
  _onPictureInPictureModeChanged = (event) => {
242
+ this.setState({
243
+ isInPictureInPictureMode: event.nativeEvent.isInPictureInPictureMode
244
+ });
245
+
241
246
  if (this.props.onPictureInPictureModeChanged) {
242
247
  this.props.onPictureInPictureModeChanged(event.nativeEvent);
243
248
  }
@@ -287,6 +292,7 @@
287
292
  onVdoEnterFullscreen={this._onEnterFullscreen}
288
293
  onVdoExitFullscreen={this._onExitFullscreen}
289
294
  onIsInitialPortrait={this._onIsInitialPortrait}
295
+ onVdoPictureInPictureModeChanged={this._onPictureInPictureModeChanged}
290
296
  {...this.props}
291
297
  />
292
298
  )
@@ -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.12.0"
22
- def releaseVersionCode = 11
21
+ def releaseVersionName = "1.12.2"
22
+ def releaseVersionCode = 13
23
23
 
24
24
  android {
25
25
  compileSdkVersion 33
@@ -24,6 +24,10 @@ import com.vdocipher.aegis.ui.view.VdoPlayerUIFragment;
24
24
  import android.os.Handler;
25
25
  import android.os.Bundle;
26
26
 
27
+ import androidx.core.app.PictureInPictureModeChangedInfo;
28
+ import androidx.core.util.Consumer;
29
+ import android.graphics.Color;
30
+
27
31
 
28
32
  public class ReactVdoPlayerUIView extends FrameLayout implements LifecycleEventListener, Consumer<Configuration> {
29
33
  private static final String TAG = "ReactVdoPlayerUIView";
@@ -44,25 +48,20 @@ public class ReactVdoPlayerUIView extends FrameLayout implements LifecycleEventL
44
48
 
45
49
  private FragmentManager fragmentManager;
46
50
 
51
+ private Consumer<PictureInPictureModeChangedInfo> pictureModeChangedInfoConsumer;
52
+
47
53
  public ReactVdoPlayerUIView(ThemedReactContext context) {
48
54
  super(context);
49
55
  themedReactContext = context;
50
56
  activity = (AppCompatActivity) themedReactContext.getCurrentActivity();
51
57
  setKeepScreenOn(true);
58
+ setBackgroundColor(Color.BLACK);
52
59
 
53
60
  context.addLifecycleEventListener(this);
54
61
  activity.addOnConfigurationChangedListener(this);
55
62
 
56
63
  eventEmitter = new VdoEventEmitter(context);
57
64
 
58
-
59
- vdoPlayerUIFragment = new VdoPlayerUIFragment();
60
- Bundle bundle = new Bundle();
61
- bundle.putBoolean("showControls", true);
62
- vdoPlayerUIFragment.setArguments(bundle);
63
- fragmentManager = this.activity.getSupportFragmentManager();
64
- initializePlayer();
65
-
66
65
  int orientation = getResources().getConfiguration().orientation;
67
66
  if (orientation == Configuration.ORIENTATION_PORTRAIT) {
68
67
  eventEmitter.isInitialPortrait();
@@ -90,6 +89,9 @@ public class ReactVdoPlayerUIView extends FrameLayout implements LifecycleEventL
90
89
  */
91
90
  public void cleanUp() {
92
91
  themedReactContext.removeLifecycleEventListener(this);
92
+ if (pictureModeChangedInfoConsumer != null) {
93
+ activity.removeOnPictureInPictureModeChangedListener(pictureModeChangedInfoConsumer);
94
+ }
93
95
  if (vdoPlayer != null) {
94
96
  vdoPlayer.stop();
95
97
  }
@@ -138,6 +140,12 @@ public class ReactVdoPlayerUIView extends FrameLayout implements LifecycleEventL
138
140
  public void setPictureInPictureSupport() {
139
141
  if (vdoPlayerUIFragment != null) {
140
142
  vdoPlayerUIFragment.setPictureInPictureSupport(true);
143
+ pictureModeChangedInfoConsumer = pictureInPictureModeChangedInfo ->
144
+ {
145
+ eventEmitter.onPictureInPictureModeChanged(pictureInPictureModeChangedInfo.isInPictureInPictureMode());
146
+ };
147
+
148
+ activity.addOnPictureInPictureModeChangedListener(pictureModeChangedInfoConsumer);
141
149
  }
142
150
  }
143
151
 
@@ -151,6 +159,14 @@ public class ReactVdoPlayerUIView extends FrameLayout implements LifecycleEventL
151
159
  protected void onAttachedToWindow() {
152
160
  Log.d(TAG, "onAttachedToWindow");
153
161
  super.onAttachedToWindow();
162
+ if (vdoPlayerUIFragment == null) {
163
+ vdoPlayerUIFragment = new VdoPlayerUIFragment();
164
+ Bundle bundle = new Bundle();
165
+ bundle.putBoolean("showControls", true);
166
+ vdoPlayerUIFragment.setArguments(bundle);
167
+ fragmentManager = this.activity.getSupportFragmentManager();
168
+ initializePlayer();
169
+ }
154
170
  if (playWhenReady) {
155
171
  if (vdoPlayer != null) {
156
172
  vdoPlayer.setPlayWhenReady(true);
@@ -41,6 +41,7 @@ import com.facebook.react.bridge.WritableArray;
41
41
  import com.facebook.react.bridge.ReadableMap;
42
42
  import com.facebook.react.bridge.WritableMap;
43
43
  import com.facebook.react.bridge.Arguments;
44
+ import android.graphics.Color;
44
45
 
45
46
  public class ReactVdoPlayerView extends FrameLayout implements LifecycleEventListener {
46
47
  private static final String TAG = "ReactVdoPlayerView";
@@ -83,16 +84,10 @@ public class ReactVdoPlayerView extends FrameLayout implements LifecycleEventLis
83
84
  // Get a handler that can be used to post to the main thread
84
85
  mainHandler = new Handler(Looper.getMainLooper());
85
86
  setKeepScreenOn(true);
87
+ setBackgroundColor(Color.BLACK);
86
88
 
87
89
  eventEmitter = new VdoEventEmitter(context);
88
90
 
89
- vdoPlayerUIFragment = new VdoPlayerUIFragment();
90
- Bundle bundle = new Bundle();
91
- bundle.putBoolean("showControls", false);
92
- vdoPlayerUIFragment.setArguments(bundle);
93
- fragmentManager = activity.getSupportFragmentManager();
94
- initializePlayer();
95
-
96
91
  int orientation = getResources().getConfiguration().orientation;
97
92
  if (orientation == Configuration.ORIENTATION_PORTRAIT) {
98
93
  eventEmitter.isInitialPortrait();
@@ -398,6 +393,14 @@ public class ReactVdoPlayerView extends FrameLayout implements LifecycleEventLis
398
393
  protected void onAttachedToWindow() {
399
394
  Log.d(TAG, "onAttachedToWindow");
400
395
  super.onAttachedToWindow();
396
+ if (vdoPlayerUIFragment == null) {
397
+ vdoPlayerUIFragment = new VdoPlayerUIFragment();
398
+ Bundle bundle = new Bundle();
399
+ bundle.putBoolean("showControls", false);
400
+ vdoPlayerUIFragment.setArguments(bundle);
401
+ fragmentManager = activity.getSupportFragmentManager();
402
+ initializePlayer();
403
+ }
401
404
  if (playWhenReady) {
402
405
  if (vdoPlayer != null) {
403
406
  vdoPlayer.setPlayWhenReady(true);
package/package.json CHANGED
@@ -1,14 +1,11 @@
1
1
  {
2
2
  "name": "vdocipher-rn-bridge",
3
- "version": "1.12.0",
3
+ "version": "1.12.2",
4
4
  "description": "React native bridge library that delegates to vdocipher native android SDK",
5
+ "homepage": "https://www.vdocipher.com/docs/mobile/react-native/getting-started/",
5
6
  "scripts": {
6
7
  "test": "echo \"Error: no test specified\" && exit 1"
7
8
  },
8
- "repository": {
9
- "type": "git",
10
- "url": "https://github.com/VdoCipher/vdocipher-react-native.git"
11
- },
12
9
  "keywords": [
13
10
  "react-native"
14
11
  ],