vdocipher-rn-bridge 1.10.2 → 1.12.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 +8 -0
- package/README.md +167 -1
- package/VdoPlayerSupportView.js +13 -157
- package/VdoPlayerUIView.js +0 -161
- package/VdoPlayerView.js +80 -5
- package/android/build.gradle +3 -3
- package/android/src/main/java/com/vdocipher/rnbridge/ReactVdoPlayerUIView.java +33 -9
- package/android/src/main/java/com/vdocipher/rnbridge/ReactVdoPlayerView.java +199 -48
- package/android/src/main/java/com/vdocipher/rnbridge/ReactVdoPlayerViewManager.java +36 -1
- package/android/src/main/java/com/vdocipher/rnbridge/TrackSelectionModule.java +86 -0
- package/android/src/main/java/com/vdocipher/rnbridge/Utils.java +83 -0
- package/android/src/main/java/com/vdocipher/rnbridge/VdocipherRnBridgeModule.java +9 -2
- package/android/src/main/java/com/vdocipher/rnbridge/VdocipherRnBridgePackage.java +12 -3
- package/package.json +1 -1
- package/android/src/main/res/layout/activity_vdo_player_ui.xml +0 -12
- package/android/src/main/res/layout/activity_vdo_player_ui_custom.xml +0 -12
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,12 @@
|
|
|
1
1
|
## Changelog
|
|
2
|
+
|
|
3
|
+
### 1.12.0
|
|
4
|
+
* Updated VdoCipher android sdk dependency to 1.19.1
|
|
5
|
+
* Added track selection APIs
|
|
6
|
+
|
|
7
|
+
### 1.11.0
|
|
8
|
+
* Updated VdoCipher android sdk dependency to 1.19.0
|
|
9
|
+
|
|
2
10
|
### 1.10.2
|
|
3
11
|
* Updated VdoCipher android sdk dependency to 1.18.2
|
|
4
12
|
* Updated compileSdkVersion to 33 and targetSdkVersion to 32
|
package/README.md
CHANGED
|
@@ -132,6 +132,17 @@ const embedInfo = {otp: 'some-otp', playbackInfo: 'some-playbackInfo'};
|
|
|
132
132
|
* [enterFullscreen](#enterfullscreen)
|
|
133
133
|
* [exitFullscreen](#exitfullscreen)
|
|
134
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)
|
|
135
146
|
|
|
136
147
|
### Props
|
|
137
148
|
|
|
@@ -278,6 +289,7 @@ language | string | optional: language of track if relevant
|
|
|
278
289
|
bitrate | number | optional: bitrate in bps if relevant
|
|
279
290
|
width | number | optional: width resolution if relevant
|
|
280
291
|
height | number | optional: height resolution if relevant otherwise
|
|
292
|
+
label | string | optional: Display name if relevant
|
|
281
293
|
|
|
282
294
|
#### onMediaEnded
|
|
283
295
|
Callback function invoked when a video reached end of playback.
|
|
@@ -344,4 +356,158 @@ Exit fullscreen mode.
|
|
|
344
356
|
#### getPlaybackProperties
|
|
345
357
|
`getPlaybackProperties()`
|
|
346
358
|
|
|
347
|
-
Request additional playback properties. The callback `onPlaybackProperties` is invoked with the results.
|
|
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
|
package/VdoPlayerSupportView.js
CHANGED
|
@@ -2,9 +2,7 @@
|
|
|
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
|
|
6
|
-
import { requireNativeComponent, BackHandler} from 'react-native';
|
|
7
|
-
import { ViewPropTypes } from 'deprecated-react-native-prop-types';
|
|
5
|
+
import { requireNativeComponent} from 'react-native';
|
|
8
6
|
|
|
9
7
|
class VdoPlayerSupportView extends Component {
|
|
10
8
|
|
|
@@ -41,181 +39,39 @@ class VdoPlayerSupportView extends Component {
|
|
|
41
39
|
}
|
|
42
40
|
}
|
|
43
41
|
|
|
44
|
-
|
|
45
|
-
if (this.
|
|
46
|
-
this.
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
_onInitFailure = (event) => {
|
|
51
|
-
if (this.props.onInitializationFailure) {
|
|
52
|
-
this.props.onInitializationFailure(event.nativeEvent);
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
_onLoading = (embedInfo, event) => {
|
|
57
|
-
if (this.props.onLoading) {
|
|
58
|
-
this.props.onLoading({embedInfo, ...event.nativeEvent});
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
_onLoaded = (embedInfo, event) => {
|
|
63
|
-
if (this.props.onLoaded) {
|
|
64
|
-
this.props.onLoaded({embedInfo, ...event.nativeEvent});
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
_onLoadError = (embedInfo, event) => {
|
|
69
|
-
if (this.props.onLoadError) {
|
|
70
|
-
this.props.onLoadError({embedInfo, ...event.nativeEvent});
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
_onPlayerStateChanged = (event) => {
|
|
75
|
-
if (this.props.onPlayerStateChanged) {
|
|
76
|
-
this.props.onPlayerStateChanged(event.nativeEvent);
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
_onProgress = (event) => {
|
|
81
|
-
if (this.props.onProgress) {
|
|
82
|
-
this.props.onProgress(event.nativeEvent);
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
_onBufferUpdate = (event) => {
|
|
87
|
-
if (this.props.onBufferUpdate) {
|
|
88
|
-
this.props.onBufferUpdate(event.nativeEvent);
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
_onPlaybackSpeedChanged = (event) => {
|
|
93
|
-
if (this.props.onPlaybackSpeedChanged) {
|
|
94
|
-
this.props.onPlaybackSpeedChanged(event.nativeEvent.playbackSpeed);
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
_onTracksChanged = (event) => {
|
|
99
|
-
if (this.props.onTracksChanged) {
|
|
100
|
-
this.props.onTracksChanged(event.nativeEvent);
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
_onMediaEnded = (embedInfo, event) => {
|
|
105
|
-
if (this.props.onMediaEnded) {
|
|
106
|
-
this.props.onMediaEnded({embedInfo, ...event.nativeEvent});
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
_onError = (embedInfo, event) => {
|
|
111
|
-
if (this.props.onError) {
|
|
112
|
-
this.props.onError({embedInfo, ...event.nativeEvent});
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
_onPlaybackProperties = (event) => {
|
|
117
|
-
if (this.props.onPlaybackProperties) {
|
|
118
|
-
this.props.onPlaybackProperties(event.nativeEvent);
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
_onEnterFullscreen = () => {
|
|
123
|
-
if (this.props.onEnterFullscreen) {
|
|
124
|
-
this.props.onEnterFullscreen();
|
|
42
|
+
setVideoQuality = videoQuality => {
|
|
43
|
+
if (this._root) {
|
|
44
|
+
this._root.setNativeProps({videoQuality: videoQuality});
|
|
125
45
|
}
|
|
126
46
|
}
|
|
127
47
|
|
|
128
|
-
|
|
129
|
-
if (this.
|
|
130
|
-
this.
|
|
48
|
+
enableAdaptiveVideo = () => {
|
|
49
|
+
if (this._root) {
|
|
50
|
+
this._root.setNativeProps({adaptiveVideo: this._propRef++});
|
|
131
51
|
}
|
|
132
52
|
}
|
|
133
53
|
|
|
134
|
-
|
|
135
|
-
if (this.
|
|
136
|
-
this.
|
|
54
|
+
setCaptionLanguage = captionLanguage => {
|
|
55
|
+
if (this._root) {
|
|
56
|
+
this._root.setNativeProps({captionLanguage: captionLanguage});
|
|
137
57
|
}
|
|
138
58
|
}
|
|
139
59
|
|
|
140
|
-
|
|
141
|
-
if (this.
|
|
142
|
-
this.
|
|
60
|
+
disableCaptions = () => {
|
|
61
|
+
if (this._root) {
|
|
62
|
+
this._root.setNativeProps({disableCaptions: this._propRef++});
|
|
143
63
|
}
|
|
144
64
|
}
|
|
145
65
|
|
|
146
66
|
render() {
|
|
147
67
|
return (
|
|
148
68
|
<RCTVdoPlayerView ref={component => this._root = component}
|
|
149
|
-
onInitSuccess={this._onInitSuccess}
|
|
150
|
-
onInitFailure={this._onInitFailure}
|
|
151
|
-
onVdoLoading={((embedInfo) => (event) => this._onLoading(embedInfo, event))(this.props.embedInfo)}
|
|
152
|
-
onVdoLoaded={((embedInfo) => (event) => this._onLoaded(embedInfo, event))(this.props.embedInfo)}
|
|
153
|
-
onVdoLoadError={((embedInfo) => (event) => this._onLoadError(embedInfo, event))(this.props.embedInfo)}
|
|
154
|
-
onVdoPlayerStateChanged={this._onPlayerStateChanged}
|
|
155
|
-
onVdoProgress={this._onProgress}
|
|
156
|
-
onVdoBufferUpdate={this._onBufferUpdate}
|
|
157
|
-
onVdoPlaybackSpeedChanged={this._onPlaybackSpeedChanged}
|
|
158
|
-
onVdoTracksChanged={this._onTracksChanged}
|
|
159
|
-
onVdoMediaEnded={((embedInfo) => (event) => this._onMediaEnded(embedInfo, event))(this.props.embedInfo)}
|
|
160
|
-
onVdoError={((embedInfo) => (event) => this._onError(embedInfo, event))(this.props.embedInfo)}
|
|
161
|
-
onVdoPlaybackProperties={this._onPlaybackProperties}
|
|
162
|
-
onVdoEnterFullscreen={this._onEnterFullscreen}
|
|
163
|
-
onVdoExitFullscreen={this._onExitFullscreen}
|
|
164
|
-
onIsInitialPortrait={this._onIsInitialPortrait}
|
|
165
|
-
onPictureInPictureModeChanged={this._onPictureInPictureModeChanged}
|
|
166
69
|
{...this.props}
|
|
167
70
|
/>
|
|
168
71
|
)
|
|
169
72
|
}
|
|
170
73
|
}
|
|
171
74
|
|
|
172
|
-
VdoPlayerSupportView.propTypes = {
|
|
173
|
-
/* Native only */
|
|
174
|
-
onInitSuccess: PropTypes.func,
|
|
175
|
-
onInitFailure: PropTypes.func,
|
|
176
|
-
onVdoLoading: PropTypes.func,
|
|
177
|
-
onVdoLoaded: PropTypes.func,
|
|
178
|
-
onVdoLoadError: PropTypes.func,
|
|
179
|
-
onVdoPlayerStateChanged: PropTypes.func,
|
|
180
|
-
onVdoProgress: PropTypes.func,
|
|
181
|
-
onVdoBufferUpdate: PropTypes.func,
|
|
182
|
-
onVdoPlaybackSpeedChanged: PropTypes.func,
|
|
183
|
-
onVdoTracksChanged: PropTypes.func,
|
|
184
|
-
onVdoMediaEnded: PropTypes.func,
|
|
185
|
-
onVdoError: PropTypes.func,
|
|
186
|
-
playbackProperties: PropTypes.number,
|
|
187
|
-
onVdoPlaybackProperties: PropTypes.func,
|
|
188
|
-
seek: PropTypes.number,
|
|
189
|
-
fullscreen: PropTypes.bool,
|
|
190
|
-
onVdoEnterFullscreen: PropTypes.func,
|
|
191
|
-
onVdoExitFullscreen: PropTypes.func,
|
|
192
|
-
onIsInitialPortrait: PropTypes.func,
|
|
193
|
-
|
|
194
|
-
/* Wrapper component public api */
|
|
195
|
-
embedInfo: PropTypes.object,
|
|
196
|
-
playWhenReady: PropTypes.bool,
|
|
197
|
-
playbackSpeed: PropTypes.number,
|
|
198
|
-
onInitializationSuccess: PropTypes.func,
|
|
199
|
-
onInitializationFailure: PropTypes.func,
|
|
200
|
-
onLoading: PropTypes.func,
|
|
201
|
-
onLoaded: PropTypes.func,
|
|
202
|
-
onLoadError: PropTypes.func,
|
|
203
|
-
onPlayerStateChanged: PropTypes.func,
|
|
204
|
-
onProgress: PropTypes.func,
|
|
205
|
-
onBufferUpdate: PropTypes.func,
|
|
206
|
-
onPlaybackSpeedChanged: PropTypes.func,
|
|
207
|
-
onTracksChanged: PropTypes.func,
|
|
208
|
-
onMediaEnded: PropTypes.func,
|
|
209
|
-
onError: PropTypes.func,
|
|
210
|
-
onPlaybackProperties: PropTypes.func,
|
|
211
|
-
onEnterFullscreen: PropTypes.func,
|
|
212
|
-
onExitFullscreen: PropTypes.func,
|
|
213
|
-
onPictureInPictureModeChanged: PropTypes.func,
|
|
214
|
-
|
|
215
|
-
/* Required */
|
|
216
|
-
...ViewPropTypes,
|
|
217
|
-
};
|
|
218
|
-
|
|
219
75
|
var RCTVdoPlayerView = requireNativeComponent('RCTVdoPlayerView', VdoPlayerSupportView, {
|
|
220
76
|
nativeOnly: {
|
|
221
77
|
onInitSuccess: true,
|
package/VdoPlayerUIView.js
CHANGED
|
@@ -2,9 +2,7 @@
|
|
|
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 PropTypes from 'prop-types';
|
|
6
5
|
import {requireNativeComponent, Platform} from 'react-native';
|
|
7
|
-
import { ViewPropTypes } from 'deprecated-react-native-prop-types';
|
|
8
6
|
|
|
9
7
|
class VdoPlayerUIView extends Component {
|
|
10
8
|
constructor(props) {
|
|
@@ -93,174 +91,15 @@
|
|
|
93
91
|
}
|
|
94
92
|
}
|
|
95
93
|
|
|
96
|
-
_onInitSuccess = (event) => {
|
|
97
|
-
if (this.props.onInitializationSuccess) {
|
|
98
|
-
this.props.onInitializationSuccess(event.nativeEvent);
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
_onInitFailure = (event) => {
|
|
103
|
-
if (this.props.onInitializationFailure) {
|
|
104
|
-
this.props.onInitializationFailure(event.nativeEvent);
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
_onLoading = (embedInfo, event) => {
|
|
109
|
-
if (this.props.onLoading) {
|
|
110
|
-
this.props.onLoading({embedInfo, ...event.nativeEvent});
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
_onLoaded = (embedInfo, event) => {
|
|
115
|
-
if (this.props.onLoaded) {
|
|
116
|
-
this.props.onLoaded({embedInfo, ...event.nativeEvent});
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
_onLoadError = (embedInfo, event) => {
|
|
121
|
-
if (this.props.onLoadError) {
|
|
122
|
-
this.props.onLoadError({embedInfo, ...event.nativeEvent});
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
_onPlayerStateChanged = (event) => {
|
|
127
|
-
if (this.props.onPlayerStateChanged) {
|
|
128
|
-
this.props.onPlayerStateChanged(event.nativeEvent);
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
_onProgress = (event) => {
|
|
133
|
-
if (this.props.onProgress) {
|
|
134
|
-
this.props.onProgress(event.nativeEvent);
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
_onBufferUpdate = (event) => {
|
|
139
|
-
if (this.props.onBufferUpdate) {
|
|
140
|
-
this.props.onBufferUpdate(event.nativeEvent);
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
_onPlaybackSpeedChanged = (event) => {
|
|
145
|
-
if (this.props.onPlaybackSpeedChanged) {
|
|
146
|
-
this.props.onPlaybackSpeedChanged(event.nativeEvent.playbackSpeed);
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
_onTracksChanged = (event) => {
|
|
151
|
-
if (this.props.onTracksChanged) {
|
|
152
|
-
this.props.onTracksChanged(event.nativeEvent);
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
_onMediaEnded = (embedInfo, event) => {
|
|
157
|
-
if (this.props.onMediaEnded) {
|
|
158
|
-
this.props.onMediaEnded({embedInfo, ...event.nativeEvent});
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
_onError = (embedInfo, event) => {
|
|
163
|
-
if (this.props.onError) {
|
|
164
|
-
this.props.onError({embedInfo, ...event.nativeEvent});
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
_onPlaybackProperties = (event) => {
|
|
169
|
-
if (this.props.onPlaybackProperties) {
|
|
170
|
-
this.props.onPlaybackProperties(event.nativeEvent);
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
_onEnterFullscreen = () => {
|
|
175
|
-
if (this.props.onEnterFullscreen) {
|
|
176
|
-
this.props.onEnterFullscreen();
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
_onExitFullscreen = () => {
|
|
181
|
-
if (this.props.onExitFullscreen) {
|
|
182
|
-
this.props.onExitFullscreen();
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
_onIsInitialPortrait =(event) => {
|
|
187
|
-
if (this.props.onIsInitialPortrait) {
|
|
188
|
-
this.props.onIsInitialPortrait(event);
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
|
|
192
94
|
render() {
|
|
193
95
|
return (
|
|
194
96
|
<RCTVdoPlayerUIView ref={component => this._root = component}
|
|
195
|
-
onInitSuccess={this._onInitSuccess}
|
|
196
|
-
onInitFailure={this._onInitFailure}
|
|
197
|
-
onVdoLoading={((embedInfo) => (event) => this._onLoading(embedInfo, event))(this.props.embedInfo)}
|
|
198
|
-
onVdoLoaded={((embedInfo) => (event) => this._onLoaded(embedInfo, event))(this.props.embedInfo)}
|
|
199
|
-
onVdoLoadError={((embedInfo) => (event) => this._onLoadError(embedInfo, event))(this.props.embedInfo)}
|
|
200
|
-
onVdoPlayerStateChanged={this._onPlayerStateChanged}
|
|
201
|
-
onVdoProgress={this._onProgress}
|
|
202
|
-
onVdoBufferUpdate={this._onBufferUpdate}
|
|
203
|
-
onVdoPlaybackSpeedChanged={this._onPlaybackSpeedChanged}
|
|
204
|
-
onVdoTracksChanged={this._onTracksChanged}
|
|
205
|
-
onVdoMediaEnded={((embedInfo) => (event) => this._onMediaEnded(embedInfo, event))(this.props.embedInfo)}
|
|
206
|
-
onVdoError={((embedInfo) => (event) => this._onError(embedInfo, event))(this.props.embedInfo)}
|
|
207
|
-
onVdoPlaybackProperties={this._onPlaybackProperties}
|
|
208
|
-
onVdoEnterFullscreen={this._onEnterFullscreen}
|
|
209
|
-
onVdoExitFullscreen={this._onExitFullscreen}
|
|
210
|
-
onIsInitialPortrait={this._onIsInitialPortrait}
|
|
211
97
|
{...this.props}
|
|
212
98
|
/>
|
|
213
99
|
);
|
|
214
100
|
}
|
|
215
101
|
}
|
|
216
102
|
|
|
217
|
-
VdoPlayerUIView.propTypes = {
|
|
218
|
-
/* Native only */
|
|
219
|
-
onInitSuccess: PropTypes.func,
|
|
220
|
-
onInitFailure: PropTypes.func,
|
|
221
|
-
onVdoLoading: PropTypes.func,
|
|
222
|
-
onVdoLoaded: PropTypes.func,
|
|
223
|
-
onVdoLoadError: PropTypes.func,
|
|
224
|
-
onVdoPlayerStateChanged: PropTypes.func,
|
|
225
|
-
onVdoProgress: PropTypes.func,
|
|
226
|
-
onVdoBufferUpdate: PropTypes.func,
|
|
227
|
-
onVdoPlaybackSpeedChanged: PropTypes.func,
|
|
228
|
-
onVdoTracksChanged: PropTypes.func,
|
|
229
|
-
onVdoMediaEnded: PropTypes.func,
|
|
230
|
-
onVdoError: PropTypes.func,
|
|
231
|
-
playbackProperties: PropTypes.number,
|
|
232
|
-
keyDownEvent: PropTypes.object,
|
|
233
|
-
onVdoPlaybackProperties: PropTypes.func,
|
|
234
|
-
seek: PropTypes.number,
|
|
235
|
-
fullscreen: PropTypes.bool,
|
|
236
|
-
onVdoEnterFullscreen: PropTypes.func,
|
|
237
|
-
onVdoExitFullscreen: PropTypes.func,
|
|
238
|
-
onIsInitialPortrait: PropTypes.func,
|
|
239
|
-
|
|
240
|
-
/* Wrapper component public api */
|
|
241
|
-
embedInfo: PropTypes.object,
|
|
242
|
-
playWhenReady: PropTypes.bool,
|
|
243
|
-
playbackSpeed: PropTypes.number,
|
|
244
|
-
onInitializationSuccess: PropTypes.func,
|
|
245
|
-
onInitializationFailure: PropTypes.func,
|
|
246
|
-
onLoading: PropTypes.func,
|
|
247
|
-
onLoaded: PropTypes.func,
|
|
248
|
-
onLoadError: PropTypes.func,
|
|
249
|
-
onPlayerStateChanged: PropTypes.func,
|
|
250
|
-
onProgress: PropTypes.func,
|
|
251
|
-
onBufferUpdate: PropTypes.func,
|
|
252
|
-
onPlaybackSpeedChanged: PropTypes.func,
|
|
253
|
-
onTracksChanged: PropTypes.func,
|
|
254
|
-
onMediaEnded: PropTypes.func,
|
|
255
|
-
onError: PropTypes.func,
|
|
256
|
-
onPlaybackProperties: PropTypes.func,
|
|
257
|
-
onEnterFullscreen: PropTypes.func,
|
|
258
|
-
onExitFullscreen: PropTypes.func,
|
|
259
|
-
|
|
260
|
-
/* Required */
|
|
261
|
-
...ViewPropTypes,
|
|
262
|
-
};
|
|
263
|
-
|
|
264
103
|
var RCTVdoPlayerUIView = requireNativeComponent('RCTVdoPlayerUIView', VdoPlayerUIView, {
|
|
265
104
|
nativeOnly: {
|
|
266
105
|
onInitSuccess: true,
|