Merge pull request #3 from react-native-community/master
Merge from master to my fork
This commit is contained in:
commit
03e2061e5a
@ -1,10 +1,11 @@
|
|||||||
## Changelog
|
## Changelog
|
||||||
|
|
||||||
### Next Version
|
### Version 4.3.0
|
||||||
* Fix iOS video not displaying after switching source [#1395](https://github.com/react-native-community/react-native-video/pull/1395)
|
* Fix iOS video not displaying after switching source [#1395](https://github.com/react-native-community/react-native-video/pull/1395)
|
||||||
* Add the filterEnabled flag, fixes iOS video start time regression [#1384](https://github.com/react-native-community/react-native-video/pull/1384)
|
* Add the filterEnabled flag, fixes iOS video start time regression [#1384](https://github.com/react-native-community/react-native-video/pull/1384)
|
||||||
* Fix text not appearing in release builds of Android apps [#1373](https://github.com/react-native-community/react-native-video/pull/1373)
|
* Fix text not appearing in release builds of Android apps [#1373](https://github.com/react-native-community/react-native-video/pull/1373)
|
||||||
* Update to ExoPlayer 2.9.3 [#1406](https://github.com/react-native-community/react-native-video/pull/1406)
|
* Update to ExoPlayer 2.9.3 [#1406](https://github.com/react-native-community/react-native-video/pull/1406)
|
||||||
|
* Add video track selection & onBandwidthUpdate [#1199](https://github.com/react-native-community/react-native-video/pull/1199)
|
||||||
|
|
||||||
### Version 4.2.0
|
### Version 4.2.0
|
||||||
* Don't initialize filters on iOS unless a filter is set. This was causing a startup performance regression [#1360](https://github.com/react-native-community/react-native-video/pull/1360)
|
* Don't initialize filters on iOS unless a filter is set. This was causing a startup performance regression [#1360](https://github.com/react-native-community/react-native-video/pull/1360)
|
||||||
|
79
README.md
79
README.md
@ -10,7 +10,7 @@ Version 3.x requires react-native >= 0.40.0
|
|||||||
### Version 4.0.0 breaking changes
|
### Version 4.0.0 breaking changes
|
||||||
Version 4.0.0 changes some behaviors and may require updates to your Gradle files. See [Updating](#updating) for details.
|
Version 4.0.0 changes some behaviors and may require updates to your Gradle files. See [Updating](#updating) for details.
|
||||||
|
|
||||||
Version 4.0.0 now requires Android SDK 26+ and Gradle 3 plugin in order to support ExoPlayer 2.9.0. Google is dropping support for apps using SDKs older than 26 as of October 2018 and Gradle 2 as of January 2019. React Native 0.57 defaults to Gradle 3 & SDK 27.
|
Version 4.0.0 now requires Android target SDK 26+ and Gradle 3 plugin in order to support ExoPlayer 2.9.0. Google is dropping support for apps using target SDKs older than 26 as of October 2018 and Gradle 2 as of January 2019. React Native 0.57 defaults to Gradle 3 & SDK 27.
|
||||||
|
|
||||||
If you need to support an older React Native version, you should use react-native-video 3.2.1.
|
If you need to support an older React Native version, you should use react-native-video 3.2.1.
|
||||||
|
|
||||||
@ -278,9 +278,11 @@ var styles = StyleSheet.create({
|
|||||||
* [progressUpdateInterval](#progressupdateinterval)
|
* [progressUpdateInterval](#progressupdateinterval)
|
||||||
* [rate](#rate)
|
* [rate](#rate)
|
||||||
* [repeat](#repeat)
|
* [repeat](#repeat)
|
||||||
|
* [reportBandwidth](#reportbandwidth)
|
||||||
* [resizeMode](#resizemode)
|
* [resizeMode](#resizemode)
|
||||||
* [selectedAudioTrack](#selectedaudiotrack)
|
* [selectedAudioTrack](#selectedaudiotrack)
|
||||||
* [selectedTextTrack](#selectedtexttrack)
|
* [selectedTextTrack](#selectedtexttrack)
|
||||||
|
* [selectedVideoTrack](#selectedvideotrack)
|
||||||
* [source](#source)
|
* [source](#source)
|
||||||
* [stereoPan](#stereopan)
|
* [stereoPan](#stereopan)
|
||||||
* [textTracks](#texttracks)
|
* [textTracks](#texttracks)
|
||||||
@ -289,6 +291,7 @@ var styles = StyleSheet.create({
|
|||||||
|
|
||||||
### Event props
|
### Event props
|
||||||
* [onAudioBecomingNoisy](#onaudiobecomingnoisy)
|
* [onAudioBecomingNoisy](#onaudiobecomingnoisy)
|
||||||
|
* [onBandwidthUpdate](#onbandwidthupdate)
|
||||||
* [onEnd](#onend)
|
* [onEnd](#onend)
|
||||||
* [onExternalPlaybackChange](#onexternalplaybackchange)
|
* [onExternalPlaybackChange](#onexternalplaybackchange)
|
||||||
* [onFullscreenPlayerWillPresent](#onfullscreenplayerwillpresent)
|
* [onFullscreenPlayerWillPresent](#onfullscreenplayerwillpresent)
|
||||||
@ -417,15 +420,18 @@ Platforms: iOS
|
|||||||
Platforms: iOS
|
Platforms: iOS
|
||||||
|
|
||||||
#### headers
|
#### headers
|
||||||
Pass headers to the HTTP client. Can be used for authorization.
|
Pass headers to the HTTP client. Can be used for authorization. Headers must be a part of the source object.
|
||||||
|
|
||||||
To enable this on iOS, you will need to manually edit RCTVideo.m and uncomment the header code in the playerItemForSource function. This is because the code used a private API and may cause your app to be rejected by the App Store. Use at your own risk.
|
To enable this on iOS, you will need to manually edit RCTVideo.m and uncomment the header code in the playerItemForSource function. This is because the code used a private API and may cause your app to be rejected by the App Store. Use at your own risk.
|
||||||
|
|
||||||
Example:
|
Example:
|
||||||
```
|
```
|
||||||
headers={{
|
source={{
|
||||||
Authorization: 'bearer some-token-value',
|
uri: "https://www.example.com/video.mp4",
|
||||||
'X-Custom-Header': 'some value'
|
headers: {
|
||||||
|
Authorization: 'bearer some-token-value',
|
||||||
|
'X-Custom-Header': 'some value'
|
||||||
|
}
|
||||||
}}
|
}}
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -542,6 +548,14 @@ Determine whether to repeat the video when the end is reached
|
|||||||
|
|
||||||
Platforms: all
|
Platforms: all
|
||||||
|
|
||||||
|
#### reportBandwidth
|
||||||
|
Determine whether to generate onBandwidthUpdate events. This is needed due to the high frequency of these events on ExoPlayer.
|
||||||
|
|
||||||
|
* **false (default)** - Generate onBandwidthUpdate events
|
||||||
|
* **true** - Don't generate onBandwidthUpdate events
|
||||||
|
|
||||||
|
Platforms: Android ExoPlayer
|
||||||
|
|
||||||
#### resizeMode
|
#### resizeMode
|
||||||
Determines how to resize the video when the frame doesn't match the raw video dimensions.
|
Determines how to resize the video when the frame doesn't match the raw video dimensions.
|
||||||
* **"none" (default)** - Don't apply resize
|
* **"none" (default)** - Don't apply resize
|
||||||
@ -613,6 +627,35 @@ If a track matching the specified Type (and Value if appropriate) is unavailable
|
|||||||
|
|
||||||
Platforms: Android ExoPlayer, iOS
|
Platforms: Android ExoPlayer, iOS
|
||||||
|
|
||||||
|
#### selectedVideoTrack
|
||||||
|
Configure which video track should be played. By default, the player uses Adaptive Bitrate Streaming to automatically select the stream it thinks will perform best based on available bandwidth.
|
||||||
|
|
||||||
|
```
|
||||||
|
selectedVideoTrack={{
|
||||||
|
type: Type,
|
||||||
|
value: Value
|
||||||
|
}}
|
||||||
|
```
|
||||||
|
|
||||||
|
Example:
|
||||||
|
```
|
||||||
|
selectedVideoTrack={{
|
||||||
|
type: "resolution",
|
||||||
|
value: 480
|
||||||
|
}}
|
||||||
|
```
|
||||||
|
|
||||||
|
Type | Value | Description
|
||||||
|
--- | --- | ---
|
||||||
|
"auto" (default) | N/A | Let the player determine which track to play using ABR
|
||||||
|
"disabled" | N/A | Turn off video
|
||||||
|
"resolution" | number | Play the video track with the height specified, e.g. 480 for the 480p stream
|
||||||
|
"index" | number | Play the video track with the index specified as the value, e.g. 0
|
||||||
|
|
||||||
|
If a track matching the specified Type (and Value if appropriate) is unavailable, ABR will be used.
|
||||||
|
|
||||||
|
Platforms: Android ExoPlayer
|
||||||
|
|
||||||
#### source
|
#### source
|
||||||
Sets the media source. You can pass an asset loaded via require or an object with a uri.
|
Sets the media source. You can pass an asset loaded via require or an object with a uri.
|
||||||
|
|
||||||
@ -748,6 +791,26 @@ Payload: none
|
|||||||
|
|
||||||
Platforms: Android ExoPlayer, iOS
|
Platforms: Android ExoPlayer, iOS
|
||||||
|
|
||||||
|
#### onBandwidthUpdate
|
||||||
|
Callback function that is called when the available bandwidth changes.
|
||||||
|
|
||||||
|
Payload:
|
||||||
|
|
||||||
|
Property | Type | Description
|
||||||
|
--- | --- | ---
|
||||||
|
bitrate | number | The estimated bitrate in bits/sec
|
||||||
|
|
||||||
|
Example:
|
||||||
|
```
|
||||||
|
{
|
||||||
|
bitrate: 1000000
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
Note: On Android ExoPlayer, you must set the [reportBandwidth](#reportbandwidth) prop to enable this event. This is due to the high volume of events generated.
|
||||||
|
|
||||||
|
Platforms: Android ExoPlayer
|
||||||
|
|
||||||
#### onEnd
|
#### onEnd
|
||||||
Callback function that is called when the player reaches the end of the media.
|
Callback function that is called when the player reaches the end of the media.
|
||||||
|
|
||||||
@ -1110,8 +1173,8 @@ To enable audio to play in background on iOS the audio session needs to be set t
|
|||||||
|
|
||||||
### Version 4.0.0
|
### Version 4.0.0
|
||||||
|
|
||||||
#### Gradle 3 and SDK 26 requirement
|
#### Gradle 3 and target SDK 26 requirement
|
||||||
In order to support ExoPlayer 2.9.0, you must use version 3 or higher of the Gradle plugin. This is included by default in React Native 0.57. ExoPlayer
|
In order to support ExoPlayer 2.9.0, you must use version 3 or higher of the Gradle plugin. This is included by default in React Native 0.57.
|
||||||
|
|
||||||
#### ExoPlayer 2.9.0 Java 1.8 requirement
|
#### ExoPlayer 2.9.0 Java 1.8 requirement
|
||||||
ExoPlayer 2.9.0 uses some Java 1.8 features, so you may need to enable support for Java 1.8 in your app/build.gradle file. If you get an error, compiling with ExoPlayer like:
|
ExoPlayer 2.9.0 uses some Java 1.8 features, so you may need to enable support for Java 1.8 in your app/build.gradle file. If you get an error, compiling with ExoPlayer like:
|
||||||
@ -1146,7 +1209,7 @@ Previously, on Android MediaPlayer if you setup an AppState event when the app w
|
|||||||
|
|
||||||
Note, Windows does not have a concept of an app going into the background, so this doesn't apply there.
|
Note, Windows does not have a concept of an app going into the background, so this doesn't apply there.
|
||||||
|
|
||||||
#### Use Android SDK 27 by default
|
#### Use Android target SDK 27 by default
|
||||||
Version 3.0 updates the Android build tools and SDK to version 27. React Native is in the process of [switchting over](https://github.com/facebook/react-native/issues/18095#issuecomment-395596130) to SDK 27 in preparation for Google's requirement that new Android apps [use SDK 26](https://android-developers.googleblog.com/2017/12/improving-app-security-and-performance.html) by August 2018.
|
Version 3.0 updates the Android build tools and SDK to version 27. React Native is in the process of [switchting over](https://github.com/facebook/react-native/issues/18095#issuecomment-395596130) to SDK 27 in preparation for Google's requirement that new Android apps [use SDK 26](https://android-developers.googleblog.com/2017/12/improving-app-security-and-performance.html) by August 2018.
|
||||||
|
|
||||||
You will either need to install the version 27 SDK and version 27.0.3 buildtools or modify your build.gradle file to configure react-native-video to use the same build settings as the rest of your app as described below.
|
You will either need to install the version 27 SDK and version 27.0.3 buildtools or modify your build.gradle file to configure react-native-video to use the same build settings as the rest of your app as described below.
|
||||||
|
@ -21,12 +21,6 @@ dependencies {
|
|||||||
implementation('com.google.android.exoplayer:exoplayer:2.9.3') {
|
implementation('com.google.android.exoplayer:exoplayer:2.9.3') {
|
||||||
exclude group: 'com.android.support'
|
exclude group: 'com.android.support'
|
||||||
}
|
}
|
||||||
implementation project(':exoplayer-library-core')
|
|
||||||
implementation project(':exoplayer-library-dash')
|
|
||||||
implementation project(':exoplayer-library-ui')
|
|
||||||
implementation project(':exoplayer-library-smoothstreaming')
|
|
||||||
implementation project(':exoplayer-library-hls')
|
|
||||||
implementation project(':exoplayer-extension-okhttp')
|
|
||||||
|
|
||||||
// All support libs must use the same version
|
// All support libs must use the same version
|
||||||
implementation "com.android.support:support-annotations:${safeExtGet('supportLibVersion', '+')}"
|
implementation "com.android.support:support-annotations:${safeExtGet('supportLibVersion', '+')}"
|
||||||
|
@ -889,11 +889,13 @@ class ReactExoplayerView extends FrameLayout implements
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (groupIndex == C.INDEX_UNSET && trackType == C.TRACK_TYPE_VIDEO) { // Video auto
|
if (groupIndex == C.INDEX_UNSET && trackType == C.TRACK_TYPE_VIDEO) { // Video auto
|
||||||
TrackGroup group = groups.get(0);
|
if (groups.length != 0) {
|
||||||
tracks = new int[group.length];
|
TrackGroup group = groups.get(0);
|
||||||
groupIndex = 0;
|
tracks = new int[group.length];
|
||||||
for (int j = 0; j < group.length; j++) {
|
groupIndex = 0;
|
||||||
tracks[j] = j;
|
for (int j = 0; j < group.length; j++) {
|
||||||
|
tracks[j] = j;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else if (groupIndex == C.INDEX_UNSET) {
|
} else if (groupIndex == C.INDEX_UNSET) {
|
||||||
trackSelector.setParameters(disableParameters);
|
trackSelector.setParameters(disableParameters);
|
||||||
|
@ -178,7 +178,7 @@ class VideoEventEmitter {
|
|||||||
|
|
||||||
void bandwidthReport(double bitRateEstimate) {
|
void bandwidthReport(double bitRateEstimate) {
|
||||||
WritableMap event = Arguments.createMap();
|
WritableMap event = Arguments.createMap();
|
||||||
event.putDouble(EVENT_PROP_BITRATE, bitRate);
|
event.putDouble(EVENT_PROP_BITRATE, bitRateEstimate);
|
||||||
receiveEvent(EVENT_BANDWIDTH, event);
|
receiveEvent(EVENT_BANDWIDTH, event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -719,9 +719,11 @@ static int const RCTVideoUnset = -1;
|
|||||||
AVPlayerItemAccessLog *accessLog = [((AVPlayerItem *)notification.object) accessLog];
|
AVPlayerItemAccessLog *accessLog = [((AVPlayerItem *)notification.object) accessLog];
|
||||||
AVPlayerItemAccessLogEvent *lastEvent = accessLog.events.lastObject;
|
AVPlayerItemAccessLogEvent *lastEvent = accessLog.events.lastObject;
|
||||||
|
|
||||||
|
/* TODO: get this working
|
||||||
if (self.onBandwidthUpdate) {
|
if (self.onBandwidthUpdate) {
|
||||||
self.onBandwidthUpdate(@{@"bitrate": [NSNumber numberWithFloat:lastEvent.observedBitrate]});
|
self.onBandwidthUpdate(@{@"bitrate": [NSNumber numberWithFloat:lastEvent.observedBitrate]});
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)playbackStalled:(NSNotification *)notification
|
- (void)playbackStalled:(NSNotification *)notification
|
||||||
|
18
package.json
18
package.json
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "react-native-video",
|
"name": "react-native-video",
|
||||||
"version": "4.2.1",
|
"version": "4.3.1",
|
||||||
"description": "A <Video /> element for react-native",
|
"description": "A <Video /> element for react-native",
|
||||||
"main": "Video.js",
|
"main": "Video.js",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
@ -25,18 +25,22 @@
|
|||||||
],
|
],
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "git@github.com:brentvatne/react-native-video.git"
|
"url": "git@github.com:react-native-community/react-native-video.git"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"eslint": "1.10.3",
|
|
||||||
"babel-eslint": "5.0.0-beta8",
|
"babel-eslint": "5.0.0-beta8",
|
||||||
|
"eslint": "1.10.3",
|
||||||
|
"eslint-config-airbnb": "4.0.0",
|
||||||
"eslint-plugin-react": "3.16.1",
|
"eslint-plugin-react": "3.16.1",
|
||||||
"eslint-config-airbnb": "4.0.0"
|
"react": "^16.7.0",
|
||||||
|
"react-dom": "^16.7.0",
|
||||||
|
"react-hot-loader": "^4.6.3",
|
||||||
|
"react-native": "^0.57.8"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"keymirror": "0.1.1",
|
"keymirror": "^0.1.1",
|
||||||
"prop-types": "^15.5.10",
|
"prop-types": "^15.5.10",
|
||||||
"shaka-player": "2.4.4"
|
"shaka-player": "^2.4.4"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "node_modules/.bin/eslint *.js"
|
"test": "node_modules/.bin/eslint *.js"
|
||||||
@ -46,7 +50,7 @@
|
|||||||
"sourceDir": "./android-exoplayer"
|
"sourceDir": "./android-exoplayer"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"files":[
|
"files": [
|
||||||
"android-exoplayer",
|
"android-exoplayer",
|
||||||
"android",
|
"android",
|
||||||
"dom",
|
"dom",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user