diff --git a/example/ios/Podfile.lock b/example/ios/Podfile.lock index 8d145c7..eff00f7 100644 --- a/example/ios/Podfile.lock +++ b/example/ios/Podfile.lock @@ -21,8 +21,8 @@ EXTERNAL SOURCES: SPEC CHECKSUMS: Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854 flutter_volume_controller: e4d5832f08008180f76e30faf671ffd5a425e529 - integration_test: a1e7d09bd98eca2fc37aefd79d4f41ad37bdbbe5 + integration_test: 13825b8a9334a850581300559b8839134b124670 PODFILE CHECKSUM: ec7bdfce9f82e8314b94d9cd1cfee2974a0e1c97 -COCOAPODS: 1.11.3 +COCOAPODS: 1.12.1 diff --git a/example/ios/Runner.xcodeproj/project.pbxproj b/example/ios/Runner.xcodeproj/project.pbxproj index f540f73..b422e9a 100644 --- a/example/ios/Runner.xcodeproj/project.pbxproj +++ b/example/ios/Runner.xcodeproj/project.pbxproj @@ -204,6 +204,7 @@ files = ( ); inputPaths = ( + "${TARGET_BUILD_DIR}/${INFOPLIST_PATH}", ); name = "Thin Binary"; outputPaths = ( diff --git a/ios/Classes/VolumeController.swift b/ios/Classes/VolumeController.swift index 01f48b3..a45f557 100644 --- a/ios/Classes/VolumeController.swift +++ b/ios/Classes/VolumeController.swift @@ -24,36 +24,33 @@ class VolumeController { } func getVolume() throws -> Float { - try audioSession.setActive(true) + try audioSession.activate(with: VolumeController.defaultCategory) let volume = audioSession.outputVolume return volume } func setVolume(_ volume: Double, showSystemUI: Bool) throws { - try audioSession.setActive(true) setShowSystemUI(showSystemUI) volumeView.setVolume(volume) } func raiseVolume(_ step: Double?, showSystemUI: Bool) throws { - try audioSession.setActive(true) setShowSystemUI(showSystemUI) volumeView.raiseVolume(step ?? VolumeController.defaultStep) } func lowerVolume(_ step: Double?, showSystemUI: Bool) throws { - try audioSession.setActive(true) setShowSystemUI(showSystemUI) volumeView.lowerVolume(step ?? VolumeController.defaultStep) } func getMute() throws -> Bool { - try audioSession.setActive(true) + try audioSession.activate(with: VolumeController.defaultCategory) return audioSession.outputVolume == 0 } func setMute(_ isMuted: Bool, showSystemUI: Bool) throws { - try audioSession.setActive(true) + try audioSession.activate(with: VolumeController.defaultCategory) // Save current volume level before mute. if isMuted { @@ -79,7 +76,6 @@ class VolumeController { } func getAudioSessionCategory() throws -> AudioSessionCategory? { - try audioSession.setActive(true) return AudioSessionCategory.allCases.first { category in category.categoryType == audioSession.category } }