react-native-video
Advanced tools
Comparing version 3.1.0 to 3.2.0
## Changelog | ||
### Version 3.2.0 | ||
* Basic fullscreen support for Android MediaPlayer [#1138](https://github.com/react-native-community/react-native-video/pull/1138) | ||
* Simplify default Android SDK code [#1145](https://github.com/react-native-community/react-native-video/pull/1145) [#1146](https://github.com/react-native-community/react-native-video/pull/1146) | ||
* Various iOS sideloaded text track fixes [#1157](https://github.com/react-native-community/react-native-video/pull/1157) | ||
* Fix #1150 where assets with bundled assets don't work on iOS in release mode [#1162](https://github.com/react-native-community/react-native-video/pull/1162) | ||
* Support configuring the buffer on Android ExoPlayer [#1160](https://github.com/react-native-community/react-native-video/pull/1160) | ||
* Prevent sleep from sleeping while videos are playing on Android MediaPlayer [#1117](https://github.com/react-native-community/react-native-video/pull/1117) | ||
* Update NewtonSoft JSON to match react-native-windows version [#1169](https://github.com/react-native-community/react-native-video/pull/1169) | ||
### Version 3.1.0 | ||
@@ -4,0 +13,0 @@ * Support sidecar text tracks on iOS [#1109](https://github.com/react-native-community/react-native-video/pull/1109) |
{ | ||
"name": "react-native-video", | ||
"version": "3.1.0", | ||
"version": "3.2.0", | ||
"description": "A <Video /> element for react-native", | ||
@@ -5,0 +5,0 @@ "main": "Video.js", |
150
README.md
@@ -34,3 +34,3 @@ ## react-native-video | ||
Run `react-native link` to link the react-native-video library. | ||
Run `react-native link react-native-video` to link the react-native-video library. | ||
@@ -57,6 +57,4 @@ If you would like to allow other apps to play music over your video component, add: | ||
Run `react-native link` to link the react-native-video library. | ||
`react-native link react-native-video` doesn’t work properly with the tvOS target so we need to add the library manually. | ||
`react-native link` doesn’t work properly with the tvOS target so we need to add the library manually. | ||
First select your project in Xcode. | ||
@@ -82,3 +80,3 @@ | ||
Run `react-native link` to link the react-native-video library. | ||
Run `react-native link react-native-video` to link the react-native-video library. | ||
@@ -186,2 +184,6 @@ Or if you have trouble, make the following additions to the given files manually: | ||
```javascript | ||
// Load the module | ||
import Video from 'react-native-video'; | ||
// Within your render function, assuming you have a file called | ||
@@ -198,17 +200,4 @@ // "background.mp4" in your project. You can include multiple videos | ||
onError={this.videoError} // Callback when video cannot be loaded | ||
onFullscreenPlayerWillPresent={this.fullScreenPlayerWillPresent} // Callback before fullscreen starts | ||
onFullscreenPlayerDidPresent={this.fullScreenPlayerDidPresent} // Callback after fullscreen started | ||
onFullscreenPlayerWillDismiss={this.fullScreenPlayerWillDismiss} // Callback before fullscreen stops | ||
onFullscreenPlayerDidDismiss={this.fullScreenPlayerDidDismiss} // Callback after fullscreen stopped | ||
style={styles.backgroundVideo} /> | ||
// Later to trigger fullscreen | ||
this.player.presentFullscreenPlayer() | ||
// Disable fullscreen | ||
this.player.dismissFullscreenPlayer() | ||
// To set video position in seconds (seek) | ||
this.player.seek(0) | ||
// Later on in your styles.. | ||
@@ -229,2 +218,3 @@ var styles = StyleSheet.create({ | ||
* [audioOnly](#audioonly) | ||
* [bufferConfig](#bufferconfig) | ||
* [ignoreSilentSwitch](#ignoresilentswitch) | ||
@@ -241,2 +231,3 @@ * [muted](#muted) | ||
* [resizeMode](#resizemode) | ||
* [selectedAudioTrack](#selectedaudiotrack) | ||
* [selectedTextTrack](#selectedtexttrack) | ||
@@ -250,2 +241,6 @@ * [stereoPan](#stereopan) | ||
* [onAudioBecomingNoisy](#onaudiobecomingnoisy) | ||
* [onFullscreenPlayerWillPresent](#onfullscreenplayerwillpresent) | ||
* [onFullscreenPlayerDidPresent](#onfullscreenplayerdidpresent) | ||
* [onFullscreenPlayerWillDismiss](#onfullscreenplayerwilldismiss) | ||
* [onFullscreenPlayerDidDismiss](#onfullscreenplayerdiddismiss) | ||
* [onLoad](#onload) | ||
@@ -257,2 +252,4 @@ * [onLoadStart](#onloadstart) | ||
### Methods | ||
* [dismissFullscreenPlayer](#dismissfullscreenplayer) | ||
* [presentFullscreenPlayer](#presentfullscreenplayer) | ||
* [seek](#seek) | ||
@@ -278,2 +275,26 @@ | ||
#### bufferConfig | ||
Adjust the buffer settings. This prop takes an object with one or more of the properties listed below. | ||
Property | Type | Description | ||
--- | --- | --- | ||
minBufferMs | number | The default minimum duration of media that the player will attempt to ensure is buffered at all times, in milliseconds. | ||
maxBufferMs | number | The default maximum duration of media that the player will attempt to buffer, in milliseconds. | ||
bufferForPlaybackMs | number | The default duration of media that must be buffered for playback to start or resume following a user action such as a seek, in milliseconds. | ||
playbackAfterRebufferMs | number | The default duration of media that must be buffered for playback to resume after a rebuffer, in milliseconds. A rebuffer is defined to be caused by buffer depletion rather than a user action. | ||
This prop should only be set when you are setting the source, changing it after the media is loaded will cause it to be reloaded. | ||
Example with default values: | ||
``` | ||
bufferConfig={{ | ||
minBufferMs: 15000, | ||
maxBufferMs: 50000, | ||
bufferForPlaybackMs: 2500, | ||
bufferForPlaybackAfterRebufferMs: 5000 | ||
}} | ||
``` | ||
Platforms: Android ExoPlayer | ||
#### ignoreSilentSwitch | ||
@@ -369,2 +390,32 @@ Controls the iOS silent switch behavior | ||
#### selectedAudioTrack | ||
Configure which audio track, if any, is played. | ||
``` | ||
selectedAudioTrack={{ | ||
type: Type, | ||
value: Value | ||
}} | ||
``` | ||
Example: | ||
``` | ||
selectedAudioTrack={{ | ||
type: "title", | ||
value: "Dubbing" | ||
}} | ||
``` | ||
Type | Value | Description | ||
--- | --- | --- | ||
"system" (default) | N/A | Play the audio track that matches the system language. If none match, play the first track. | ||
"disabled" | N/A | Turn off audio | ||
"title" | string | Play the audio track with the title specified as the Value, e.g. "French" | ||
"language" | string | Play the audio track with the language specified as the Value, e.g. "fr" | ||
"index" | number | Play the audio track with the index specified as the value, e.g. 0 | ||
If a track matching the specified Type (and Value if appropriate) is unavailable, the first audio track will be played. If multiple tracks match the criteria, the first match will be used. | ||
Platforms: Android ExoPlayer, iOS | ||
#### selectedTextTrack | ||
@@ -474,2 +525,30 @@ Configure which text track (caption or subtitle), if any, is shown. | ||
#### onFullscreenPlayerWillPresent | ||
Callback function that is called when the player is about to enter fullscreen mode. | ||
Payload: none | ||
Platforms: Android ExoPlayer, Android MediaPlayer, iOS | ||
#### onFullscreenPlayerDidPresent | ||
Callback function that is called when the player has entered fullscreen mode. | ||
Payload: none | ||
Platforms: Android ExoPlayer, Android MediaPlayer, iOS | ||
#### onFullscreenPlayerWillDismiss | ||
Callback function that is called when the player is about to exit fullscreen mode. | ||
Payload: none | ||
Platforms: Android ExoPlayer, Android MediaPlayer, iOS | ||
#### onFullscreenPlayerDidDismiss | ||
Callback function that is called when the player has exited fullscreen mode. | ||
Payload: none | ||
Platforms: Android ExoPlayer, Android MediaPlayer, iOS | ||
#### onLoad | ||
@@ -485,3 +564,4 @@ Callback function that is called when the media is loaded and ready to play. | ||
naturalSize | object | Properties:<br> * width - Width in pixels that the video was encoded at<br> * height - Height in pixels that the video was encoded at<br> * orientation - "portrait" or "landscape" | ||
textTracks | array | An array of text track info objects with the following properties:<br> * index - Index number<br> * title - Description of the track<br> * language - 2 letter [ISO 639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) language code<br> * type - Mime type of track | ||
audioTracks | array | An array of audio track info objects with the following properties:<br> * index - Index number<br> * title - Description of the track<br> * language - 2 letter [ISO 639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) or 3 letter [ISO639-2](https://en.wikipedia.org/wiki/List_of_ISO_639-2_codes) language code<br> * type - Mime type of track | ||
textTracks | array | An array of text track info objects with the following properties:<br> * index - Index number<br> * title - Description of the track<br> * language - 2 letter [ISO 639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) or 3 letter [ISO 639-2](https://en.wikipedia.org/wiki/List_of_ISO_639-2_codes) language code<br> * type - Mime type of track | ||
@@ -504,2 +584,6 @@ Example: | ||
}, | ||
audioTracks: [ | ||
{ language: 'es', title: 'Spanish', type: 'audio/mpeg', index: 0 }, | ||
{ language: 'en', title: 'English', type: 'audio/mpeg', index: 1 } | ||
], | ||
textTracks: [ | ||
@@ -586,2 +670,30 @@ { title: '#1 French', language: 'fr', index: 0, type: 'text/vtt' }, | ||
#### dismissFullscreenPlayer | ||
`dismissFullscreenPlayer()` | ||
Take the player out of fullscreen mode. | ||
Example: | ||
``` | ||
this.player.dismissFullscreenPlayer(); | ||
``` | ||
Platforms: Android ExoPlayer, Android MediaPlayer, iOS | ||
#### FullscreenPlayer | ||
`presentFullscreenPlayer()` | ||
Put the player in fullscreen mode. | ||
On iOS, this displays the video in a fullscreen view controller with controls. | ||
On Android ExoPlayer & MediaPlayer, this puts the navigation controls in fullscreen mode. It is not a complete fullscreen implementation, so you will still need to apply a style that makes the width and height match your screen dimensions to get a fullscreen video. | ||
Example: | ||
``` | ||
this.player.presentFullscreenPlayer(); | ||
``` | ||
Platforms: Android ExoPlayer, Android MediaPlayer, iOS | ||
#### seek() | ||
@@ -588,0 +700,0 @@ `seek(seconds)` |
13
Video.js
@@ -319,2 +319,9 @@ import React, {Component} from 'react'; | ||
allowsExternalPlayback: PropTypes.bool, | ||
selectedAudioTrack: PropTypes.shape({ | ||
type: PropTypes.string.isRequired, | ||
value: PropTypes.oneOfType([ | ||
PropTypes.string, | ||
PropTypes.number | ||
]) | ||
}), | ||
selectedTextTrack: PropTypes.shape({ | ||
@@ -342,2 +349,8 @@ type: PropTypes.string.isRequired, | ||
volume: PropTypes.number, | ||
bufferConfig: PropTypes.shape({ | ||
minBufferMs: PropTypes.number, | ||
maxBufferMs: PropTypes.number, | ||
bufferForPlaybackMs: PropTypes.number, | ||
bufferForPlaybackAfterRebufferMs: PropTypes.number, | ||
}), | ||
stereoPan: PropTypes.number, | ||
@@ -344,0 +357,0 @@ rate: PropTypes.number, |
{ | ||
"dependencies": { | ||
"Microsoft.NETCore.UniversalWindowsPlatform": "5.2.2", | ||
"Newtonsoft.Json": "9.0.1" | ||
"Newtonsoft.Json": "10.0.3" | ||
}, | ||
@@ -17,2 +17,2 @@ "frameworks": { | ||
} | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
587705
825
381