floatinghotpot / cordova-plugin-nativeaudio

The low latency audio plugin is designed to enable low latency and polyphonic audio from Cordova/PhoneGap applications, using a very simple and basic API.
MIT License
233 stars 290 forks source link

Cordova 6.0.0: AudioSessionInitialize deprecated #72

Open av01d opened 8 years ago

av01d commented 8 years ago

I've upgraded cordova to version 6.0.0. When I add the cordova-plugin-nativeaudio plugin to my project, and build it (cordova build ios), the following warning appears:

/Users/arjan/Development/cordova/Test.dev/platforms/ios/Test/Plugins/cordova-plugin-nativeaudio/NativeAudio.m:32:5: warning: 
      'AudioSessionInitialize' is deprecated: first deprecated in iOS 7.0
      [-Wdeprecated-declarations]
    AudioSessionInitialize(NULL, NULL, nil , nil);
    ^
In module 'AudioToolbox' imported from /Users/arjan/Development/cordova/Test.dev/platforms/ios/Test/Plugins/cordova-plugin-nativeaudio/NativeAudio.h:12:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator9.2.sdk/System/Library/Frameworks/AudioToolbox.framework/Headers/AudioSession.h:649:2: note: 
      'AudioSessionInitialize' has been explicitly marked deprecated here
        AudioSessionInitialize(             CFRunLoopRef                        inRunLoop, 
        ^
1 warning generated.

Is there anything I can do to fix this? Workarounds?

stevenng commented 7 years ago

At first audio was working fine but now i'm experiencing the same issue. Any help would be appreciated.

ddennis commented 7 years ago

Same here - any help on how to fix would be much apriciated

ddennis commented 7 years ago

Seems to fix it:

AudioSessionInitialize( NULL, NULL, interruptionCallback, self );

replace with

[[AVAudioSession sharedInstance] setActive:YES error:nil];

Found here: http://stackoverflow.com/questions/19710046/a-fix-for-audiosessioninitialize-deprecated

THis make the drumPad example work, but it only plays the looping background sound not the drums. I am testing with ios version 9.2.1 , cordova 6.2.0

freddiefish commented 7 years ago

Same here, when building in XCode, I get:

../platforms/ios/Urges/Plugins/cordova-plugin-nativeaudio/NativeAudio.m:32:5: 'AudioSessionInitialize' is deprecated: first deprecated in iOS 7.0