diff --git a/CHANGELOG.md b/CHANGELOG.md index 04567483..8668a915 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,9 +1,12 @@ ## Changelog -### next +### 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) +* Replaced RCTBubblingEventBlock events by RCTDirectEventBlock to avoid event name collisions [#1625](https://github.com/react-native-community/react-native-video/pull/1625) * Added `onPlaybackRateChange` to README [#1578](https://github.com/react-native-community/react-native-video/pull/1578) * Added `onReadyForDisplay` to README [#1627](https://github.com/react-native-community/react-native-video/pull/1627) * Improved handling of poster image. Fixes bug with displaying video and poster simultaneously. [#1627](https://github.com/react-native-community/react-native-video/pull/1627) +* Fix background audio stopping on iOS when using `controls` [#1614](https://github.com/react-native-community/react-native-video/pull/1614) ### Version 4.4.1 * Fix tvOS picture-in-picture compilation regression [#1518](https://github.com/react-native-community/react-native-video/pull/1518) diff --git a/android-exoplayer/build.gradle b/android-exoplayer/build.gradle index 717d04ad..7fccb220 100644 --- a/android-exoplayer/build.gradle +++ b/android-exoplayer/build.gradle @@ -22,7 +22,7 @@ android { } dependencies { - compileOnly "com.facebook.react:react-native:${safeExtGet('reactNativeVersion', '+')}" + implementation "com.facebook.react:react-native:${safeExtGet('reactNativeVersion', '+')}" implementation('com.google.android.exoplayer:exoplayer:2.9.3') { exclude group: 'com.android.support' } diff --git a/android/build.gradle b/android/build.gradle index ff05f873..df1bb2c8 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -21,6 +21,6 @@ android { dependencies { //noinspection GradleDynamicVersion - compileOnly "com.facebook.react:react-native:${safeExtGet('reactNativeVersion', '+')}" + implementation "com.facebook.react:react-native:${safeExtGet('reactNativeVersion', '+')}" implementation 'com.yqritc:android-scalablevideoview:1.0.4' } diff --git a/ios/Video/RCTVideo.h b/ios/Video/RCTVideo.h index 19d5d19f..26d436c2 100644 --- a/ios/Video/RCTVideo.h +++ b/ios/Video/RCTVideo.h @@ -21,27 +21,27 @@ @interface RCTVideo : UIView #endif -@property (nonatomic, copy) RCTBubblingEventBlock onVideoLoadStart; -@property (nonatomic, copy) RCTBubblingEventBlock onVideoLoad; -@property (nonatomic, copy) RCTBubblingEventBlock onVideoBuffer; -@property (nonatomic, copy) RCTBubblingEventBlock onVideoError; -@property (nonatomic, copy) RCTBubblingEventBlock onVideoProgress; -@property (nonatomic, copy) RCTBubblingEventBlock onBandwidthUpdate; -@property (nonatomic, copy) RCTBubblingEventBlock onVideoSeek; -@property (nonatomic, copy) RCTBubblingEventBlock onVideoEnd; -@property (nonatomic, copy) RCTBubblingEventBlock onTimedMetadata; -@property (nonatomic, copy) RCTBubblingEventBlock onVideoAudioBecomingNoisy; -@property (nonatomic, copy) RCTBubblingEventBlock onVideoFullscreenPlayerWillPresent; -@property (nonatomic, copy) RCTBubblingEventBlock onVideoFullscreenPlayerDidPresent; -@property (nonatomic, copy) RCTBubblingEventBlock onVideoFullscreenPlayerWillDismiss; -@property (nonatomic, copy) RCTBubblingEventBlock onVideoFullscreenPlayerDidDismiss; -@property (nonatomic, copy) RCTBubblingEventBlock onReadyForDisplay; -@property (nonatomic, copy) RCTBubblingEventBlock onPlaybackStalled; -@property (nonatomic, copy) RCTBubblingEventBlock onPlaybackResume; -@property (nonatomic, copy) RCTBubblingEventBlock onPlaybackRateChange; -@property (nonatomic, copy) RCTBubblingEventBlock onVideoExternalPlaybackChange; -@property (nonatomic, copy) RCTBubblingEventBlock onPictureInPictureStatusChanged; -@property (nonatomic, copy) RCTBubblingEventBlock onRestoreUserInterfaceForPictureInPictureStop; +@property (nonatomic, copy) RCTDirectEventBlock onVideoLoadStart; +@property (nonatomic, copy) RCTDirectEventBlock onVideoLoad; +@property (nonatomic, copy) RCTDirectEventBlock onVideoBuffer; +@property (nonatomic, copy) RCTDirectEventBlock onVideoError; +@property (nonatomic, copy) RCTDirectEventBlock onVideoProgress; +@property (nonatomic, copy) RCTDirectEventBlock onBandwidthUpdate; +@property (nonatomic, copy) RCTDirectEventBlock onVideoSeek; +@property (nonatomic, copy) RCTDirectEventBlock onVideoEnd; +@property (nonatomic, copy) RCTDirectEventBlock onTimedMetadata; +@property (nonatomic, copy) RCTDirectEventBlock onVideoAudioBecomingNoisy; +@property (nonatomic, copy) RCTDirectEventBlock onVideoFullscreenPlayerWillPresent; +@property (nonatomic, copy) RCTDirectEventBlock onVideoFullscreenPlayerDidPresent; +@property (nonatomic, copy) RCTDirectEventBlock onVideoFullscreenPlayerWillDismiss; +@property (nonatomic, copy) RCTDirectEventBlock onVideoFullscreenPlayerDidDismiss; +@property (nonatomic, copy) RCTDirectEventBlock onReadyForDisplay; +@property (nonatomic, copy) RCTDirectEventBlock onPlaybackStalled; +@property (nonatomic, copy) RCTDirectEventBlock onPlaybackResume; +@property (nonatomic, copy) RCTDirectEventBlock onPlaybackRateChange; +@property (nonatomic, copy) RCTDirectEventBlock onVideoExternalPlaybackChange; +@property (nonatomic, copy) RCTDirectEventBlock onPictureInPictureStatusChanged; +@property (nonatomic, copy) RCTDirectEventBlock onRestoreUserInterfaceForPictureInPictureStop; - (instancetype)initWithEventDispatcher:(RCTEventDispatcher *)eventDispatcher NS_DESIGNATED_INITIALIZER; diff --git a/ios/Video/RCTVideo.m b/ios/Video/RCTVideo.m index e7f4b557..71bf82d8 100644 --- a/ios/Video/RCTVideo.m +++ b/ios/Video/RCTVideo.m @@ -223,6 +223,7 @@ static int const RCTVideoUnset = -1; if (_playInBackground) { // Needed to play sound in background. See https://developer.apple.com/library/ios/qa/qa1668/_index.html [_playerLayer setPlayer:nil]; + [_playerViewController setPlayer:nil]; } } @@ -231,6 +232,7 @@ static int const RCTVideoUnset = -1; [self applyModifiers]; if (_playInBackground) { [_playerLayer setPlayer:_player]; + [_playerViewController setPlayer:_player]; } } diff --git a/ios/Video/RCTVideoManager.m b/ios/Video/RCTVideoManager.m index a608f32e..1614eab1 100644 --- a/ios/Video/RCTVideoManager.m +++ b/ios/Video/RCTVideoManager.m @@ -45,25 +45,25 @@ RCT_EXPORT_VIEW_PROPERTY(filterEnabled, BOOL); RCT_EXPORT_VIEW_PROPERTY(progressUpdateInterval, float); RCT_EXPORT_VIEW_PROPERTY(restoreUserInterfaceForPIPStopCompletionHandler, BOOL); /* Should support: onLoadStart, onLoad, and onError to stay consistent with Image */ -RCT_EXPORT_VIEW_PROPERTY(onVideoLoadStart, RCTBubblingEventBlock); -RCT_EXPORT_VIEW_PROPERTY(onVideoLoad, RCTBubblingEventBlock); -RCT_EXPORT_VIEW_PROPERTY(onVideoBuffer, RCTBubblingEventBlock); -RCT_EXPORT_VIEW_PROPERTY(onVideoError, RCTBubblingEventBlock); -RCT_EXPORT_VIEW_PROPERTY(onVideoProgress, RCTBubblingEventBlock); -RCT_EXPORT_VIEW_PROPERTY(onBandwidthUpdate, RCTBubblingEventBlock); -RCT_EXPORT_VIEW_PROPERTY(onVideoSeek, RCTBubblingEventBlock); -RCT_EXPORT_VIEW_PROPERTY(onVideoEnd, RCTBubblingEventBlock); -RCT_EXPORT_VIEW_PROPERTY(onTimedMetadata, RCTBubblingEventBlock); -RCT_EXPORT_VIEW_PROPERTY(onVideoAudioBecomingNoisy, RCTBubblingEventBlock); -RCT_EXPORT_VIEW_PROPERTY(onVideoFullscreenPlayerWillPresent, RCTBubblingEventBlock); -RCT_EXPORT_VIEW_PROPERTY(onVideoFullscreenPlayerDidPresent, RCTBubblingEventBlock); -RCT_EXPORT_VIEW_PROPERTY(onVideoFullscreenPlayerWillDismiss, RCTBubblingEventBlock); -RCT_EXPORT_VIEW_PROPERTY(onVideoFullscreenPlayerDidDismiss, RCTBubblingEventBlock); -RCT_EXPORT_VIEW_PROPERTY(onReadyForDisplay, RCTBubblingEventBlock); -RCT_EXPORT_VIEW_PROPERTY(onPlaybackStalled, RCTBubblingEventBlock); -RCT_EXPORT_VIEW_PROPERTY(onPlaybackResume, RCTBubblingEventBlock); -RCT_EXPORT_VIEW_PROPERTY(onPlaybackRateChange, RCTBubblingEventBlock); -RCT_EXPORT_VIEW_PROPERTY(onVideoExternalPlaybackChange, RCTBubblingEventBlock); +RCT_EXPORT_VIEW_PROPERTY(onVideoLoadStart, RCTDirectEventBlock); +RCT_EXPORT_VIEW_PROPERTY(onVideoLoad, RCTDirectEventBlock); +RCT_EXPORT_VIEW_PROPERTY(onVideoBuffer, RCTDirectEventBlock); +RCT_EXPORT_VIEW_PROPERTY(onVideoError, RCTDirectEventBlock); +RCT_EXPORT_VIEW_PROPERTY(onVideoProgress, RCTDirectEventBlock); +RCT_EXPORT_VIEW_PROPERTY(onBandwidthUpdate, RCTDirectEventBlock); +RCT_EXPORT_VIEW_PROPERTY(onVideoSeek, RCTDirectEventBlock); +RCT_EXPORT_VIEW_PROPERTY(onVideoEnd, RCTDirectEventBlock); +RCT_EXPORT_VIEW_PROPERTY(onTimedMetadata, RCTDirectEventBlock); +RCT_EXPORT_VIEW_PROPERTY(onVideoAudioBecomingNoisy, RCTDirectEventBlock); +RCT_EXPORT_VIEW_PROPERTY(onVideoFullscreenPlayerWillPresent, RCTDirectEventBlock); +RCT_EXPORT_VIEW_PROPERTY(onVideoFullscreenPlayerDidPresent, RCTDirectEventBlock); +RCT_EXPORT_VIEW_PROPERTY(onVideoFullscreenPlayerWillDismiss, RCTDirectEventBlock); +RCT_EXPORT_VIEW_PROPERTY(onVideoFullscreenPlayerDidDismiss, RCTDirectEventBlock); +RCT_EXPORT_VIEW_PROPERTY(onReadyForDisplay, RCTDirectEventBlock); +RCT_EXPORT_VIEW_PROPERTY(onPlaybackStalled, RCTDirectEventBlock); +RCT_EXPORT_VIEW_PROPERTY(onPlaybackResume, RCTDirectEventBlock); +RCT_EXPORT_VIEW_PROPERTY(onPlaybackRateChange, RCTDirectEventBlock); +RCT_EXPORT_VIEW_PROPERTY(onVideoExternalPlaybackChange, RCTDirectEventBlock); RCT_REMAP_METHOD(save, options:(NSDictionary *)options reactTag:(nonnull NSNumber *)reactTag @@ -79,8 +79,8 @@ RCT_REMAP_METHOD(save, } }]; } -RCT_EXPORT_VIEW_PROPERTY(onPictureInPictureStatusChanged, RCTBubblingEventBlock); -RCT_EXPORT_VIEW_PROPERTY(onRestoreUserInterfaceForPictureInPictureStop, RCTBubblingEventBlock); +RCT_EXPORT_VIEW_PROPERTY(onPictureInPictureStatusChanged, RCTDirectEventBlock); +RCT_EXPORT_VIEW_PROPERTY(onRestoreUserInterfaceForPictureInPictureStop, RCTDirectEventBlock); - (NSDictionary *)constantsToExport { diff --git a/package.json b/package.json index 08b0dafc..d86ed89f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "react-native-video", - "version": "4.4.1", + "version": "4.4.2", "description": "A