Skip to content

Commit fab2a46

Browse files
author
Matt Votsikas
committed
Merge branch 'master' into backwards-compatible-update
* master: Added flag for background mode (TheWidlarzGroup#563) issue 310 - Added a new property, ignoreSilentSwitch. (TheWidlarzGroup#403) Add progressUpdateInterval to android-exoplayer (TheWidlarzGroup#540) Initial WPF Support (TheWidlarzGroup#385) added progressUpdateInterval to Android (TheWidlarzGroup#512) load new source if it is different (TheWidlarzGroup#502) Pausing progress if it was playing and the stating again (TheWidlarzGroup#526) bump android dependencies (TheWidlarzGroup#524) Update ExoPlayer to r2.2.0 (TheWidlarzGroup#505) Update readme (TheWidlarzGroup#497) [Android] App crash when unmounting video (TheWidlarzGroup#533) Fix/494 (TheWidlarzGroup#537) fix(RCTVideo.m): Fixed status bar disappearing issue
2 parents 900ee25 + ad89a1b commit fab2a46

30 files changed

+5642
-96
lines changed

README.md

+20-24
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ If you would like to allow other apps to play music over your video component, a
2727
...
2828
}
2929
```
30+
Note: you can also use the `ignoreSilentSwitch` prop, shown below.
3031

3132
#### Android
3233

@@ -36,48 +37,38 @@ Or if you have trouble, make the following additions to the given files manually
3637

3738
**android/settings.gradle**
3839

39-
```
40+
```gradle
4041
include ':react-native-video'
4142
project(':react-native-video').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-video/android')
4243
```
4344

4445
**android/app/build.gradle**
4546

46-
```
47+
```gradle
4748
dependencies {
4849
...
4950
compile project(':react-native-video')
5051
}
5152
```
5253

53-
**MainActivity.java**
54-
55-
On top, where imports are:
56-
57-
```java
58-
import com.brentvatne.react.ReactVideoPackage;
59-
```
60-
61-
Under `.addPackage(new MainReactPackage())`:
62-
63-
```java
64-
.addPackage(new ReactVideoPackage())
65-
```
66-
67-
### Note: In react-native >= 0.29.0 you have to edit `MainApplication.java`
68-
69-
**MainApplication.java** (react-native >= 0.29.0)
54+
**MainApplication.java**
7055

7156
On top, where imports are:
7257

7358
```java
7459
import com.brentvatne.react.ReactVideoPackage;
7560
```
7661

77-
Under `.addPackage(new MainReactPackage())`:
62+
Add the `ReactVideoPackage` class to your list of exported packages.
7863

7964
```java
80-
.addPackage(new ReactVideoPackage())
65+
@Override
66+
protected List<ReactPackage> getPackages() {
67+
return Arrays.asList(
68+
new MainReactPackage(),
69+
new ReactVideoPackage()
70+
);
71+
}
8172
```
8273

8374
#### Windows
@@ -90,14 +81,18 @@ Add the `ReactNativeVideo` project to your solution.
9081

9182
1. Open the solution in Visual Studio 2015
9283
2. Right-click Solution icon in Solution Explorer > Add > Existing Project...
93-
3. Select `node_modules\react-native-video\windows\ReactNativeVideo\ReactNativeVideo.csproj`
84+
3.
85+
UWP: Select `node_modules\react-native-video\windows\ReactNativeVideo\ReactNativeVideo.csproj`
86+
WPF: Select `node_modules\react-native-video\windows\ReactNativeVideo.Net46\ReactNativeVideo.Net46.csproj`
9487

9588
**windows/myapp/myapp.csproj**
9689

9790
Add a reference to `ReactNativeVideo` to your main application project. From Visual Studio 2015:
9891

9992
1. Right-click main application project > Add > Reference...
100-
2. Check `ReactNativeVideo` from Solution Projects.
93+
2.
94+
UWP: Check `ReactNativeVideo` from Solution Projects.
95+
WPF: Check `ReactNativeVideo.Net46` from Solution Projects.
10196

10297
**MainPage.cs**
10398

@@ -140,10 +135,11 @@ using System.Collections.Generic;
140135
volume={1.0} // 0 is muted, 1 is normal.
141136
muted={false} // Mutes the audio entirely.
142137
paused={false} // Pauses playback entirely.
143-
resizeMode="cover" // Fill the whole screen at aspect ratio.*
138+
resizeMode="cover" // Fill the whole screen at aspect ratio.*
144139
repeat={true} // Repeat forever.
145140
playInBackground={false} // Audio continues to play when app entering background.
146141
playWhenInactive={false} // [iOS] Video continues to play when control or notification center are shown.
142+
ignoreSilentSwitch={"ignore"} // [iOS] ignore | obey - When 'ignore', audio will still play with the iOS hard silent switch set to silent. When 'obey', audio will toggle with the switch. When not specified, will inherit audio settings as usual.
147143
progressUpdateInterval={250.0} // [iOS] Interval to fire onProgress (default to ~250ms)
148144
onLoadStart={this.loadStart} // Callback when video starts to load
149145
onLoad={this.setDuration} // Callback when video loads

Video.js

+1
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,7 @@ Video.propTypes = {
278278
rate: PropTypes.number,
279279
playInBackground: PropTypes.bool,
280280
playWhenInactive: PropTypes.bool,
281+
ignoreSilentSwitch: PropTypes.oneOf(['ignore', 'obey']),
281282
disableFocus: PropTypes.bool,
282283
controls: PropTypes.bool,
283284
currentTime: PropTypes.number,

android-exoplayer/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ https://github.com/google/ExoPlayer
3333
this.setState({ pause: true })
3434
}
3535

36-
onAudioFocusChanged(event: { hasAudioFocus: boolean }) {
36+
onAudioFocusChanged = (event: { hasAudioFocus: boolean }) => {
3737
if (!this.state.paused && !event.hasAudioFocus) {
3838
this.setState({ paused: true })
3939
}

android-exoplayer/build.gradle

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ apply plugin: 'com.android.library'
22

33
android {
44
compileSdkVersion 23
5-
buildToolsVersion "23.0.1"
5+
buildToolsVersion "25.0.2"
66

77
defaultConfig {
88
minSdkVersion 16
@@ -12,8 +12,8 @@ android {
1212

1313
dependencies {
1414
provided 'com.facebook.react:react-native:+'
15-
compile 'com.google.android.exoplayer:exoplayer:r2.1.1'
16-
compile('com.google.android.exoplayer:extension-okhttp:r2.1.1') {
15+
compile 'com.google.android.exoplayer:exoplayer:r2.2.0'
16+
compile('com.google.android.exoplayer:extension-okhttp:r2.2.0') {
1717
exclude group: 'com.squareup.okhttp3', module: 'okhttp'
1818
}
1919
compile 'com.squareup.okhttp3:okhttp:3.4.2'

android-exoplayer/src/main/java/com/brentvatne/exoplayer/DataSourceUtil.java

-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
import com.google.android.exoplayer2.upstream.DataSource;
88
import com.google.android.exoplayer2.upstream.DefaultBandwidthMeter;
99
import com.google.android.exoplayer2.upstream.DefaultDataSourceFactory;
10-
import com.google.android.exoplayer2.upstream.DefaultHttpDataSource;
1110
import com.google.android.exoplayer2.upstream.HttpDataSource;
1211
import com.google.android.exoplayer2.util.Util;
1312

0 commit comments

Comments
 (0)