Commit 848e6632 authored by Tobias Hasselrot's avatar Tobias Hasselrot
Browse files

Sound now plays when app is in background.

parent 1df54554
Loading
Loading
Loading
Loading
+7 −1
Changes for RCTVideo.m: 7 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -119,7 +119,10 @@ static NSString *const playbackBufferEmptyKeyPath = @"playbackBufferEmpty";

- (void)applicationWillResignActive:(NSNotification *)notification
{
   if (!_paused && !_playInBackground) {
  if (_playInBackground) {
    // Needed to play sound in background. See https://developer.apple.com/library/ios/qa/qa1668/_index.html
    [_playerLayer setPlayer:nil];
  } else if (!_paused) {
    [_player pause];
    [_player setRate:0.0];
  }
@@ -128,6 +131,9 @@ static NSString *const playbackBufferEmptyKeyPath = @"playbackBufferEmpty";
- (void)applicationWillEnterForeground:(NSNotification *)notification
{
  [self applyModifiers];
  if (_playInBackground) {
    [_playerLayer setPlayer:_player];
  }
}

#pragma mark - Progress