diff --git a/ios/AudioController.swift b/ios/AudioController.swift index c943315..bb0cbaf 100644 --- a/ios/AudioController.swift +++ b/ios/AudioController.swift @@ -321,6 +321,11 @@ public class AudioController { // } } + public func reset() throws { + let audioSession = AVAudioSession.sharedInstance() + try audioSession.setActive(false, options: .notifyOthersOnDeactivation) + } + private func scheduleNextBuffer() { guard let engine = self.audioEngine, engine.isRunning else { DispatchQueue.main.asyncAfter(deadline: .now() + 0.05) { // Check every 50 milliseconds diff --git a/ios/ExpoPlayAudioStreamModule.swift b/ios/ExpoPlayAudioStreamModule.swift index 85881a2..a50986e 100644 --- a/ios/ExpoPlayAudioStreamModule.swift +++ b/ios/ExpoPlayAudioStreamModule.swift @@ -36,8 +36,8 @@ public class ExpoPlayAudioStreamModule: Module { audioController.stop(promise: promise) } - AsyncFunction("resetAudioSession") { promise in - audioController.deactivateAudioSession() + AsyncFunction("resetAudioSession") { (promise: Promise) in + audioController.reset() promise.resolve(nil) } diff --git a/ios/ExpoAudioStreamView.swift b/ios/ExpoPlayAudioStreamView.swift similarity index 81% rename from ios/ExpoAudioStreamView.swift rename to ios/ExpoPlayAudioStreamView.swift index e05e3e7..a0e912b 100644 --- a/ios/ExpoAudioStreamView.swift +++ b/ios/ExpoPlayAudioStreamView.swift @@ -2,6 +2,6 @@ import ExpoModulesCore // This view will be used as a native component. Make sure to inherit from `ExpoView` // to apply the proper styling (e.g. border radius and shadows). -class ExpoAudioStreamView: ExpoView { +class ExpoPlayAudioStreamView: ExpoView { } diff --git a/package.json b/package.json index 3fa0618..6b858fd 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@mykin-ai/expo-audio-stream", - "version": "0.1.27", + "version": "0.1.28", "description": "Expo Play Audio Stream module", "main": "build/index.js", "types": "build/index.d.ts",