Merge branch 'release/4.4.3' into feature/fix-when-muted-and-controls

This commit is contained in:
Daniel Mariño Ruiz 2019-07-08 12:15:55 +02:00 committed by GitHub
commit eae487c57e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 4125 additions and 2534 deletions

View File

@ -1,7 +1,11 @@
## Changelog ## Changelog
### next ### Version 4.4.3
* Fix mute/unmute when controls are present (iOS) [#1654](https://github.com/react-native-community/react-native-video/pull/1654) * Fix mute/unmute when controls are present (iOS) [#1654](https://github.com/react-native-community/react-native-video/pull/1654)
* Fix Android videos being able to play with background music/audio from other apps.
* Fixed memory leak on iOS when using `controls` [#1647](https://github.com/react-native-community/react-native-video/pull/1647)
* (Android) Update gradle and target SDK [#1629](https://github.com/react-native-community/react-native-video/pull/1629)
* Fix iOS stressed mount/unmount crash [#1646](https://github.com/react-native-community/react-native-video/pull/1646)
### Version 4.4.2 ### Version 4.4.2
* Change compileOnly to implementation on gradle (for newer gradle versions and react-native 0.59 support) [#1592](https://github.com/react-native-community/react-native-video/pull/1592) * Change compileOnly to implementation on gradle (for newer gradle versions and react-native 0.59 support) [#1592](https://github.com/react-native-community/react-native-video/pull/1592)

View File

@ -124,7 +124,9 @@ project(':react-native-video').projectDir = new File(rootProject.projectDir, '..
```gradle ```gradle
dependencies { dependencies {
... ...
compile project(':react-native-video') compile project(':react-native-video')
implementation "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}"
} }
``` ```
@ -370,6 +372,13 @@ For Android MediaPlayer, you will need to build your own controls or use a packa
Platforms: Android ExoPlayer, iOS, react-native-dom Platforms: Android ExoPlayer, iOS, react-native-dom
#### disableFocus
Determines whether video audio should override background music/audio in Android devices.
* ** false (default)** - Override background audio/music
* **true** - Let background audio/music from other apps play
Platforms: Android Exoplayer
#### filter #### filter
Add video filter Add video filter
* **FilterType.NONE (default)** - No Filter * **FilterType.NONE (default)** - No Filter

View File

@ -5,8 +5,8 @@ def safeExtGet(prop, fallback) {
} }
android { android {
compileSdkVersion safeExtGet('compileSdkVersion', 27) compileSdkVersion safeExtGet('compileSdkVersion', 28)
buildToolsVersion safeExtGet('buildToolsVersion', '27.0.3') buildToolsVersion safeExtGet('buildToolsVersion', '28.0.3')
compileOptions { compileOptions {
targetCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8
@ -15,7 +15,7 @@ android {
defaultConfig { defaultConfig {
minSdkVersion safeExtGet('minSdkVersion', 16) minSdkVersion safeExtGet('minSdkVersion', 16)
targetSdkVersion safeExtGet('targetSdkVersion', 27) targetSdkVersion safeExtGet('targetSdkVersion', 28)
versionCode 1 versionCode 1
versionName "1.0" versionName "1.0"
} }
@ -28,9 +28,9 @@ dependencies {
} }
// 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', '28.0.0')}"
implementation "com.android.support:support-compat:${safeExtGet('supportLibVersion', '+')}" implementation "com.android.support:support-compat:${safeExtGet('supportLibVersion', '28.0.0')}"
implementation "com.android.support:support-media-compat:${safeExtGet('supportLibVersion', '+')}" implementation "com.android.support:support-media-compat:${safeExtGet('supportLibVersion', '28.0.0')}"
implementation('com.google.android.exoplayer:extension-okhttp:2.9.3') { implementation('com.google.android.exoplayer:extension-okhttp:2.9.3') {
exclude group: 'com.squareup.okhttp3', module: 'okhttp' exclude group: 'com.squareup.okhttp3', module: 'okhttp'

View File

@ -449,7 +449,7 @@ class ReactExoplayerView extends FrameLayout implements
} }
private boolean requestAudioFocus() { private boolean requestAudioFocus() {
if (disableFocus) { if (disableFocus || srcUri == null) {
return true; return true;
} }
int result = audioManager.requestAudioFocus(this, int result = audioManager.requestAudioFocus(this,

View File

@ -5,12 +5,12 @@ def safeExtGet(prop, fallback) {
} }
android { android {
compileSdkVersion safeExtGet('compileSdkVersion', 27) compileSdkVersion safeExtGet('compileSdkVersion', 28)
buildToolsVersion safeExtGet('buildToolsVersion', '27.0.3') buildToolsVersion safeExtGet('buildToolsVersion', '28.0.3')
defaultConfig { defaultConfig {
minSdkVersion safeExtGet('minSdkVersion', 16) minSdkVersion safeExtGet('minSdkVersion', 16)
targetSdkVersion safeExtGet('targetSdkVersion', 27) targetSdkVersion safeExtGet('targetSdkVersion', 28)
versionCode 1 versionCode 1
versionName "1.0" versionName "1.0"
ndk { ndk {

View File

@ -83,13 +83,16 @@ def enableSeparateBuildPerCPUArchitecture = false
def enableProguardInReleaseBuilds = false def enableProguardInReleaseBuilds = false
android { android {
compileSdkVersion 25 compileSdkVersion rootProject.ext.compileSdkVersion
buildToolsVersion '25.0.2' buildToolsVersion rootProject.ext.buildToolsVersion
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
defaultConfig { defaultConfig {
applicationId "com.videoplayer" applicationId "com.videoplayer"
minSdkVersion 16 minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion 25 targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 1 versionCode 1
versionName "1.0" versionName "1.0"
ndk { ndk {
@ -108,6 +111,7 @@ android {
release { release {
signingConfig signingConfigs.debug signingConfig signingConfigs.debug
minifyEnabled enableProguardInReleaseBuilds minifyEnabled enableProguardInReleaseBuilds
matchingFallbacks = ['release', 'debug']
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro" proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
} }
} }
@ -127,9 +131,10 @@ android {
} }
dependencies { dependencies {
compile "com.android.support:appcompat-v7:25.2.0" implementation project(':react-native-video')
compile "com.facebook.react:react-native:+" // From node_modules compile "com.android.support:appcompat-v7:28.0.0"
compile project(':react-native-video') implementation "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}"
implementation "com.facebook.react:react-native:+" // From node_modules
// compile project(':react-native-video-exoplayer') // uncomment to use exoplayer // compile project(':react-native-video-exoplayer') // uncomment to use exoplayer
} }

View File

@ -8,7 +8,7 @@
<uses-sdk <uses-sdk
android:minSdkVersion="16" android:minSdkVersion="16"
android:targetSdkVersion="22" /> android:targetSdkVersion="28" />
<application <application
android:name=".MainApplication" android:name=".MainApplication"

View File

@ -2,8 +2,8 @@ package com.videoplayer;
import android.app.Application; import android.app.Application;
import com.brentvatne.react.ReactVideoPackage;
import com.facebook.react.ReactApplication; import com.facebook.react.ReactApplication;
import com.brentvatne.react.ReactVideoPackage;
import com.facebook.react.ReactNativeHost; import com.facebook.react.ReactNativeHost;
import com.facebook.react.ReactPackage; import com.facebook.react.ReactPackage;
import com.facebook.react.shell.MainReactPackage; import com.facebook.react.shell.MainReactPackage;
@ -24,8 +24,8 @@ public class MainApplication extends Application implements ReactApplication {
protected List<ReactPackage> getPackages() { protected List<ReactPackage> getPackages() {
return Arrays.asList( return Arrays.asList(
new MainReactPackage(), new MainReactPackage(),
new ReactVideoPackage() new ReactVideoPackage()
); );
} }
}; };

View File

@ -1,11 +1,20 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules. // Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript { buildscript {
ext {
buildToolsVersion = "28.0.3"
minSdkVersion = 16
compileSdkVersion = 28
targetSdkVersion = 28
supportLibVersion = "28.0.0"
}
repositories { repositories {
jcenter() jcenter()
google()
} }
dependencies { dependencies {
classpath 'com.android.tools.build:gradle:2.3.0' classpath 'com.android.tools.build:gradle:3.4.1'
// NOTE: Do not place your application dependencies here; they belong // NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files // in the individual module build.gradle files
@ -15,6 +24,12 @@ buildscript {
allprojects { allprojects {
repositories { repositories {
mavenLocal() mavenLocal()
maven {
url 'https://maven.google.com'
}
maven {
url "https://jitpack.io"
}
jcenter() jcenter()
maven { maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm

View File

@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip

View File

@ -1,12 +1,10 @@
rootProject.name = 'VideoPlayer' rootProject.name = 'VideoPlayer'
include ':app', include ':react-native-video'
':react-native-video', project(':react-native-video').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-video/android-exoplayer')
':react-native-video-exoplayer'
// Quick Local Development // Quick Local Development
//project(':react-native-video').projectDir = new File(rootProject.projectDir, '../../android') //project(':react-native-video').projectDir = new File(rootProject.projectDir, '../../android')
//project(':react-native-video-exoplayer').projectDir = new File(rootProject.projectDir, '../../android-exoplayer') //project(':react-native-video-exoplayer').projectDir = new File(rootProject.projectDir, '../../android-exoplayer')
project(':react-native-video').projectDir = new File(rootProject.projectDir, '../../android') include ':app'
project(':react-native-video-exoplayer').projectDir = new File(rootProject.projectDir, '../../android-exoplayer')

File diff suppressed because it is too large Load Diff

View File

@ -578,26 +578,7 @@ static int const RCTVideoUnset = -1;
- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context
{ {
// when controls==true, this is a hack to reset the rootview when rotation happens in fullscreen
if (object == _playerViewController.contentOverlayView) {
if ([keyPath isEqualToString:@"frame"]) {
CGRect oldRect = [change[NSKeyValueChangeOldKey] CGRectValue];
CGRect newRect = [change[NSKeyValueChangeNewKey] CGRectValue];
if (!CGRectEqualToRect(oldRect, newRect)) {
if (CGRectEqualToRect(newRect, [UIScreen mainScreen].bounds)) {
NSLog(@"in fullscreen");
} else NSLog(@"not fullscreen");
[self.reactViewController.view setFrame:[UIScreen mainScreen].bounds];
[self.reactViewController.view setNeedsLayout];
}
return;
} else
return [super observeValueForKeyPath:keyPath ofObject:object change:change context:context];
}
if([keyPath isEqualToString:readyForDisplayKeyPath] && [change objectForKey:NSKeyValueChangeNewKey] && self.onReadyForDisplay) { if([keyPath isEqualToString:readyForDisplayKeyPath] && [change objectForKey:NSKeyValueChangeNewKey] && self.onReadyForDisplay) {
self.onReadyForDisplay(@{@"target": self.reactTag}); self.onReadyForDisplay(@{@"target": self.reactTag});
return; return;
@ -713,7 +694,25 @@ static int const RCTVideoUnset = -1;
@"target": self.reactTag}); @"target": self.reactTag});
} }
} }
} else { } else if (object == _playerViewController.contentOverlayView) {
// when controls==true, this is a hack to reset the rootview when rotation happens in fullscreen
if ([keyPath isEqualToString:@"frame"]) {
CGRect oldRect = [change[NSKeyValueChangeOldKey] CGRectValue];
CGRect newRect = [change[NSKeyValueChangeNewKey] CGRectValue];
if (!CGRectEqualToRect(oldRect, newRect)) {
if (CGRectEqualToRect(newRect, [UIScreen mainScreen].bounds)) {
NSLog(@"in fullscreen");
} else NSLog(@"not fullscreen");
[self.reactViewController.view setFrame:[UIScreen mainScreen].bounds];
[self.reactViewController.view setNeedsLayout];
}
return;
}
} else if ([super respondsToSelector:@selector(observeValueForKeyPath:ofObject:change:context:)]) {
[super observeValueForKeyPath:keyPath ofObject:object change:change context:context]; [super observeValueForKeyPath:keyPath ofObject:object change:change context:context];
} }
} }
@ -1493,6 +1492,8 @@ static int const RCTVideoUnset = -1;
[_playerViewController.contentOverlayView removeObserver:self forKeyPath:@"frame"]; [_playerViewController.contentOverlayView removeObserver:self forKeyPath:@"frame"];
[_playerViewController removeObserver:self forKeyPath:readyForDisplayKeyPath]; [_playerViewController removeObserver:self forKeyPath:readyForDisplayKeyPath];
[_playerViewController.view removeFromSuperview]; [_playerViewController.view removeFromSuperview];
_playerViewController.rctDelegate = nil;
_playerViewController.player = nil;
_playerViewController = nil; _playerViewController = nil;
[self removePlayerTimeObserver]; [self removePlayerTimeObserver];

View File

@ -1,6 +1,6 @@
{ {
"name": "react-native-video", "name": "react-native-video",
"version": "4.4.2", "version": "4.4.3",
"description": "A <Video /> element for react-native", "description": "A <Video /> element for react-native",
"main": "Video.js", "main": "Video.js",
"license": "MIT", "license": "MIT",