From 780593fe87ae6be2338e023ce4bab46e3411b2a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Mari=C3=B1o=20Ruiz?= <1237997+CHaNGeTe@users.noreply.github.com> Date: Wed, 19 Jun 2019 21:11:42 +0200 Subject: [PATCH] Merge pull request #1614 from jenshandersson/master Remove video player when entering background correctly (rebased from commit 92f7459e6d2b2b4654a59a89ff1f86bf8d368830) --- CHANGELOG.md | 1 + ios/Video/RCTVideo.m | 2 ++ 2 files changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index f888c6913c..f9ed1c5e39 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ ### next * 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) +* 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/ios/Video/RCTVideo.m b/ios/Video/RCTVideo.m index 7bf1e07a70..b9fb8f9e36 100644 --- a/ios/Video/RCTVideo.m +++ b/ios/Video/RCTVideo.m @@ -241,6 +241,7 @@ - (void)applicationDidEnterBackground:(NSNotification *)notification 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]; } } @@ -249,6 +250,7 @@ - (void)applicationWillEnterForeground:(NSNotification *)notification [self applyModifiers]; if (_playInBackground) { [_playerLayer setPlayer:_player]; + [_playerViewController setPlayer:_player]; } }