diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2017-05-26 16:01:30 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-05-26 16:01:30 +0200 |
commit | 8d9206516428ca55f0832db5f261516654929676 (patch) | |
tree | 40c648966edb87ba0c54cd80f640cff0c494f5c1 /platform | |
parent | 755c07af195f751ee080b328a8f6775d8d4eaaf0 (diff) | |
parent | 7d374b5974448680a81f18751a7ca456a850020f (diff) |
Merge pull request #8916 from sanikoyes/Pr-fix_audio_stoped_iOS
Fix audio can't resume in iOS platform
Diffstat (limited to 'platform')
-rw-r--r-- | platform/iphone/app_delegate.mm | 5 | ||||
-rw-r--r-- | platform/iphone/audio_driver_iphone.cpp | 5 |
2 files changed, 10 insertions, 0 deletions
diff --git a/platform/iphone/app_delegate.mm b/platform/iphone/app_delegate.mm index 0d9750d701..576292b920 100644 --- a/platform/iphone/app_delegate.mm +++ b/platform/iphone/app_delegate.mm @@ -33,6 +33,7 @@ #import "gl_view.h" #include "main/main.h" #include "os_iphone.h" +#include "audio_driver_iphone.h" #ifdef MODULE_FACEBOOKSCORER_IOS_ENABLED #include "modules/FacebookScorer_ios/FacebookScorer.h" @@ -735,6 +736,10 @@ static int frame_count = 0; if (OSIPhone::get_singleton()->native_video_is_playing()) { OSIPhone::get_singleton()->native_video_unpause(); }; + + // Fixed audio can not resume if it is interrupted cause by an incoming phone call + if(AudioDriverIphone::get_singleton() != NULL) + AudioDriverIphone::get_singleton()->start(); } - (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url { diff --git a/platform/iphone/audio_driver_iphone.cpp b/platform/iphone/audio_driver_iphone.cpp index dea1ce405d..57b6388016 100644 --- a/platform/iphone/audio_driver_iphone.cpp +++ b/platform/iphone/audio_driver_iphone.cpp @@ -148,6 +148,11 @@ OSStatus AudioDriverIphone::output_callback(void *inRefCon, void AudioDriverIphone::start() { active = true; + // Resume audio + // iOS audio-thread stoped if it is interrupted cause by an incoming phone call + // Use AudioOutputUnitStart to re-create audio-thread + OSStatus result = AudioOutputUnitStart(audio_unit); + ERR_FAIL_COND(result != noErr); }; int AudioDriverIphone::get_mix_rate() const { |