From fe71346e52ada0c6a9a1c8ba18ed30319adf45e1 Mon Sep 17 00:00:00 2001 From: Alexander Demchuk Date: Mon, 7 Oct 2024 14:17:48 +0200 Subject: [PATCH] chore: updated method names --- ios/AudioController.swift | 5 +++++ ios/ExpoPlayAudioStreamModule.swift | 4 ++-- ...poAudioStreamView.swift => ExpoPlayAudioStreamView.swift} | 2 +- package.json | 2 +- 4 files changed, 9 insertions(+), 4 deletions(-) rename ios/{ExpoAudioStreamView.swift => ExpoPlayAudioStreamView.swift} (81%) 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",