Explorar el Código

[SDL] iOS fix bug with audio interrupted by a phone call not restoring.

Sam Lantinga hace 7 años
padre
commit
abcfe80480
Se han modificado 1 ficheros con 3 adiciones y 2 borrados
  1. 3 2
      src/audio/coreaudio/SDL_coreaudio.m

+ 3 - 2
src/audio/coreaudio/SDL_coreaudio.m

@@ -376,15 +376,16 @@ static BOOL update_audio_session(_THIS, SDL_bool open)
             /* An interruption end notification is not guaranteed to be sent if
             /* An interruption end notification is not guaranteed to be sent if
              we were previously interrupted... resuming if needed when the app
              we were previously interrupted... resuming if needed when the app
              becomes active seems to be the way to go. */
              becomes active seems to be the way to go. */
+			// Note: object: below needs to be nil, as otherwise it filters by the object, and session doesn't send foreground / active notifications.  johna
             [center addObserver:listener
             [center addObserver:listener
                        selector:@selector(applicationBecameActive:)
                        selector:@selector(applicationBecameActive:)
                            name:UIApplicationDidBecomeActiveNotification
                            name:UIApplicationDidBecomeActiveNotification
-                         object:session];
+                         object:nil];
 
 
             [center addObserver:listener
             [center addObserver:listener
                        selector:@selector(applicationBecameActive:)
                        selector:@selector(applicationBecameActive:)
                            name:UIApplicationWillEnterForegroundNotification
                            name:UIApplicationWillEnterForegroundNotification
-                         object:session];
+                         object:nil];
 
 
             this->hidden->interruption_listener = CFBridgingRetain(listener);
             this->hidden->interruption_listener = CFBridgingRetain(listener);
         } else {
         } else {