Skip to content

Commit 3611f3b

Browse files
committed
Merge pull request phonegap#891 from mojoaxel/master
ChildBrowser iOS6 bugfix: setting audio session category to "Playback"
2 parents 38ca18b + 7d8f569 commit 3611f3b

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

iOS/ChildBrowser/ChildBrowserCommand.m

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,22 @@
44

55
#import "ChildBrowserCommand.h"
66
#import <Cordova/CDVViewController.h>
7+
#import <AVFoundation/AVFoundation.h>
78

89
@implementation ChildBrowserCommand
910

1011
@synthesize childBrowser;
1112

1213
- (void)showWebPage:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options // args: url
1314
{
15+
/* setting audio session category to "Playback" (since iOS 6) */
16+
AVAudioSession *audioSession = [AVAudioSession sharedInstance];
17+
NSError *setCategoryError = nil;
18+
BOOL ok = [audioSession setCategory:AVAudioSessionCategoryPlayback error:&setCategoryError];
19+
if (!ok) {
20+
NSLog(@"Error setting AVAudioSessionCategoryPlayback: %@", setCategoryError);
21+
};
22+
1423
if (self.childBrowser == nil) {
1524
#if __has_feature(objc_arc)
1625
self.childBrowser = [[ChildBrowserViewController alloc] initWithScale:NO];

0 commit comments

Comments
 (0)