Merge pull request #8916 from sanikoyes/Pr-fix_audio_stoped_iOS

Fix audio can't resume in iOS platform
This commit is contained in:
Rémi Verschelde 2017-05-26 16:01:30 +02:00 committed by GitHub
commit 8d92065164
2 changed files with 10 additions and 0 deletions

View File

@ -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 {

View File

@ -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 {