From 83ff7949a9e7bdb4f54c74ccac2be4806e130a7c Mon Sep 17 00:00:00 2001 From: Gabriel Terwesten Date: Sat, 17 Jun 2023 12:32:48 +0200 Subject: [PATCH 01/20] fix: start observing `AVPlayerItem.status` before setting it on `AVPlayer` --- .../audioplayers/example/ios/Podfile.lock | 12 +- .../ios/Runner.xcodeproj/project.pbxproj | 1 + .../audioplayers/example/macos/Podfile.lock | 8 +- .../audioplayers/lib/src/audioplayer.dart | 9 +- .../SwiftAudioplayersDarwinPlugin.swift | 7 +- .../darwin/Classes/WrappedMediaPlayer.swift | 270 ++++++++++-------- 6 files changed, 164 insertions(+), 143 deletions(-) diff --git a/packages/audioplayers/example/ios/Podfile.lock b/packages/audioplayers/example/ios/Podfile.lock index 168467f4e..3c5db9d18 100644 --- a/packages/audioplayers/example/ios/Podfile.lock +++ b/packages/audioplayers/example/ios/Podfile.lock @@ -51,7 +51,7 @@ DEPENDENCIES: - file_picker (from `.symlinks/plugins/file_picker/ios`) - Flutter (from `Flutter`) - integration_test (from `.symlinks/plugins/integration_test/ios`) - - path_provider_foundation (from `.symlinks/plugins/path_provider_foundation/ios`) + - path_provider_foundation (from `.symlinks/plugins/path_provider_foundation/darwin`) SPEC REPOS: trunk: @@ -70,19 +70,19 @@ EXTERNAL SOURCES: integration_test: :path: ".symlinks/plugins/integration_test/ios" path_provider_foundation: - :path: ".symlinks/plugins/path_provider_foundation/ios" + :path: ".symlinks/plugins/path_provider_foundation/darwin" SPEC CHECKSUMS: audioplayers_darwin: 877d9a4d06331c5c374595e46e16453ac7eafa40 DKImagePickerController: b512c28220a2b8ac7419f21c491fc8534b7601ac DKPhotoGallery: fdfad5125a9fdda9cc57df834d49df790dbb4179 - file_picker: 817ab1d8cd2da9d2da412a417162deee3500fc95 + file_picker: ce3938a0df3cc1ef404671531facef740d03f920 Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854 - integration_test: a1e7d09bd98eca2fc37aefd79d4f41ad37bdbbe5 - path_provider_foundation: 37748e03f12783f9de2cb2c4eadfaa25fe6d4852 + integration_test: 13825b8a9334a850581300559b8839134b124670 + path_provider_foundation: c68054786f1b4f3343858c1e1d0caaded73f0be9 SDWebImage: e5cc87bf736e60f49592f307bdf9e157189298a3 SwiftyGif: 6c3eafd0ce693cad58bb63d2b2fb9bacb8552780 PODFILE CHECKSUM: ef19549a9bc3046e7bb7d2fab4d021637c0c58a3 -COCOAPODS: 1.11.3 +COCOAPODS: 1.12.1 diff --git a/packages/audioplayers/example/ios/Runner.xcodeproj/project.pbxproj b/packages/audioplayers/example/ios/Runner.xcodeproj/project.pbxproj index 6877dc296..8c618c4f4 100644 --- a/packages/audioplayers/example/ios/Runner.xcodeproj/project.pbxproj +++ b/packages/audioplayers/example/ios/Runner.xcodeproj/project.pbxproj @@ -204,6 +204,7 @@ files = ( ); inputPaths = ( + "${TARGET_BUILD_DIR}/${INFOPLIST_PATH}", ); name = "Thin Binary"; outputPaths = ( diff --git a/packages/audioplayers/example/macos/Podfile.lock b/packages/audioplayers/example/macos/Podfile.lock index 47ca65031..0945af2c7 100644 --- a/packages/audioplayers/example/macos/Podfile.lock +++ b/packages/audioplayers/example/macos/Podfile.lock @@ -9,7 +9,7 @@ PODS: DEPENDENCIES: - audioplayers_darwin (from `Flutter/ephemeral/.symlinks/plugins/audioplayers_darwin/macos`) - FlutterMacOS (from `Flutter/ephemeral`) - - path_provider_foundation (from `Flutter/ephemeral/.symlinks/plugins/path_provider_foundation/macos`) + - path_provider_foundation (from `Flutter/ephemeral/.symlinks/plugins/path_provider_foundation/darwin`) EXTERNAL SOURCES: audioplayers_darwin: @@ -17,13 +17,13 @@ EXTERNAL SOURCES: FlutterMacOS: :path: Flutter/ephemeral path_provider_foundation: - :path: Flutter/ephemeral/.symlinks/plugins/path_provider_foundation/macos + :path: Flutter/ephemeral/.symlinks/plugins/path_provider_foundation/darwin SPEC CHECKSUMS: audioplayers_darwin: dcad41de4fbd0099cb3749f7ab3b0cb8f70b810c FlutterMacOS: 8f6f14fa908a6fb3fba0cd85dbd81ec4b251fb24 - path_provider_foundation: 37748e03f12783f9de2cb2c4eadfaa25fe6d4852 + path_provider_foundation: c68054786f1b4f3343858c1e1d0caaded73f0be9 PODFILE CHECKSUM: 353c8bcc5d5b0994e508d035b5431cfe18c1dea7 -COCOAPODS: 1.11.3 +COCOAPODS: 1.12.1 diff --git a/packages/audioplayers/lib/src/audioplayer.dart b/packages/audioplayers/lib/src/audioplayer.dart index bbdcbe823..c805c6166 100644 --- a/packages/audioplayers/lib/src/audioplayer.dart +++ b/packages/audioplayers/lib/src/audioplayer.dart @@ -298,9 +298,12 @@ class AudioPlayer { } }, ); - await fun(); - await preparedCompleter.future.timeout(const Duration(seconds: 30)); - onPreparedSubscription.cancel(); + try { + await fun(); + await preparedCompleter.future.timeout(const Duration(seconds: 30)); + } finally { + onPreparedSubscription.cancel(); + } } /// Sets the URL to a remote link. diff --git a/packages/audioplayers_darwin/darwin/Classes/SwiftAudioplayersDarwinPlugin.swift b/packages/audioplayers_darwin/darwin/Classes/SwiftAudioplayersDarwinPlugin.swift index 36764622c..bf80bd40c 100644 --- a/packages/audioplayers_darwin/darwin/Classes/SwiftAudioplayersDarwinPlugin.swift +++ b/packages/audioplayers_darwin/darwin/Classes/SwiftAudioplayersDarwinPlugin.swift @@ -186,6 +186,7 @@ public class SwiftAudioplayersDarwinPlugin: NSObject, FlutterPlugin { } player.setSourceUrl(url: url!, isLocal: isLocal, completer: { + print("setSourceUrl isPrepared") player.eventHandler.onPrepared(isPrepared: true) }, completerError: { player.eventHandler.onError(code: "DarwinAudioError", message: "AVPlayerItem.Status.failed on setSourceUrl", details: nil) @@ -333,19 +334,19 @@ class AudioPlayersStreamHandler: NSObject, FlutterStreamHandler { func onCurrentPosition(millis: Int) { if let eventSink = self.sink { - eventSink(["event": "audio.onCurrentPosition", "value": millis]) + eventSink(["event": "audio.onCurrentPosition", "value": millis] as [String : Any]) } } func onDuration(millis: Int) { if let eventSink = self.sink { - eventSink(["event": "audio.onDuration", "value": millis]) + eventSink(["event": "audio.onDuration", "value": millis] as [String : Any]) } } func onPrepared(isPrepared: Bool) { if let eventSink = self.sink { - eventSink(["event": "audio.onPrepared", "value": isPrepared]) + eventSink(["event": "audio.onPrepared", "value": isPrepared] as [String : Any]) } } diff --git a/packages/audioplayers_darwin/darwin/Classes/WrappedMediaPlayer.swift b/packages/audioplayers_darwin/darwin/Classes/WrappedMediaPlayer.swift index 13f2a0b2b..b12315717 100644 --- a/packages/audioplayers_darwin/darwin/Classes/WrappedMediaPlayer.swift +++ b/packages/audioplayers_darwin/darwin/Classes/WrappedMediaPlayer.swift @@ -8,21 +8,19 @@ typealias Completer = () -> Void typealias CompleterError = () -> Void class WrappedMediaPlayer { - var reference: SwiftAudioplayersDarwinPlugin - var eventHandler: AudioPlayersStreamHandler - - var player: AVPlayer? - - var observers: [TimeObserver] - var keyValueObservation: NSKeyValueObservation? - - var isPlaying: Bool - var playbackRate: Double - var volume: Double + private(set) var eventHandler: AudioPlayersStreamHandler + private(set) var isPlaying: Bool var looping: Bool - var url: String? - + private var reference: SwiftAudioplayersDarwinPlugin + private var player: AVPlayer? + private var playbackRate: Double + private var volume: Double + private var url: String? + + private var observers: [TimeObserver] + private var playerItemStatusObservation: NSKeyValueObservation? + init( reference: SwiftAudioplayersDarwinPlugin, eventHandler: AudioPlayersStreamHandler, @@ -36,42 +34,57 @@ class WrappedMediaPlayer { self.eventHandler = eventHandler self.player = player self.observers = [] - self.keyValueObservation = nil - + self.playerItemStatusObservation = nil + self.isPlaying = false self.playbackRate = playbackRate self.volume = volume self.looping = looping self.url = url } - - func getDurationCMTime() -> CMTime? { - return player?.currentItem?.asset.duration + + func setSourceUrl ( + url: String, + isLocal: Bool, + completer: Completer? = nil, + completerError: CompleterError? = nil + ) { + let playbackStatus = player?.currentItem?.status + + if self.url != url || playbackStatus == .failed || playbackStatus == nil { + reset() + self.url = url + let playerItem = createPlayerItem(url, isLocal) + setupPlayerItemStatusObservation(playerItem, completer, completerError) + let player = updatePlayer(playerItem) ?? createPlayer(playerItem) + setupPositionObserver(player) + setupSoundCompletedObserver(player, playerItem) + } else { + if playbackStatus == .readyToPlay { + completer?() + } + } } - + func getDuration() -> Int? { guard let duration = getDurationCMTime() else { return nil } return fromCMTime(time: duration) } - - private func getCurrentCMTime() -> CMTime? { - return player?.currentTime() - } - + func getCurrentPosition() -> Int? { guard let time = getCurrentCMTime() else { return nil } return fromCMTime(time: time) } - + func pause() { isPlaying = false player?.pause() } - + func resume() { isPlaying = true if let player = self.player { @@ -84,17 +97,17 @@ class WrappedMediaPlayer { updateDuration() } } - + func setVolume(volume: Double) { self.volume = volume player?.volume = Float(volume) } - + func setPlaybackRate(playbackRate: Double) { self.playbackRate = playbackRate player?.rate = Float(playbackRate) } - + func seek(time: CMTime, completer: Completer? = nil) { guard let currentItem = player?.currentItem else { completer?() @@ -111,24 +124,15 @@ class WrappedMediaPlayer { } } } - + func stop(completer: Completer? = nil) { pause() seek(time: toCMTime(millis: 0), completer: completer) } - - func releaseSync() { - keyValueObservation?.invalidate() - for observer in observers { - NotificationCenter.default.removeObserver(observer.observer) - } - observers = [] - player?.replaceCurrentItem(with: nil) - } func release(completer: Completer? = nil) { stop { - self.releaseSync() + self.reset() completer?() } } @@ -138,30 +142,95 @@ class WrappedMediaPlayer { completer?() } } - - func onSoundComplete() { - if !isPlaying { - return + + private func getDurationCMTime() -> CMTime? { + return player?.currentItem?.asset.duration + } + + private func getCurrentCMTime() -> CMTime? { + return player?.currentTime() + } + + private func createPlayerItem(_ url: String, _ isLocal: Bool) -> AVPlayerItem { + let parsedUrl = isLocal ? URL.init(fileURLWithPath: url.deletingPrefix("file://")) : URL.init(string: url)! + let playerItem = AVPlayerItem.init(url: parsedUrl) + playerItem.audioTimePitchAlgorithm = AVAudioTimePitchAlgorithm.timeDomain + return playerItem + } + + private func createPlayer( _ playerItem: AVPlayerItem) -> AVPlayer { + let player = AVPlayer.init(playerItem: playerItem) + configParameters(player: player) + self.player = player + return player + } + + private func updatePlayer( _ playerItem: AVPlayerItem) -> AVPlayer? { + if let player = self.player { + player.replaceCurrentItem(with: playerItem) } - seek(time: toCMTime(millis: 0)) { - if self.looping { - self.resume() - } else { - self.isPlaying = false + return self.player + } + + private func setupPlayerItemStatusObservation(_ playerItem: AVPlayerItem, _ completer: Completer?, _ completerError: CompleterError?) { + playerItemStatusObservation = playerItem.observe(\AVPlayerItem.status) { (playerItem, change) in + let status = playerItem.status + self.eventHandler.onLog(message: "player status: \(status), change: \(change)") + + switch playerItem.status { + case .readyToPlay: + self.updateDuration() + completer?() + case .failed: + self.eventHandler.onLog(message: "error: \(String(describing: playerItem.error))") + self.reset() + completerError?() + default: + break } } - - reference.controlAudioSession() - eventHandler.onComplete() } - - func onTimeInterval(time: CMTime) { - let millis = fromCMTime(time: time) - eventHandler.onCurrentPosition(millis: millis) + + private func setupPositionObserver(_ player: AVPlayer) { + let interval = toCMTime(millis: 200) + let observer = player.addPeriodicTimeObserver(forInterval: interval, queue: nil) { + [weak self] time in + self?.onTimeInterval(time: time) + } + self.observers.append(TimeObserver(player: player, observer: observer)) + } + + private func setupSoundCompletedObserver(_ player: AVPlayer, _ playerItem: AVPlayerItem) { + let observer = NotificationCenter.default.addObserver( + forName: NSNotification.Name.AVPlayerItemDidPlayToEndTime, + object: playerItem, + queue: nil + ) { + [weak self] (notification) in + self?.onSoundComplete() + } + self.observers.append(TimeObserver(player: player, observer: observer)) } - - func updateDuration() { + + private func configParameters(player: AVPlayer) { + if (isPlaying) { + player.volume = Float(volume) + player.rate = Float(playbackRate) + } + } + + private func reset() { + playerItemStatusObservation?.invalidate() + playerItemStatusObservation = nil + for observer in observers { + NotificationCenter.default.removeObserver(observer.observer) + } + observers = [] + player?.replaceCurrentItem(with: nil) + } + + private func updateDuration() { guard let duration = player?.currentItem?.asset.duration else { return } @@ -170,79 +239,26 @@ class WrappedMediaPlayer { eventHandler.onDuration(millis: millis) } } - - func setSourceUrl ( - url: String, - isLocal: Bool, - completer: Completer? = nil, - completerError: CompleterError? = nil - ) { - let playbackStatus = player?.currentItem?.status - - if self.url != url || playbackStatus == .failed || playbackStatus == nil { - let parsedUrl = isLocal ? URL.init(fileURLWithPath: url.deletingPrefix("file://")) : URL.init(string: url)! - let playerItem = AVPlayerItem.init(url: parsedUrl) - playerItem.audioTimePitchAlgorithm = AVAudioTimePitchAlgorithm.timeDomain - let player: AVPlayer - if let existingPlayer = self.player { - releaseSync() - self.url = url - existingPlayer.replaceCurrentItem(with: playerItem) - player = existingPlayer + + private func onSoundComplete() { + if !isPlaying { + return + } + + seek(time: toCMTime(millis: 0)) { + if self.looping { + self.resume() } else { - player = AVPlayer.init(playerItem: playerItem) - configParameters(player: player) - - self.player = player - self.observers = [] - self.url = url - - // stream player position - let interval = toCMTime(millis: 200) - let timeObserver = player.addPeriodicTimeObserver(forInterval: interval, queue: nil) { - [weak self] time in - self?.onTimeInterval(time: time) - } - self.observers.append(TimeObserver(player: player, observer: timeObserver)) - } - - let anObserver = NotificationCenter.default.addObserver( - forName: NSNotification.Name.AVPlayerItemDidPlayToEndTime, - object: playerItem, - queue: nil - ) { - [weak self] (notification) in - self?.onSoundComplete() - } - self.observers.append(TimeObserver(player: player, observer: anObserver)) - - // is sound ready - let newKeyValueObservation = playerItem.observe(\AVPlayerItem.status) { (playerItem, change) in - let status = playerItem.status - self.eventHandler.onLog(message: "player status: \(status) change: \(change)") - - if status == .readyToPlay { - self.updateDuration() - completer?() - } else if status == .failed { - self.releaseSync() - completerError?() - } - } - - keyValueObservation?.invalidate() - keyValueObservation = newKeyValueObservation - } else { - if playbackStatus == .readyToPlay { - completer?() + self.isPlaying = false } } + + reference.controlAudioSession() + eventHandler.onComplete() } - func configParameters(player: AVPlayer) { - if (isPlaying) { - player.volume = Float(volume) - player.rate = Float(playbackRate) - } + private func onTimeInterval(time: CMTime) { + let millis = fromCMTime(time: time) + eventHandler.onCurrentPosition(millis: millis) } } From 257a6a758b908e76aea653a6b6c768f3ea9b91c3 Mon Sep 17 00:00:00 2001 From: Gabriel Terwesten Date: Sat, 17 Jun 2023 12:42:07 +0200 Subject: [PATCH 02/20] Remove debug print --- .../darwin/Classes/SwiftAudioplayersDarwinPlugin.swift | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/audioplayers_darwin/darwin/Classes/SwiftAudioplayersDarwinPlugin.swift b/packages/audioplayers_darwin/darwin/Classes/SwiftAudioplayersDarwinPlugin.swift index bf80bd40c..f19d2fe51 100644 --- a/packages/audioplayers_darwin/darwin/Classes/SwiftAudioplayersDarwinPlugin.swift +++ b/packages/audioplayers_darwin/darwin/Classes/SwiftAudioplayersDarwinPlugin.swift @@ -186,7 +186,6 @@ public class SwiftAudioplayersDarwinPlugin: NSObject, FlutterPlugin { } player.setSourceUrl(url: url!, isLocal: isLocal, completer: { - print("setSourceUrl isPrepared") player.eventHandler.onPrepared(isPrepared: true) }, completerError: { player.eventHandler.onError(code: "DarwinAudioError", message: "AVPlayerItem.Status.failed on setSourceUrl", details: nil) From aa9449cb84b4547f9c506f06b366c695621777b6 Mon Sep 17 00:00:00 2001 From: Gabriel Terwesten Date: Tue, 20 Jun 2023 00:24:59 +0200 Subject: [PATCH 03/20] Fix spelling --- .../darwin/Classes/WrappedMediaPlayer.swift | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/audioplayers_darwin/darwin/Classes/WrappedMediaPlayer.swift b/packages/audioplayers_darwin/darwin/Classes/WrappedMediaPlayer.swift index b12315717..81e7688a3 100644 --- a/packages/audioplayers_darwin/darwin/Classes/WrappedMediaPlayer.swift +++ b/packages/audioplayers_darwin/darwin/Classes/WrappedMediaPlayer.swift @@ -55,10 +55,10 @@ class WrappedMediaPlayer { reset() self.url = url let playerItem = createPlayerItem(url, isLocal) - setupPlayerItemStatusObservation(playerItem, completer, completerError) + setUpPlayerItemStatusObservation(playerItem, completer, completerError) let player = updatePlayer(playerItem) ?? createPlayer(playerItem) - setupPositionObserver(player) - setupSoundCompletedObserver(player, playerItem) + setUpPositionObserver(player) + setUpSoundCompletedObserver(player, playerItem) } else { if playbackStatus == .readyToPlay { completer?() @@ -173,7 +173,7 @@ class WrappedMediaPlayer { return self.player } - private func setupPlayerItemStatusObservation(_ playerItem: AVPlayerItem, _ completer: Completer?, _ completerError: CompleterError?) { + private func setUpPlayerItemStatusObservation(_ playerItem: AVPlayerItem, _ completer: Completer?, _ completerError: CompleterError?) { playerItemStatusObservation = playerItem.observe(\AVPlayerItem.status) { (playerItem, change) in let status = playerItem.status self.eventHandler.onLog(message: "player status: \(status), change: \(change)") @@ -192,7 +192,7 @@ class WrappedMediaPlayer { } } - private func setupPositionObserver(_ player: AVPlayer) { + private func setUpPositionObserver(_ player: AVPlayer) { let interval = toCMTime(millis: 200) let observer = player.addPeriodicTimeObserver(forInterval: interval, queue: nil) { [weak self] time in @@ -201,7 +201,7 @@ class WrappedMediaPlayer { self.observers.append(TimeObserver(player: player, observer: observer)) } - private func setupSoundCompletedObserver(_ player: AVPlayer, _ playerItem: AVPlayerItem) { + private func setUpSoundCompletedObserver(_ player: AVPlayer, _ playerItem: AVPlayerItem) { let observer = NotificationCenter.default.addObserver( forName: NSNotification.Name.AVPlayerItemDidPlayToEndTime, object: playerItem, From 711fe1f6ce63bbc0516640eeafac764de748b9c9 Mon Sep 17 00:00:00 2001 From: Gustl22 Date: Fri, 28 Jul 2023 12:23:26 +0200 Subject: [PATCH 04/20] chore: update darwin dependencies --- packages/audioplayers/example/ios/Podfile.lock | 12 ++++++------ .../example/ios/Runner.xcodeproj/project.pbxproj | 1 + packages/audioplayers/example/macos/Podfile.lock | 8 ++++---- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/packages/audioplayers/example/ios/Podfile.lock b/packages/audioplayers/example/ios/Podfile.lock index 168467f4e..3c5db9d18 100644 --- a/packages/audioplayers/example/ios/Podfile.lock +++ b/packages/audioplayers/example/ios/Podfile.lock @@ -51,7 +51,7 @@ DEPENDENCIES: - file_picker (from `.symlinks/plugins/file_picker/ios`) - Flutter (from `Flutter`) - integration_test (from `.symlinks/plugins/integration_test/ios`) - - path_provider_foundation (from `.symlinks/plugins/path_provider_foundation/ios`) + - path_provider_foundation (from `.symlinks/plugins/path_provider_foundation/darwin`) SPEC REPOS: trunk: @@ -70,19 +70,19 @@ EXTERNAL SOURCES: integration_test: :path: ".symlinks/plugins/integration_test/ios" path_provider_foundation: - :path: ".symlinks/plugins/path_provider_foundation/ios" + :path: ".symlinks/plugins/path_provider_foundation/darwin" SPEC CHECKSUMS: audioplayers_darwin: 877d9a4d06331c5c374595e46e16453ac7eafa40 DKImagePickerController: b512c28220a2b8ac7419f21c491fc8534b7601ac DKPhotoGallery: fdfad5125a9fdda9cc57df834d49df790dbb4179 - file_picker: 817ab1d8cd2da9d2da412a417162deee3500fc95 + file_picker: ce3938a0df3cc1ef404671531facef740d03f920 Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854 - integration_test: a1e7d09bd98eca2fc37aefd79d4f41ad37bdbbe5 - path_provider_foundation: 37748e03f12783f9de2cb2c4eadfaa25fe6d4852 + integration_test: 13825b8a9334a850581300559b8839134b124670 + path_provider_foundation: c68054786f1b4f3343858c1e1d0caaded73f0be9 SDWebImage: e5cc87bf736e60f49592f307bdf9e157189298a3 SwiftyGif: 6c3eafd0ce693cad58bb63d2b2fb9bacb8552780 PODFILE CHECKSUM: ef19549a9bc3046e7bb7d2fab4d021637c0c58a3 -COCOAPODS: 1.11.3 +COCOAPODS: 1.12.1 diff --git a/packages/audioplayers/example/ios/Runner.xcodeproj/project.pbxproj b/packages/audioplayers/example/ios/Runner.xcodeproj/project.pbxproj index 6877dc296..8c618c4f4 100644 --- a/packages/audioplayers/example/ios/Runner.xcodeproj/project.pbxproj +++ b/packages/audioplayers/example/ios/Runner.xcodeproj/project.pbxproj @@ -204,6 +204,7 @@ files = ( ); inputPaths = ( + "${TARGET_BUILD_DIR}/${INFOPLIST_PATH}", ); name = "Thin Binary"; outputPaths = ( diff --git a/packages/audioplayers/example/macos/Podfile.lock b/packages/audioplayers/example/macos/Podfile.lock index 47ca65031..0945af2c7 100644 --- a/packages/audioplayers/example/macos/Podfile.lock +++ b/packages/audioplayers/example/macos/Podfile.lock @@ -9,7 +9,7 @@ PODS: DEPENDENCIES: - audioplayers_darwin (from `Flutter/ephemeral/.symlinks/plugins/audioplayers_darwin/macos`) - FlutterMacOS (from `Flutter/ephemeral`) - - path_provider_foundation (from `Flutter/ephemeral/.symlinks/plugins/path_provider_foundation/macos`) + - path_provider_foundation (from `Flutter/ephemeral/.symlinks/plugins/path_provider_foundation/darwin`) EXTERNAL SOURCES: audioplayers_darwin: @@ -17,13 +17,13 @@ EXTERNAL SOURCES: FlutterMacOS: :path: Flutter/ephemeral path_provider_foundation: - :path: Flutter/ephemeral/.symlinks/plugins/path_provider_foundation/macos + :path: Flutter/ephemeral/.symlinks/plugins/path_provider_foundation/darwin SPEC CHECKSUMS: audioplayers_darwin: dcad41de4fbd0099cb3749f7ab3b0cb8f70b810c FlutterMacOS: 8f6f14fa908a6fb3fba0cd85dbd81ec4b251fb24 - path_provider_foundation: 37748e03f12783f9de2cb2c4eadfaa25fe6d4852 + path_provider_foundation: c68054786f1b4f3343858c1e1d0caaded73f0be9 PODFILE CHECKSUM: 353c8bcc5d5b0994e508d035b5431cfe18c1dea7 -COCOAPODS: 1.11.3 +COCOAPODS: 1.12.1 From 58b1868391a86219cdcfda3852068028d71bf294 Mon Sep 17 00:00:00 2001 From: Gustl22 Date: Fri, 28 Jul 2023 12:24:57 +0200 Subject: [PATCH 05/20] refactor(darwin): cast maps --- .../darwin/Classes/SwiftAudioplayersDarwinPlugin.swift | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/audioplayers_darwin/darwin/Classes/SwiftAudioplayersDarwinPlugin.swift b/packages/audioplayers_darwin/darwin/Classes/SwiftAudioplayersDarwinPlugin.swift index 36764622c..f19d2fe51 100644 --- a/packages/audioplayers_darwin/darwin/Classes/SwiftAudioplayersDarwinPlugin.swift +++ b/packages/audioplayers_darwin/darwin/Classes/SwiftAudioplayersDarwinPlugin.swift @@ -333,19 +333,19 @@ class AudioPlayersStreamHandler: NSObject, FlutterStreamHandler { func onCurrentPosition(millis: Int) { if let eventSink = self.sink { - eventSink(["event": "audio.onCurrentPosition", "value": millis]) + eventSink(["event": "audio.onCurrentPosition", "value": millis] as [String : Any]) } } func onDuration(millis: Int) { if let eventSink = self.sink { - eventSink(["event": "audio.onDuration", "value": millis]) + eventSink(["event": "audio.onDuration", "value": millis] as [String : Any]) } } func onPrepared(isPrepared: Bool) { if let eventSink = self.sink { - eventSink(["event": "audio.onPrepared", "value": isPrepared]) + eventSink(["event": "audio.onPrepared", "value": isPrepared] as [String : Any]) } } From 47388e88574b68774dcba60c93c46aeff8115bf7 Mon Sep 17 00:00:00 2001 From: Gustl22 Date: Fri, 28 Jul 2023 15:34:34 +0200 Subject: [PATCH 06/20] refactor: format --- .../darwin/Classes/WrappedMediaPlayer.swift | 86 +++++++++---------- .../macos/Classes/AudioContext.swift | 3 +- 2 files changed, 45 insertions(+), 44 deletions(-) diff --git a/packages/audioplayers_darwin/darwin/Classes/WrappedMediaPlayer.swift b/packages/audioplayers_darwin/darwin/Classes/WrappedMediaPlayer.swift index 13f2a0b2b..4b8a23107 100644 --- a/packages/audioplayers_darwin/darwin/Classes/WrappedMediaPlayer.swift +++ b/packages/audioplayers_darwin/darwin/Classes/WrappedMediaPlayer.swift @@ -10,68 +10,68 @@ typealias CompleterError = () -> Void class WrappedMediaPlayer { var reference: SwiftAudioplayersDarwinPlugin var eventHandler: AudioPlayersStreamHandler - + var player: AVPlayer? - + var observers: [TimeObserver] var keyValueObservation: NSKeyValueObservation? - + var isPlaying: Bool var playbackRate: Double var volume: Double var looping: Bool var url: String? - + init( - reference: SwiftAudioplayersDarwinPlugin, - eventHandler: AudioPlayersStreamHandler, - player: AVPlayer? = nil, - playbackRate: Double = defaultPlaybackRate, - volume: Double = defaultVolume, - looping: Bool = defaultLooping, - url: String? = nil + reference: SwiftAudioplayersDarwinPlugin, + eventHandler: AudioPlayersStreamHandler, + player: AVPlayer? = nil, + playbackRate: Double = defaultPlaybackRate, + volume: Double = defaultVolume, + looping: Bool = defaultLooping, + url: String? = nil ) { self.reference = reference self.eventHandler = eventHandler self.player = player self.observers = [] self.keyValueObservation = nil - + self.isPlaying = false self.playbackRate = playbackRate self.volume = volume self.looping = looping self.url = url } - + func getDurationCMTime() -> CMTime? { return player?.currentItem?.asset.duration } - + func getDuration() -> Int? { guard let duration = getDurationCMTime() else { return nil } return fromCMTime(time: duration) } - + private func getCurrentCMTime() -> CMTime? { return player?.currentTime() } - + func getCurrentPosition() -> Int? { guard let time = getCurrentCMTime() else { return nil } return fromCMTime(time: time) } - + func pause() { isPlaying = false player?.pause() } - + func resume() { isPlaying = true if let player = self.player { @@ -84,17 +84,17 @@ class WrappedMediaPlayer { updateDuration() } } - + func setVolume(volume: Double) { self.volume = volume player?.volume = Float(volume) } - + func setPlaybackRate(playbackRate: Double) { self.playbackRate = playbackRate player?.rate = Float(playbackRate) } - + func seek(time: CMTime, completer: Completer? = nil) { guard let currentItem = player?.currentItem else { completer?() @@ -111,12 +111,12 @@ class WrappedMediaPlayer { } } } - + func stop(completer: Completer? = nil) { pause() seek(time: toCMTime(millis: 0), completer: completer) } - + func releaseSync() { keyValueObservation?.invalidate() for observer in observers { @@ -138,7 +138,7 @@ class WrappedMediaPlayer { completer?() } } - + func onSoundComplete() { if !isPlaying { return @@ -151,16 +151,16 @@ class WrappedMediaPlayer { self.isPlaying = false } } - + reference.controlAudioSession() eventHandler.onComplete() } - + func onTimeInterval(time: CMTime) { let millis = fromCMTime(time: time) eventHandler.onCurrentPosition(millis: millis) } - + func updateDuration() { guard let duration = player?.currentItem?.asset.duration else { return @@ -170,15 +170,15 @@ class WrappedMediaPlayer { eventHandler.onDuration(millis: millis) } } - - func setSourceUrl ( - url: String, - isLocal: Bool, - completer: Completer? = nil, - completerError: CompleterError? = nil + + func setSourceUrl( + url: String, + isLocal: Bool, + completer: Completer? = nil, + completerError: CompleterError? = nil ) { let playbackStatus = player?.currentItem?.status - + if self.url != url || playbackStatus == .failed || playbackStatus == nil { let parsedUrl = isLocal ? URL.init(fileURLWithPath: url.deletingPrefix("file://")) : URL.init(string: url)! let playerItem = AVPlayerItem.init(url: parsedUrl) @@ -192,11 +192,11 @@ class WrappedMediaPlayer { } else { player = AVPlayer.init(playerItem: playerItem) configParameters(player: player) - + self.player = player self.observers = [] self.url = url - + // stream player position let interval = toCMTime(millis: 200) let timeObserver = player.addPeriodicTimeObserver(forInterval: interval, queue: nil) { @@ -205,22 +205,22 @@ class WrappedMediaPlayer { } self.observers.append(TimeObserver(player: player, observer: timeObserver)) } - + let anObserver = NotificationCenter.default.addObserver( - forName: NSNotification.Name.AVPlayerItemDidPlayToEndTime, - object: playerItem, - queue: nil + forName: NSNotification.Name.AVPlayerItemDidPlayToEndTime, + object: playerItem, + queue: nil ) { [weak self] (notification) in self?.onSoundComplete() } self.observers.append(TimeObserver(player: player, observer: anObserver)) - + // is sound ready let newKeyValueObservation = playerItem.observe(\AVPlayerItem.status) { (playerItem, change) in let status = playerItem.status self.eventHandler.onLog(message: "player status: \(status) change: \(change)") - + if status == .readyToPlay { self.updateDuration() completer?() @@ -229,7 +229,7 @@ class WrappedMediaPlayer { completerError?() } } - + keyValueObservation?.invalidate() keyValueObservation = newKeyValueObservation } else { diff --git a/packages/audioplayers_darwin/macos/Classes/AudioContext.swift b/packages/audioplayers_darwin/macos/Classes/AudioContext.swift index 93a1092d0..1e4489037 100644 --- a/packages/audioplayers_darwin/macos/Classes/AudioContext.swift +++ b/packages/audioplayers_darwin/macos/Classes/AudioContext.swift @@ -2,7 +2,8 @@ import MediaPlayer // no-op impl of AudioContext for macos struct AudioContext { - func activateAudioSession(active: Bool) throws {} + func activateAudioSession(active: Bool) throws { + } func apply() throws { throw AudioPlayerError.warning("AudioContext configuration is not available on macOS") From b4eb212ce3e3a37478cd41867124114b9830aa62 Mon Sep 17 00:00:00 2001 From: Gustl22 Date: Fri, 28 Jul 2023 16:07:36 +0200 Subject: [PATCH 07/20] refactor: rearrange methods --- .../SwiftAudioplayersDarwinPlugin.swift | 8 +- .../darwin/Classes/WrappedMediaPlayer.swift | 222 +++++++++--------- 2 files changed, 114 insertions(+), 116 deletions(-) diff --git a/packages/audioplayers_darwin/darwin/Classes/SwiftAudioplayersDarwinPlugin.swift b/packages/audioplayers_darwin/darwin/Classes/SwiftAudioplayersDarwinPlugin.swift index f19d2fe51..42e930dc7 100644 --- a/packages/audioplayers_darwin/darwin/Classes/SwiftAudioplayersDarwinPlugin.swift +++ b/packages/audioplayers_darwin/darwin/Classes/SwiftAudioplayersDarwinPlugin.swift @@ -99,7 +99,7 @@ public class SwiftAudioplayersDarwinPlugin: NSObject, FlutterPlugin { try globalContext.apply() } catch AudioPlayerError.warning(let warnMsg) { globalEvents.onLog(message: warnMsg) - } catch { + } catch { result(FlutterError(code: "DarwinAudioError", message: "Error configuring global audio session: \(error)", details: nil)) } } else if method == "emitLog" { @@ -333,19 +333,19 @@ class AudioPlayersStreamHandler: NSObject, FlutterStreamHandler { func onCurrentPosition(millis: Int) { if let eventSink = self.sink { - eventSink(["event": "audio.onCurrentPosition", "value": millis] as [String : Any]) + eventSink(["event": "audio.onCurrentPosition", "value": millis] as [String: Any]) } } func onDuration(millis: Int) { if let eventSink = self.sink { - eventSink(["event": "audio.onDuration", "value": millis] as [String : Any]) + eventSink(["event": "audio.onDuration", "value": millis] as [String: Any]) } } func onPrepared(isPrepared: Bool) { if let eventSink = self.sink { - eventSink(["event": "audio.onPrepared", "value": isPrepared] as [String : Any]) + eventSink(["event": "audio.onPrepared", "value": isPrepared] as [String: Any]) } } diff --git a/packages/audioplayers_darwin/darwin/Classes/WrappedMediaPlayer.swift b/packages/audioplayers_darwin/darwin/Classes/WrappedMediaPlayer.swift index 4b8a23107..0eafd3e81 100644 --- a/packages/audioplayers_darwin/darwin/Classes/WrappedMediaPlayer.swift +++ b/packages/audioplayers_darwin/darwin/Classes/WrappedMediaPlayer.swift @@ -8,20 +8,18 @@ typealias Completer = () -> Void typealias CompleterError = () -> Void class WrappedMediaPlayer { - var reference: SwiftAudioplayersDarwinPlugin - var eventHandler: AudioPlayersStreamHandler - - var player: AVPlayer? - - var observers: [TimeObserver] - var keyValueObservation: NSKeyValueObservation? - - var isPlaying: Bool - var playbackRate: Double - var volume: Double + private(set) var eventHandler: AudioPlayersStreamHandler + private(set) var isPlaying: Bool var looping: Bool - var url: String? + private var reference: SwiftAudioplayersDarwinPlugin + private var player: AVPlayer? + private var playbackRate: Double + private var volume: Double + private var url: String? + + private var observers: [TimeObserver] + private var playerItemStatusObservation: NSKeyValueObservation? init( reference: SwiftAudioplayersDarwinPlugin, @@ -36,7 +34,7 @@ class WrappedMediaPlayer { self.eventHandler = eventHandler self.player = player self.observers = [] - self.keyValueObservation = nil + self.playerItemStatusObservation = nil self.isPlaying = false self.playbackRate = playbackRate @@ -45,8 +43,72 @@ class WrappedMediaPlayer { self.url = url } - func getDurationCMTime() -> CMTime? { - return player?.currentItem?.asset.duration + func setSourceUrl( + url: String, + isLocal: Bool, + completer: Completer? = nil, + completerError: CompleterError? = nil + ) { + let playbackStatus = player?.currentItem?.status + + if self.url != url || playbackStatus == .failed || playbackStatus == nil { + let parsedUrl = isLocal ? URL.init(fileURLWithPath: url.deletingPrefix("file://")) : URL.init(string: url)! + let playerItem = AVPlayerItem.init(url: parsedUrl) + playerItem.audioTimePitchAlgorithm = AVAudioTimePitchAlgorithm.timeDomain + let player: AVPlayer + if let existingPlayer = self.player { + releaseSync() + self.url = url + existingPlayer.replaceCurrentItem(with: playerItem) + player = existingPlayer + } else { + player = AVPlayer.init(playerItem: playerItem) + configParameters(player: player) + + self.player = player + self.observers = [] + self.url = url + + // stream player position + let interval = toCMTime(millis: 200) + let timeObserver = player.addPeriodicTimeObserver(forInterval: interval, queue: nil) { + [weak self] time in + self?.onTimeInterval(time: time) + } + self.observers.append(TimeObserver(player: player, observer: timeObserver)) + } + + let anObserver = NotificationCenter.default.addObserver( + forName: NSNotification.Name.AVPlayerItemDidPlayToEndTime, + object: playerItem, + queue: nil + ) { + [weak self] (notification) in + self?.onSoundComplete() + } + self.observers.append(TimeObserver(player: player, observer: anObserver)) + + // is sound ready + let newplayerItemStatusObservation = playerItem.observe(\AVPlayerItem.status) { (playerItem, change) in + let status = playerItem.status + self.eventHandler.onLog(message: "player status: \(status) change: \(change)") + + if status == .readyToPlay { + self.updateDuration() + completer?() + } else if status == .failed { + self.releaseSync() + completerError?() + } + } + + playerItemStatusObservation?.invalidate() + playerItemStatusObservation = newplayerItemStatusObservation + } else { + if playbackStatus == .readyToPlay { + completer?() + } + } } func getDuration() -> Int? { @@ -56,10 +118,6 @@ class WrappedMediaPlayer { return fromCMTime(time: duration) } - private func getCurrentCMTime() -> CMTime? { - return player?.currentTime() - } - func getCurrentPosition() -> Int? { guard let time = getCurrentCMTime() else { return nil @@ -117,15 +175,6 @@ class WrappedMediaPlayer { seek(time: toCMTime(millis: 0), completer: completer) } - func releaseSync() { - keyValueObservation?.invalidate() - for observer in observers { - NotificationCenter.default.removeObserver(observer.observer) - } - observers = [] - player?.replaceCurrentItem(with: nil) - } - func release(completer: Completer? = nil) { stop { self.releaseSync() @@ -139,29 +188,31 @@ class WrappedMediaPlayer { } } - func onSoundComplete() { - if !isPlaying { - return - } + private func getDurationCMTime() -> CMTime? { + return player?.currentItem?.asset.duration + } - seek(time: toCMTime(millis: 0)) { - if self.looping { - self.resume() - } else { - self.isPlaying = false - } - } + private func getCurrentCMTime() -> CMTime? { + return player?.currentTime() + } - reference.controlAudioSession() - eventHandler.onComplete() + func configParameters(player: AVPlayer) { + if (isPlaying) { + player.volume = Float(volume) + player.rate = Float(playbackRate) + } } - func onTimeInterval(time: CMTime) { - let millis = fromCMTime(time: time) - eventHandler.onCurrentPosition(millis: millis) + func releaseSync() { + playerItemStatusObservation?.invalidate() + for observer in observers { + NotificationCenter.default.removeObserver(observer.observer) + } + observers = [] + player?.replaceCurrentItem(with: nil) } - func updateDuration() { + private func updateDuration() { guard let duration = player?.currentItem?.asset.duration else { return } @@ -171,78 +222,25 @@ class WrappedMediaPlayer { } } - func setSourceUrl( - url: String, - isLocal: Bool, - completer: Completer? = nil, - completerError: CompleterError? = nil - ) { - let playbackStatus = player?.currentItem?.status + private func onSoundComplete() { + if !isPlaying { + return + } - if self.url != url || playbackStatus == .failed || playbackStatus == nil { - let parsedUrl = isLocal ? URL.init(fileURLWithPath: url.deletingPrefix("file://")) : URL.init(string: url)! - let playerItem = AVPlayerItem.init(url: parsedUrl) - playerItem.audioTimePitchAlgorithm = AVAudioTimePitchAlgorithm.timeDomain - let player: AVPlayer - if let existingPlayer = self.player { - releaseSync() - self.url = url - existingPlayer.replaceCurrentItem(with: playerItem) - player = existingPlayer + seek(time: toCMTime(millis: 0)) { + if self.looping { + self.resume() } else { - player = AVPlayer.init(playerItem: playerItem) - configParameters(player: player) - - self.player = player - self.observers = [] - self.url = url - - // stream player position - let interval = toCMTime(millis: 200) - let timeObserver = player.addPeriodicTimeObserver(forInterval: interval, queue: nil) { - [weak self] time in - self?.onTimeInterval(time: time) - } - self.observers.append(TimeObserver(player: player, observer: timeObserver)) - } - - let anObserver = NotificationCenter.default.addObserver( - forName: NSNotification.Name.AVPlayerItemDidPlayToEndTime, - object: playerItem, - queue: nil - ) { - [weak self] (notification) in - self?.onSoundComplete() - } - self.observers.append(TimeObserver(player: player, observer: anObserver)) - - // is sound ready - let newKeyValueObservation = playerItem.observe(\AVPlayerItem.status) { (playerItem, change) in - let status = playerItem.status - self.eventHandler.onLog(message: "player status: \(status) change: \(change)") - - if status == .readyToPlay { - self.updateDuration() - completer?() - } else if status == .failed { - self.releaseSync() - completerError?() - } - } - - keyValueObservation?.invalidate() - keyValueObservation = newKeyValueObservation - } else { - if playbackStatus == .readyToPlay { - completer?() + self.isPlaying = false } } + + reference.controlAudioSession() + eventHandler.onComplete() } - func configParameters(player: AVPlayer) { - if (isPlaying) { - player.volume = Float(volume) - player.rate = Float(playbackRate) - } + private func onTimeInterval(time: CMTime) { + let millis = fromCMTime(time: time) + eventHandler.onCurrentPosition(millis: millis) } } From f2ba2513dc02104383c06a72fc778c19525a56d5 Mon Sep 17 00:00:00 2001 From: Gustl22 Date: Fri, 28 Jul 2023 16:10:08 +0200 Subject: [PATCH 08/20] refactor: releaseSync to release --- .../darwin/Classes/WrappedMediaPlayer.swift | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/packages/audioplayers_darwin/darwin/Classes/WrappedMediaPlayer.swift b/packages/audioplayers_darwin/darwin/Classes/WrappedMediaPlayer.swift index 0eafd3e81..b0d0f1497 100644 --- a/packages/audioplayers_darwin/darwin/Classes/WrappedMediaPlayer.swift +++ b/packages/audioplayers_darwin/darwin/Classes/WrappedMediaPlayer.swift @@ -57,7 +57,7 @@ class WrappedMediaPlayer { playerItem.audioTimePitchAlgorithm = AVAudioTimePitchAlgorithm.timeDomain let player: AVPlayer if let existingPlayer = self.player { - releaseSync() + reset() self.url = url existingPlayer.replaceCurrentItem(with: playerItem) player = existingPlayer @@ -97,7 +97,7 @@ class WrappedMediaPlayer { self.updateDuration() completer?() } else if status == .failed { - self.releaseSync() + self.reset() completerError?() } } @@ -177,7 +177,7 @@ class WrappedMediaPlayer { func release(completer: Completer? = nil) { stop { - self.releaseSync() + self.reset() completer?() } } @@ -203,8 +203,9 @@ class WrappedMediaPlayer { } } - func releaseSync() { + private func reset() { playerItemStatusObservation?.invalidate() + playerItemStatusObservation = nil for observer in observers { NotificationCenter.default.removeObserver(observer.observer) } From b11351a6499942cf6ed08bc49f1aaab54a8a54bb Mon Sep 17 00:00:00 2001 From: Gustl22 Date: Fri, 28 Jul 2023 22:51:50 +0200 Subject: [PATCH 09/20] reafactor(darwin): create player item as own method --- .../darwin/Classes/WrappedMediaPlayer.swift | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/packages/audioplayers_darwin/darwin/Classes/WrappedMediaPlayer.swift b/packages/audioplayers_darwin/darwin/Classes/WrappedMediaPlayer.swift index b0d0f1497..99c6ef969 100644 --- a/packages/audioplayers_darwin/darwin/Classes/WrappedMediaPlayer.swift +++ b/packages/audioplayers_darwin/darwin/Classes/WrappedMediaPlayer.swift @@ -52,9 +52,7 @@ class WrappedMediaPlayer { let playbackStatus = player?.currentItem?.status if self.url != url || playbackStatus == .failed || playbackStatus == nil { - let parsedUrl = isLocal ? URL.init(fileURLWithPath: url.deletingPrefix("file://")) : URL.init(string: url)! - let playerItem = AVPlayerItem.init(url: parsedUrl) - playerItem.audioTimePitchAlgorithm = AVAudioTimePitchAlgorithm.timeDomain + let playerItem = createPlayerItem(url, isLocal) let player: AVPlayer if let existingPlayer = self.player { reset() @@ -196,7 +194,14 @@ class WrappedMediaPlayer { return player?.currentTime() } - func configParameters(player: AVPlayer) { + private func createPlayerItem(_ url: String, _ isLocal: Bool) -> AVPlayerItem { + let parsedUrl = isLocal ? URL.init(fileURLWithPath: url.deletingPrefix("file://")) : URL.init(string: url)! + let playerItem = AVPlayerItem.init(url: parsedUrl) + playerItem.audioTimePitchAlgorithm = AVAudioTimePitchAlgorithm.timeDomain + return playerItem + } + + private func configParameters(player: AVPlayer) { if (isPlaying) { player.volume = Float(volume) player.rate = Float(playbackRate) From 20657c7a3f30fce000a4fe3977621dab59fc76b9 Mon Sep 17 00:00:00 2001 From: Gustl22 Date: Fri, 28 Jul 2023 23:03:01 +0200 Subject: [PATCH 10/20] refactor(darwin): setUpPlayerItemStatusObservation as own method --- .../darwin/Classes/WrappedMediaPlayer.swift | 38 +++++++++++-------- 1 file changed, 22 insertions(+), 16 deletions(-) diff --git a/packages/audioplayers_darwin/darwin/Classes/WrappedMediaPlayer.swift b/packages/audioplayers_darwin/darwin/Classes/WrappedMediaPlayer.swift index 99c6ef969..d207c9960 100644 --- a/packages/audioplayers_darwin/darwin/Classes/WrappedMediaPlayer.swift +++ b/packages/audioplayers_darwin/darwin/Classes/WrappedMediaPlayer.swift @@ -86,22 +86,7 @@ class WrappedMediaPlayer { } self.observers.append(TimeObserver(player: player, observer: anObserver)) - // is sound ready - let newplayerItemStatusObservation = playerItem.observe(\AVPlayerItem.status) { (playerItem, change) in - let status = playerItem.status - self.eventHandler.onLog(message: "player status: \(status) change: \(change)") - - if status == .readyToPlay { - self.updateDuration() - completer?() - } else if status == .failed { - self.reset() - completerError?() - } - } - - playerItemStatusObservation?.invalidate() - playerItemStatusObservation = newplayerItemStatusObservation + setUpPlayerItemStatusObservation(playerItem, completer, completerError) } else { if playbackStatus == .readyToPlay { completer?() @@ -201,6 +186,27 @@ class WrappedMediaPlayer { return playerItem } + private func setUpPlayerItemStatusObservation(_ playerItem: AVPlayerItem, _ completer: Completer?, _ completerError: CompleterError?) { + let newplayerItemStatusObservation = playerItem.observe(\AVPlayerItem.status) { (playerItem, change) in + let status = playerItem.status + self.eventHandler.onLog(message: "player status: \(status), change: \(change)") + + switch playerItem.status { + case .readyToPlay: + self.updateDuration() + completer?() + case .failed: + self.reset() + completerError?() + default: + break + } + } + + playerItemStatusObservation?.invalidate() + playerItemStatusObservation = newplayerItemStatusObservation + } + private func configParameters(player: AVPlayer) { if (isPlaying) { player.volume = Float(volume) From f922ed5bebee0d525405f7ed37f76b6f38b09791 Mon Sep 17 00:00:00 2001 From: Gustl22 Date: Fri, 28 Jul 2023 23:25:42 +0200 Subject: [PATCH 11/20] refactor(darwin): setUpPositionObserver as own method --- .../darwin/Classes/WrappedMediaPlayer.swift | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/packages/audioplayers_darwin/darwin/Classes/WrappedMediaPlayer.swift b/packages/audioplayers_darwin/darwin/Classes/WrappedMediaPlayer.swift index d207c9960..cf8a0bea6 100644 --- a/packages/audioplayers_darwin/darwin/Classes/WrappedMediaPlayer.swift +++ b/packages/audioplayers_darwin/darwin/Classes/WrappedMediaPlayer.swift @@ -67,13 +67,7 @@ class WrappedMediaPlayer { self.observers = [] self.url = url - // stream player position - let interval = toCMTime(millis: 200) - let timeObserver = player.addPeriodicTimeObserver(forInterval: interval, queue: nil) { - [weak self] time in - self?.onTimeInterval(time: time) - } - self.observers.append(TimeObserver(player: player, observer: timeObserver)) + setUpPositionObserver(player) } let anObserver = NotificationCenter.default.addObserver( @@ -207,6 +201,15 @@ class WrappedMediaPlayer { playerItemStatusObservation = newplayerItemStatusObservation } + private func setUpPositionObserver(_ player: AVPlayer) { + let interval = toCMTime(millis: 200) + let observer = player.addPeriodicTimeObserver(forInterval: interval, queue: nil) { + [weak self] time in + self?.onTimeInterval(time: time) + } + self.observers.append(TimeObserver(player: player, observer: observer)) + } + private func configParameters(player: AVPlayer) { if (isPlaying) { player.volume = Float(volume) From fda9f4d3debe06615d48373356e0447832c72776 Mon Sep 17 00:00:00 2001 From: Gabriel Terwesten Date: Sat, 29 Jul 2023 00:02:31 +0200 Subject: [PATCH 12/20] refactor(darwin): setUpSoundCompletedObserver --- .../darwin/Classes/WrappedMediaPlayer.swift | 23 +++++++++++-------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/packages/audioplayers_darwin/darwin/Classes/WrappedMediaPlayer.swift b/packages/audioplayers_darwin/darwin/Classes/WrappedMediaPlayer.swift index cf8a0bea6..10c976404 100644 --- a/packages/audioplayers_darwin/darwin/Classes/WrappedMediaPlayer.swift +++ b/packages/audioplayers_darwin/darwin/Classes/WrappedMediaPlayer.swift @@ -70,16 +70,7 @@ class WrappedMediaPlayer { setUpPositionObserver(player) } - let anObserver = NotificationCenter.default.addObserver( - forName: NSNotification.Name.AVPlayerItemDidPlayToEndTime, - object: playerItem, - queue: nil - ) { - [weak self] (notification) in - self?.onSoundComplete() - } - self.observers.append(TimeObserver(player: player, observer: anObserver)) - + setUpSoundCompletedObserver(player, playerItem) setUpPlayerItemStatusObservation(playerItem, completer, completerError) } else { if playbackStatus == .readyToPlay { @@ -210,6 +201,18 @@ class WrappedMediaPlayer { self.observers.append(TimeObserver(player: player, observer: observer)) } + private func setUpSoundCompletedObserver(_ player: AVPlayer, _ playerItem: AVPlayerItem) { + let observer = NotificationCenter.default.addObserver( + forName: NSNotification.Name.AVPlayerItemDidPlayToEndTime, + object: playerItem, + queue: nil + ) { + [weak self] (notification) in + self?.onSoundComplete() + } + self.observers.append(TimeObserver(player: player, observer: observer)) + } + private func configParameters(player: AVPlayer) { if (isPlaying) { player.volume = Float(volume) From 3403df8889422102a10ea8727893f85f85c556f0 Mon Sep 17 00:00:00 2001 From: Gustl22 Date: Sat, 9 Sep 2023 03:12:07 +0200 Subject: [PATCH 13/20] swift-format --- .../darwin/Classes/WrappedMediaPlayer.swift | 84 ++++++++++--------- 1 file changed, 43 insertions(+), 41 deletions(-) diff --git a/packages/audioplayers_darwin/darwin/Classes/WrappedMediaPlayer.swift b/packages/audioplayers_darwin/darwin/Classes/WrappedMediaPlayer.swift index e273fa059..fc7b1ff7f 100644 --- a/packages/audioplayers_darwin/darwin/Classes/WrappedMediaPlayer.swift +++ b/packages/audioplayers_darwin/darwin/Classes/WrappedMediaPlayer.swift @@ -51,20 +51,20 @@ class WrappedMediaPlayer { ) { let playbackStatus = player?.currentItem?.status - if self.url != url || playbackStatus == .failed || playbackStatus == nil { - reset() - self.url = url - let playerItem = createPlayerItem(url, isLocal) - setUpPlayerItemStatusObservation(playerItem, completer, completerError) - let player = updatePlayer(playerItem) ?? createPlayer(playerItem) - setUpPositionObserver(player) - setUpSoundCompletedObserver(player, playerItem) - } else { - if playbackStatus == .readyToPlay { - completer?() - } - } + if self.url != url || playbackStatus == .failed || playbackStatus == nil { + reset() + self.url = url + let playerItem = createPlayerItem(url, isLocal) + setUpPlayerItemStatusObservation(playerItem, completer, completerError) + let player = updatePlayer(playerItem) ?? createPlayer(playerItem) + setUpPositionObserver(player) + setUpSoundCompletedObserver(player, playerItem) + } else { + if playbackStatus == .readyToPlay { + completer?() + } } + } func getDuration() -> Int? { guard let duration = getDurationCMTime() else { @@ -160,39 +160,41 @@ class WrappedMediaPlayer { return playerItem } - private func createPlayer( _ playerItem: AVPlayerItem) -> AVPlayer { - let player = AVPlayer.init(playerItem: playerItem) - configParameters(player: player) - self.player = player - return player + private func createPlayer(_ playerItem: AVPlayerItem) -> AVPlayer { + let player = AVPlayer.init(playerItem: playerItem) + configParameters(player: player) + self.player = player + return player + } + + private func updatePlayer(_ playerItem: AVPlayerItem) -> AVPlayer? { + if let player = self.player { + player.replaceCurrentItem(with: playerItem) } - private func updatePlayer( _ playerItem: AVPlayerItem) -> AVPlayer? { - if let player = self.player { - player.replaceCurrentItem(with: playerItem) - } + return self.player + } - return self.player - } + private func setUpPlayerItemStatusObservation( + _ playerItem: AVPlayerItem, _ completer: Completer?, _ completerError: CompleterError? + ) { + playerItemStatusObservation = playerItem.observe(\AVPlayerItem.status) { (playerItem, change) in + let status = playerItem.status + self.eventHandler.onLog(message: "player status: \(status), change: \(change)") - private func setUpPlayerItemStatusObservation(_ playerItem: AVPlayerItem, _ completer: Completer?, _ completerError: CompleterError?) { - playerItemStatusObservation = playerItem.observe(\AVPlayerItem.status) { (playerItem, change) in - let status = playerItem.status - self.eventHandler.onLog(message: "player status: \(status), change: \(change)") - - switch playerItem.status { - case .readyToPlay: - self.updateDuration() - completer?() - case .failed: - self.eventHandler.onLog(message: "error: \(String(describing: playerItem.error))") - self.reset() - completerError?() - default: - break - } - } + switch playerItem.status { + case .readyToPlay: + self.updateDuration() + completer?() + case .failed: + self.eventHandler.onLog(message: "error: \(String(describing: playerItem.error))") + self.reset() + completerError?() + default: + break + } } + } private func setUpPositionObserver(_ player: AVPlayer) { let interval = toCMTime(millis: 200) From 69b347c9e5fef77228801fd367f45f20cb633aa3 Mon Sep 17 00:00:00 2001 From: Gustl22 Date: Sat, 23 Sep 2023 20:06:22 +0200 Subject: [PATCH 14/20] avoid catching unknown errors --- packages/audioplayers/lib/src/audioplayer.dart | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/packages/audioplayers/lib/src/audioplayer.dart b/packages/audioplayers/lib/src/audioplayer.dart index 0b24def8d..c676e2a1d 100644 --- a/packages/audioplayers/lib/src/audioplayer.dart +++ b/packages/audioplayers/lib/src/audioplayer.dart @@ -313,12 +313,9 @@ class AudioPlayer { } }, ); - try { - await fun(); - await preparedCompleter.future.timeout(const Duration(seconds: 30)); - } finally { - onPreparedSubscription.cancel(); - } + await fun(); + await preparedCompleter.future.timeout(const Duration(seconds: 30)); + onPreparedSubscription.cancel(); } /// Sets the URL to a remote link. From 2634da6b5ae455ae056bf841fe6d42a458eeeff9 Mon Sep 17 00:00:00 2001 From: Gustl22 Date: Sat, 23 Sep 2023 20:07:43 +0200 Subject: [PATCH 15/20] remove log --- .../audioplayers_darwin/darwin/Classes/WrappedMediaPlayer.swift | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/audioplayers_darwin/darwin/Classes/WrappedMediaPlayer.swift b/packages/audioplayers_darwin/darwin/Classes/WrappedMediaPlayer.swift index fc7b1ff7f..319e074b5 100644 --- a/packages/audioplayers_darwin/darwin/Classes/WrappedMediaPlayer.swift +++ b/packages/audioplayers_darwin/darwin/Classes/WrappedMediaPlayer.swift @@ -187,7 +187,6 @@ class WrappedMediaPlayer { self.updateDuration() completer?() case .failed: - self.eventHandler.onLog(message: "error: \(String(describing: playerItem.error))") self.reset() completerError?() default: From 52de571020965917036c2d2941181b62157b8fc2 Mon Sep 17 00:00:00 2001 From: Gustl22 Date: Sat, 23 Sep 2023 20:26:31 +0200 Subject: [PATCH 16/20] darwin: simplify assignment --- .../darwin/Classes/WrappedMediaPlayer.swift | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/packages/audioplayers_darwin/darwin/Classes/WrappedMediaPlayer.swift b/packages/audioplayers_darwin/darwin/Classes/WrappedMediaPlayer.swift index 319e074b5..3e7b9b450 100644 --- a/packages/audioplayers_darwin/darwin/Classes/WrappedMediaPlayer.swift +++ b/packages/audioplayers_darwin/darwin/Classes/WrappedMediaPlayer.swift @@ -13,7 +13,7 @@ class WrappedMediaPlayer { var looping: Bool private var reference: SwiftAudioplayersDarwinPlugin - private var player: AVPlayer? + private var player: AVPlayer private var playbackRate: Double private var volume: Double private var url: String? @@ -32,7 +32,7 @@ class WrappedMediaPlayer { ) { self.reference = reference self.eventHandler = eventHandler - self.player = player + self.player = player ?? AVPlayer.init() self.observers = [] self.playerItemStatusObservation = nil @@ -55,10 +55,12 @@ class WrappedMediaPlayer { reset() self.url = url let playerItem = createPlayerItem(url, isLocal) + // Need to observe item status immediately after creating: setUpPlayerItemStatusObservation(playerItem, completer, completerError) - let player = updatePlayer(playerItem) ?? createPlayer(playerItem) + let player = updatePlayer(playerItem) setUpPositionObserver(player) setUpSoundCompletedObserver(player, playerItem) + self.player = player } else { if playbackStatus == .readyToPlay { completer?() @@ -160,13 +162,6 @@ class WrappedMediaPlayer { return playerItem } - private func createPlayer(_ playerItem: AVPlayerItem) -> AVPlayer { - let player = AVPlayer.init(playerItem: playerItem) - configParameters(player: player) - self.player = player - return player - } - private func updatePlayer(_ playerItem: AVPlayerItem) -> AVPlayer? { if let player = self.player { player.replaceCurrentItem(with: playerItem) From 00d0285462bf86d5d68ae13e19077e6be533980f Mon Sep 17 00:00:00 2001 From: Gustl22 Date: Sat, 23 Sep 2023 21:49:44 +0200 Subject: [PATCH 17/20] darwin: observer improvements --- .../darwin/Classes/WrappedMediaPlayer.swift | 33 ++++++++----------- 1 file changed, 14 insertions(+), 19 deletions(-) diff --git a/packages/audioplayers_darwin/darwin/Classes/WrappedMediaPlayer.swift b/packages/audioplayers_darwin/darwin/Classes/WrappedMediaPlayer.swift index 3e7b9b450..2249d54b7 100644 --- a/packages/audioplayers_darwin/darwin/Classes/WrappedMediaPlayer.swift +++ b/packages/audioplayers_darwin/darwin/Classes/WrappedMediaPlayer.swift @@ -18,7 +18,8 @@ class WrappedMediaPlayer { private var volume: Double private var url: String? - private var observers: [TimeObserver] + private var positionObserver: TimeObserver + private var completionObserver: TimeObserver? private var playerItemStatusObservation: NSKeyValueObservation? init( @@ -33,8 +34,9 @@ class WrappedMediaPlayer { self.reference = reference self.eventHandler = eventHandler self.player = player ?? AVPlayer.init() - self.observers = [] + self.completionObserver = nil self.playerItemStatusObservation = nil + setUpPositionObserver(player) self.isPlaying = false self.playbackRate = playbackRate @@ -57,10 +59,8 @@ class WrappedMediaPlayer { let playerItem = createPlayerItem(url, isLocal) // Need to observe item status immediately after creating: setUpPlayerItemStatusObservation(playerItem, completer, completerError) - let player = updatePlayer(playerItem) - setUpPositionObserver(player) - setUpSoundCompletedObserver(player, playerItem) - self.player = player + player.replaceCurrentItem(with: playerItem) + setUpSoundCompletedObserver(self.player, playerItem) } else { if playbackStatus == .readyToPlay { completer?() @@ -142,6 +142,9 @@ class WrappedMediaPlayer { func dispose(completer: Completer? = nil) { release { + if let pObserver = positionObserver { + NotificationCenter.default.removeObserver(pObserver.observer) + } completer?() } } @@ -162,14 +165,6 @@ class WrappedMediaPlayer { return playerItem } - private func updatePlayer(_ playerItem: AVPlayerItem) -> AVPlayer? { - if let player = self.player { - player.replaceCurrentItem(with: playerItem) - } - - return self.player - } - private func setUpPlayerItemStatusObservation( _ playerItem: AVPlayerItem, _ completer: Completer?, _ completerError: CompleterError? ) { @@ -196,7 +191,7 @@ class WrappedMediaPlayer { [weak self] time in self?.onTimeInterval(time: time) } - self.observers.append(TimeObserver(player: player, observer: observer)) + self.positionObserver = TimeObserver(player: player, observer: observer) } private func setUpSoundCompletedObserver(_ player: AVPlayer, _ playerItem: AVPlayerItem) { @@ -208,7 +203,7 @@ class WrappedMediaPlayer { [weak self] (notification) in self?.onSoundComplete() } - self.observers.append(TimeObserver(player: player, observer: observer)) + self.completionObserver = TimeObserver(player: player, observer: observer) } private func configParameters(player: AVPlayer) { @@ -221,10 +216,10 @@ class WrappedMediaPlayer { private func reset() { playerItemStatusObservation?.invalidate() playerItemStatusObservation = nil - for observer in observers { - NotificationCenter.default.removeObserver(observer.observer) + if let cObserver = completionObserver { + NotificationCenter.default.removeObserver(cObserver.observer) + completionObserver = nil } - observers = [] player?.replaceCurrentItem(with: nil) } From 67478d46b283decd3985546b3859701583fb6695 Mon Sep 17 00:00:00 2001 From: Gustl22 Date: Mon, 25 Sep 2023 01:01:22 +0200 Subject: [PATCH 18/20] darwin: Make player not nullable --- .../example/ios/Runner/Info.plist | 4 +- .../darwin/Classes/WrappedMediaPlayer.swift | 47 +++++++++---------- 2 files changed, 24 insertions(+), 27 deletions(-) diff --git a/packages/audioplayers/example/ios/Runner/Info.plist b/packages/audioplayers/example/ios/Runner/Info.plist index 19ebb8d59..62b1845ac 100644 --- a/packages/audioplayers/example/ios/Runner/Info.plist +++ b/packages/audioplayers/example/ios/Runner/Info.plist @@ -31,6 +31,8 @@ NSAllowsArbitraryLoads + UIApplicationSupportsIndirectInputEvents + UILaunchStoryboardName LaunchScreen UIMainStoryboardFile @@ -50,7 +52,5 @@ UIViewControllerBasedStatusBarAppearance - UIApplicationSupportsIndirectInputEvents - diff --git a/packages/audioplayers_darwin/darwin/Classes/WrappedMediaPlayer.swift b/packages/audioplayers_darwin/darwin/Classes/WrappedMediaPlayer.swift index 2249d54b7..b0e80ebf1 100644 --- a/packages/audioplayers_darwin/darwin/Classes/WrappedMediaPlayer.swift +++ b/packages/audioplayers_darwin/darwin/Classes/WrappedMediaPlayer.swift @@ -18,14 +18,14 @@ class WrappedMediaPlayer { private var volume: Double private var url: String? - private var positionObserver: TimeObserver + private var positionObserver: TimeObserver! private var completionObserver: TimeObserver? private var playerItemStatusObservation: NSKeyValueObservation? init( reference: SwiftAudioplayersDarwinPlugin, eventHandler: AudioPlayersStreamHandler, - player: AVPlayer? = nil, + player: AVPlayer = AVPlayer.init(), playbackRate: Double = defaultPlaybackRate, volume: Double = defaultVolume, looping: Bool = defaultLooping, @@ -33,16 +33,17 @@ class WrappedMediaPlayer { ) { self.reference = reference self.eventHandler = eventHandler - self.player = player ?? AVPlayer.init() + self.player = player self.completionObserver = nil self.playerItemStatusObservation = nil - setUpPositionObserver(player) self.isPlaying = false self.playbackRate = playbackRate self.volume = volume self.looping = looping self.url = url + + self.setUpPositionObserver(player) } func setSourceUrl( @@ -51,7 +52,7 @@ class WrappedMediaPlayer { completer: Completer? = nil, completerError: CompleterError? = nil ) { - let playbackStatus = player?.currentItem?.status + let playbackStatus = player.currentItem?.status if self.url != url || playbackStatus == .failed || playbackStatus == nil { reset() @@ -84,41 +85,39 @@ class WrappedMediaPlayer { func pause() { isPlaying = false - player?.pause() + player.pause() } func resume() { isPlaying = true - if let player = self.player { - configParameters(player: player) - if #available(iOS 10.0, macOS 10.12, *) { - player.playImmediately(atRate: Float(playbackRate)) - } else { - player.play() - } - updateDuration() + configParameters(player: player) + if #available(iOS 10.0, macOS 10.12, *) { + player.playImmediately(atRate: Float(playbackRate)) + } else { + player.play() } + updateDuration() } func setVolume(volume: Double) { self.volume = volume - player?.volume = Float(volume) + player.volume = Float(volume) } func setPlaybackRate(playbackRate: Double) { self.playbackRate = playbackRate - player?.rate = Float(playbackRate) + player.rate = Float(playbackRate) } func seek(time: CMTime, completer: Completer? = nil) { - guard let currentItem = player?.currentItem else { + guard let currentItem = player.currentItem else { completer?() return } currentItem.seek(to: time) { finished in if !self.isPlaying { - self.player?.pause() + self.player.pause() } self.eventHandler.onSeekComplete() if finished { @@ -142,19 +141,17 @@ class WrappedMediaPlayer { func dispose(completer: Completer? = nil) { release { - if let pObserver = positionObserver { - NotificationCenter.default.removeObserver(pObserver.observer) - } + NotificationCenter.default.removeObserver(self.positionObserver.observer) completer?() } } private func getDurationCMTime() -> CMTime? { - return player?.currentItem?.asset.duration + return player.currentItem?.asset.duration } private func getCurrentCMTime() -> CMTime? { - return player?.currentItem?.currentTime() + return player.currentItem?.currentTime() } private func createPlayerItem(_ url: String, _ isLocal: Bool) -> AVPlayerItem { @@ -220,11 +217,11 @@ class WrappedMediaPlayer { NotificationCenter.default.removeObserver(cObserver.observer) completionObserver = nil } - player?.replaceCurrentItem(with: nil) + player.replaceCurrentItem(with: nil) } private func updateDuration() { - guard let duration = player?.currentItem?.asset.duration else { + guard let duration = player.currentItem?.asset.duration else { return } if CMTimeGetSeconds(duration) > 0 { From 2c62ba76650ecc89b3b693abe65b2895fc5fab74 Mon Sep 17 00:00:00 2001 From: Gustl22 Date: Mon, 25 Sep 2023 08:03:14 +0200 Subject: [PATCH 19/20] recreate ios folder --- packages/audioplayers/example/.metadata | 34 +-- packages/audioplayers/example/ios/Podfile | 3 + .../audioplayers/example/ios/Podfile.lock | 2 +- .../ios/Runner.xcodeproj/project.pbxproj | 251 +++++++++++++++--- .../xcshareddata/xcschemes/Runner.xcscheme | 13 +- .../example/ios/RunnerTests/RunnerTests.swift | 12 + .../macos/RunnerTests/RunnerTests.swift | 12 + 7 files changed, 268 insertions(+), 59 deletions(-) create mode 100644 packages/audioplayers/example/ios/RunnerTests/RunnerTests.swift create mode 100644 packages/audioplayers/example/macos/RunnerTests/RunnerTests.swift diff --git a/packages/audioplayers/example/.metadata b/packages/audioplayers/example/.metadata index 20eb09cce..8e2946d54 100644 --- a/packages/audioplayers/example/.metadata +++ b/packages/audioplayers/example/.metadata @@ -1,11 +1,11 @@ # This file tracks properties of this Flutter project. # Used by Flutter tool to assess capabilities and perform upgrades etc. # -# This file should be version controlled. +# This file should be version controlled and should not be manually edited. version: - revision: 62bd79521d8d007524e351747471ba66696fc2d4 - channel: stable + revision: "12fccda598477eddd19f93040a1dba24f915b9be" + channel: "stable" project_type: app @@ -13,26 +13,26 @@ project_type: app migration: platforms: - platform: root - create_revision: 62bd79521d8d007524e351747471ba66696fc2d4 - base_revision: 62bd79521d8d007524e351747471ba66696fc2d4 + create_revision: 12fccda598477eddd19f93040a1dba24f915b9be + base_revision: 12fccda598477eddd19f93040a1dba24f915b9be - platform: android - create_revision: 62bd79521d8d007524e351747471ba66696fc2d4 - base_revision: 62bd79521d8d007524e351747471ba66696fc2d4 + create_revision: 12fccda598477eddd19f93040a1dba24f915b9be + base_revision: 12fccda598477eddd19f93040a1dba24f915b9be - platform: ios - create_revision: 62bd79521d8d007524e351747471ba66696fc2d4 - base_revision: 62bd79521d8d007524e351747471ba66696fc2d4 + create_revision: 12fccda598477eddd19f93040a1dba24f915b9be + base_revision: 12fccda598477eddd19f93040a1dba24f915b9be - platform: linux - create_revision: 62bd79521d8d007524e351747471ba66696fc2d4 - base_revision: 62bd79521d8d007524e351747471ba66696fc2d4 + create_revision: 12fccda598477eddd19f93040a1dba24f915b9be + base_revision: 12fccda598477eddd19f93040a1dba24f915b9be - platform: macos - create_revision: 62bd79521d8d007524e351747471ba66696fc2d4 - base_revision: 62bd79521d8d007524e351747471ba66696fc2d4 + create_revision: 12fccda598477eddd19f93040a1dba24f915b9be + base_revision: 12fccda598477eddd19f93040a1dba24f915b9be - platform: web - create_revision: 62bd79521d8d007524e351747471ba66696fc2d4 - base_revision: 62bd79521d8d007524e351747471ba66696fc2d4 + create_revision: 12fccda598477eddd19f93040a1dba24f915b9be + base_revision: 12fccda598477eddd19f93040a1dba24f915b9be - platform: windows - create_revision: 62bd79521d8d007524e351747471ba66696fc2d4 - base_revision: 62bd79521d8d007524e351747471ba66696fc2d4 + create_revision: 12fccda598477eddd19f93040a1dba24f915b9be + base_revision: 12fccda598477eddd19f93040a1dba24f915b9be # User provided section diff --git a/packages/audioplayers/example/ios/Podfile b/packages/audioplayers/example/ios/Podfile index 88359b225..fdcc671eb 100644 --- a/packages/audioplayers/example/ios/Podfile +++ b/packages/audioplayers/example/ios/Podfile @@ -32,6 +32,9 @@ target 'Runner' do use_modular_headers! flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__)) + target 'RunnerTests' do + inherit! :search_paths + end end post_install do |installer| diff --git a/packages/audioplayers/example/ios/Podfile.lock b/packages/audioplayers/example/ios/Podfile.lock index cde62747d..d7286d1ba 100644 --- a/packages/audioplayers/example/ios/Podfile.lock +++ b/packages/audioplayers/example/ios/Podfile.lock @@ -83,6 +83,6 @@ SPEC CHECKSUMS: SDWebImage: 750adf017a315a280c60fde706ab1e552a3ae4e9 SwiftyGif: 93a1cc87bf3a51916001cf8f3d63835fb64c819f -PODFILE CHECKSUM: ef19549a9bc3046e7bb7d2fab4d021637c0c58a3 +PODFILE CHECKSUM: 70d9d25280d0dd177a5f637cdb0f0b0b12c6a189 COCOAPODS: 1.12.1 diff --git a/packages/audioplayers/example/ios/Runner.xcodeproj/project.pbxproj b/packages/audioplayers/example/ios/Runner.xcodeproj/project.pbxproj index 8c618c4f4..6c7340e14 100644 --- a/packages/audioplayers/example/ios/Runner.xcodeproj/project.pbxproj +++ b/packages/audioplayers/example/ios/Runner.xcodeproj/project.pbxproj @@ -7,8 +7,10 @@ objects = { /* Begin PBXBuildFile section */ - 002DBB81149B2A4B70E5FDFF /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 617B5B12C8040493486E21F6 /* Pods_Runner.framework */; }; + 0E864EBBAE56D327A15EBA41 /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 551B116DA4F96086BD173A84 /* Pods_Runner.framework */; }; 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; }; + 1D9A694A7CEC0D353DED1B8C /* Pods_RunnerTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 85B6DFA33A7C61FBD32873FA /* Pods_RunnerTests.framework */; }; + 331C808B294A63AB00263BE5 /* RunnerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 331C807B294A618700263BE5 /* RunnerTests.swift */; }; 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; }; 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; @@ -16,6 +18,16 @@ 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; }; /* End PBXBuildFile section */ +/* Begin PBXContainerItemProxy section */ + 331C8085294A63A400263BE5 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 97C146E61CF9000F007C117D /* Project object */; + proxyType = 1; + remoteGlobalIDString = 97C146ED1CF9000F007C117D; + remoteInfo = Runner; + }; +/* End PBXContainerItemProxy section */ + /* Begin PBXCopyFilesBuildPhase section */ 9705A1C41CF9048500538489 /* Embed Frameworks */ = { isa = PBXCopyFilesBuildPhase; @@ -32,12 +44,17 @@ /* Begin PBXFileReference section */ 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; }; 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; }; + 331C807B294A618700263BE5 /* RunnerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RunnerTests.swift; sourceTree = ""; }; + 331C8081294A63A400263BE5 /* RunnerTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = RunnerTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; }; - 617B5B12C8040493486E21F6 /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 551B116DA4F96086BD173A84 /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 5A0906E14376D130E0C562B7 /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = ""; }; 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = ""; }; 74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; }; - 8E06A69128A18AD03480421D /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = ""; }; + 85B6DFA33A7C61FBD32873FA /* Pods_RunnerTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_RunnerTests.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 8A21E16ECF30A12B0DF1FAF4 /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = ""; }; + 8F6BF99346F09424DEBFB3B4 /* Pods-RunnerTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.release.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.release.xcconfig"; sourceTree = ""; }; 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; }; 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; }; 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -45,30 +62,37 @@ 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - C3DA4DB9E96E6E1501C6642B /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = ""; }; - D319789980A1E5DD1D271629 /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = ""; }; + 98F71349B103A7BE4B2D4799 /* Pods-RunnerTests.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.profile.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.profile.xcconfig"; sourceTree = ""; }; + B580CDC9E5166855716C16A0 /* Pods-RunnerTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.debug.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.debug.xcconfig"; sourceTree = ""; }; + DED731635DC1AE87F15498B5 /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ + 63F0DAC7E585B9CA116711B4 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 1D9A694A7CEC0D353DED1B8C /* Pods_RunnerTests.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; 97C146EB1CF9000F007C117D /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 002DBB81149B2A4B70E5FDFF /* Pods_Runner.framework in Frameworks */, + 0E864EBBAE56D327A15EBA41 /* Pods_Runner.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ - 0B7562414E22A1F98BDAB928 /* Pods */ = { + 331C8082294A63A400263BE5 /* RunnerTests */ = { isa = PBXGroup; children = ( - 8E06A69128A18AD03480421D /* Pods-Runner.debug.xcconfig */, - C3DA4DB9E96E6E1501C6642B /* Pods-Runner.release.xcconfig */, - D319789980A1E5DD1D271629 /* Pods-Runner.profile.xcconfig */, + 331C807B294A618700263BE5 /* RunnerTests.swift */, ); - path = Pods; + path = RunnerTests; sourceTree = ""; }; 9740EEB11CF90186004384FC /* Flutter */ = { @@ -88,8 +112,9 @@ 9740EEB11CF90186004384FC /* Flutter */, 97C146F01CF9000F007C117D /* Runner */, 97C146EF1CF9000F007C117D /* Products */, - 0B7562414E22A1F98BDAB928 /* Pods */, - A11641C8B9D20069E4B7BBF4 /* Frameworks */, + 331C8082294A63A400263BE5 /* RunnerTests */, + BEE9AE7BCC053D9AC97099DC /* Pods */, + D7714C5FEC027CBC865AFCB2 /* Frameworks */, ); sourceTree = ""; }; @@ -97,6 +122,7 @@ isa = PBXGroup; children = ( 97C146EE1CF9000F007C117D /* Runner.app */, + 331C8081294A63A400263BE5 /* RunnerTests.xctest */, ); name = Products; sourceTree = ""; @@ -116,10 +142,25 @@ path = Runner; sourceTree = ""; }; - A11641C8B9D20069E4B7BBF4 /* Frameworks */ = { + BEE9AE7BCC053D9AC97099DC /* Pods */ = { + isa = PBXGroup; + children = ( + DED731635DC1AE87F15498B5 /* Pods-Runner.debug.xcconfig */, + 8A21E16ECF30A12B0DF1FAF4 /* Pods-Runner.release.xcconfig */, + 5A0906E14376D130E0C562B7 /* Pods-Runner.profile.xcconfig */, + B580CDC9E5166855716C16A0 /* Pods-RunnerTests.debug.xcconfig */, + 8F6BF99346F09424DEBFB3B4 /* Pods-RunnerTests.release.xcconfig */, + 98F71349B103A7BE4B2D4799 /* Pods-RunnerTests.profile.xcconfig */, + ); + name = Pods; + path = Pods; + sourceTree = ""; + }; + D7714C5FEC027CBC865AFCB2 /* Frameworks */ = { isa = PBXGroup; children = ( - 617B5B12C8040493486E21F6 /* Pods_Runner.framework */, + 551B116DA4F96086BD173A84 /* Pods_Runner.framework */, + 85B6DFA33A7C61FBD32873FA /* Pods_RunnerTests.framework */, ); name = Frameworks; sourceTree = ""; @@ -127,18 +168,37 @@ /* End PBXGroup section */ /* Begin PBXNativeTarget section */ + 331C8080294A63A400263BE5 /* RunnerTests */ = { + isa = PBXNativeTarget; + buildConfigurationList = 331C8087294A63A400263BE5 /* Build configuration list for PBXNativeTarget "RunnerTests" */; + buildPhases = ( + 20F9A383E5F0285CB505DADC /* [CP] Check Pods Manifest.lock */, + 331C807D294A63A400263BE5 /* Sources */, + 331C807F294A63A400263BE5 /* Resources */, + 63F0DAC7E585B9CA116711B4 /* Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + 331C8086294A63A400263BE5 /* PBXTargetDependency */, + ); + name = RunnerTests; + productName = RunnerTests; + productReference = 331C8081294A63A400263BE5 /* RunnerTests.xctest */; + productType = "com.apple.product-type.bundle.unit-test"; + }; 97C146ED1CF9000F007C117D /* Runner */ = { isa = PBXNativeTarget; buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */; buildPhases = ( - BE8053A1851B531AF969CF07 /* [CP] Check Pods Manifest.lock */, + 087721F305E3CA39185CAD85 /* [CP] Check Pods Manifest.lock */, 9740EEB61CF901F6004384FC /* Run Script */, 97C146EA1CF9000F007C117D /* Sources */, 97C146EB1CF9000F007C117D /* Frameworks */, 97C146EC1CF9000F007C117D /* Resources */, 9705A1C41CF9048500538489 /* Embed Frameworks */, 3B06AD1E1E4923F5004D2608 /* Thin Binary */, - B4B893715D0ED6436F546900 /* [CP] Embed Pods Frameworks */, + E01145D36BB6AA1621E2F47F /* [CP] Embed Pods Frameworks */, ); buildRules = ( ); @@ -155,9 +215,14 @@ 97C146E61CF9000F007C117D /* Project object */ = { isa = PBXProject; attributes = { - LastUpgradeCheck = 1300; + BuildIndependentTargetsInParallel = YES; + LastUpgradeCheck = 1430; ORGANIZATIONNAME = ""; TargetAttributes = { + 331C8080294A63A400263BE5 = { + CreatedOnToolsVersion = 14.0; + TestTargetID = 97C146ED1CF9000F007C117D; + }; 97C146ED1CF9000F007C117D = { CreatedOnToolsVersion = 7.3.1; LastSwiftMigration = 1100; @@ -178,11 +243,19 @@ projectRoot = ""; targets = ( 97C146ED1CF9000F007C117D /* Runner */, + 331C8080294A63A400263BE5 /* RunnerTests */, ); }; /* End PBXProject section */ /* Begin PBXResourcesBuildPhase section */ + 331C807F294A63A400263BE5 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; 97C146EC1CF9000F007C117D /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; @@ -197,6 +270,50 @@ /* End PBXResourcesBuildPhase section */ /* Begin PBXShellScriptBuildPhase section */ + 087721F305E3CA39185CAD85 /* [CP] Check Pods Manifest.lock */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", + ); + name = "[CP] Check Pods Manifest.lock"; + outputFileListPaths = ( + ); + outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-Runner-checkManifestLockResult.txt", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; + showEnvVarsInLog = 0; + }; + 20F9A383E5F0285CB505DADC /* [CP] Check Pods Manifest.lock */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", + ); + name = "[CP] Check Pods Manifest.lock"; + outputFileListPaths = ( + ); + outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-RunnerTests-checkManifestLockResult.txt", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; + showEnvVarsInLog = 0; + }; 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = { isa = PBXShellScriptBuildPhase; alwaysOutOfDate = 1; @@ -228,7 +345,7 @@ shellPath = /bin/sh; shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build"; }; - B4B893715D0ED6436F546900 /* [CP] Embed Pods Frameworks */ = { + E01145D36BB6AA1621E2F47F /* [CP] Embed Pods Frameworks */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( @@ -245,31 +362,17 @@ shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n"; showEnvVarsInLog = 0; }; - BE8053A1851B531AF969CF07 /* [CP] Check Pods Manifest.lock */ = { - isa = PBXShellScriptBuildPhase; +/* End PBXShellScriptBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 331C807D294A63A400263BE5 /* Sources */ = { + isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - ); - inputFileListPaths = ( - ); - inputPaths = ( - "${PODS_PODFILE_DIR_PATH}/Podfile.lock", - "${PODS_ROOT}/Manifest.lock", - ); - name = "[CP] Check Pods Manifest.lock"; - outputFileListPaths = ( - ); - outputPaths = ( - "$(DERIVED_FILE_DIR)/Pods-Runner-checkManifestLockResult.txt", + 331C808B294A63AB00263BE5 /* RunnerTests.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; - showEnvVarsInLog = 0; }; -/* End PBXShellScriptBuildPhase section */ - -/* Begin PBXSourcesBuildPhase section */ 97C146EA1CF9000F007C117D /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; @@ -281,6 +384,14 @@ }; /* End PBXSourcesBuildPhase section */ +/* Begin PBXTargetDependency section */ + 331C8086294A63A400263BE5 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 97C146ED1CF9000F007C117D /* Runner */; + targetProxy = 331C8085294A63A400263BE5 /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + /* Begin PBXVariantGroup section */ 97C146FA1CF9000F007C117D /* Main.storyboard */ = { isa = PBXVariantGroup; @@ -373,6 +484,56 @@ }; name = Profile; }; + 331C8088294A63A400263BE5 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = B580CDC9E5166855716C16A0 /* Pods-RunnerTests.debug.xcconfig */; + buildSettings = { + BUNDLE_LOADER = "$(TEST_HOST)"; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + GENERATE_INFOPLIST_FILE = YES; + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = xyz.luan.audioplayers.example.RunnerTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 5.0; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Runner.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/Runner"; + }; + name = Debug; + }; + 331C8089294A63A400263BE5 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 8F6BF99346F09424DEBFB3B4 /* Pods-RunnerTests.release.xcconfig */; + buildSettings = { + BUNDLE_LOADER = "$(TEST_HOST)"; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + GENERATE_INFOPLIST_FILE = YES; + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = xyz.luan.audioplayers.example.RunnerTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 5.0; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Runner.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/Runner"; + }; + name = Release; + }; + 331C808A294A63A400263BE5 /* Profile */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 98F71349B103A7BE4B2D4799 /* Pods-RunnerTests.profile.xcconfig */; + buildSettings = { + BUNDLE_LOADER = "$(TEST_HOST)"; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + GENERATE_INFOPLIST_FILE = YES; + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = xyz.luan.audioplayers.example.RunnerTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 5.0; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Runner.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/Runner"; + }; + name = Profile; + }; 97C147031CF9000F007C117D /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { @@ -487,7 +648,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; - DEVELOPMENT_TEAM = Z28FWXF4S4; + DEVELOPMENT_TEAM = D5SH8DD2UN; ENABLE_BITCODE = NO; INFOPLIST_FILE = Runner/Info.plist; LD_RUNPATH_SEARCH_PATHS = ( @@ -528,6 +689,16 @@ /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ + 331C8087294A63A400263BE5 /* Build configuration list for PBXNativeTarget "RunnerTests" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 331C8088294A63A400263BE5 /* Debug */, + 331C8089294A63A400263BE5 /* Release */, + 331C808A294A63A400263BE5 /* Profile */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */ = { isa = XCConfigurationList; buildConfigurations = ( diff --git a/packages/audioplayers/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/packages/audioplayers/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme index c87d15a33..87131a09b 100644 --- a/packages/audioplayers/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme +++ b/packages/audioplayers/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme @@ -1,6 +1,6 @@ + + + + Date: Mon, 25 Sep 2023 08:43:27 +0200 Subject: [PATCH 20/20] recreate macos folder --- .../audioplayers/example/macos/.gitignore | 1 + .../macos/Flutter/Flutter-Debug.xcconfig | 2 +- .../macos/Flutter/Flutter-Release.xcconfig | 2 +- packages/audioplayers/example/macos/Podfile | 3 + .../audioplayers/example/macos/Podfile.lock | 2 +- .../macos/Runner.xcodeproj/project.pbxproj | 256 ++++++++++++++---- .../xcshareddata/xcschemes/Runner.xcscheme | 21 +- .../macos/Runner/Base.lproj/MainMenu.xib | 4 + .../macos/Runner/Configs/AppInfo.xcconfig | 2 +- .../macos/Runner/MainFlutterWindow.swift | 2 +- 10 files changed, 224 insertions(+), 71 deletions(-) diff --git a/packages/audioplayers/example/macos/.gitignore b/packages/audioplayers/example/macos/.gitignore index d2fd37723..746adbb6b 100644 --- a/packages/audioplayers/example/macos/.gitignore +++ b/packages/audioplayers/example/macos/.gitignore @@ -3,4 +3,5 @@ **/Pods/ # Xcode-related +**/dgph **/xcuserdata/ diff --git a/packages/audioplayers/example/macos/Flutter/Flutter-Debug.xcconfig b/packages/audioplayers/example/macos/Flutter/Flutter-Debug.xcconfig index 785633d3a..4b81f9b2d 100644 --- a/packages/audioplayers/example/macos/Flutter/Flutter-Debug.xcconfig +++ b/packages/audioplayers/example/macos/Flutter/Flutter-Debug.xcconfig @@ -1,2 +1,2 @@ -#include "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" +#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" #include "ephemeral/Flutter-Generated.xcconfig" diff --git a/packages/audioplayers/example/macos/Flutter/Flutter-Release.xcconfig b/packages/audioplayers/example/macos/Flutter/Flutter-Release.xcconfig index 5fba960c3..5caa9d157 100644 --- a/packages/audioplayers/example/macos/Flutter/Flutter-Release.xcconfig +++ b/packages/audioplayers/example/macos/Flutter/Flutter-Release.xcconfig @@ -1,2 +1,2 @@ -#include "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" +#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" #include "ephemeral/Flutter-Generated.xcconfig" diff --git a/packages/audioplayers/example/macos/Podfile b/packages/audioplayers/example/macos/Podfile index 049abe295..c795730db 100644 --- a/packages/audioplayers/example/macos/Podfile +++ b/packages/audioplayers/example/macos/Podfile @@ -31,6 +31,9 @@ target 'Runner' do use_modular_headers! flutter_install_all_macos_pods File.dirname(File.realpath(__FILE__)) + target 'RunnerTests' do + inherit! :search_paths + end end post_install do |installer| diff --git a/packages/audioplayers/example/macos/Podfile.lock b/packages/audioplayers/example/macos/Podfile.lock index 3b27abfe6..847fa18bb 100644 --- a/packages/audioplayers/example/macos/Podfile.lock +++ b/packages/audioplayers/example/macos/Podfile.lock @@ -24,6 +24,6 @@ SPEC CHECKSUMS: FlutterMacOS: 8f6f14fa908a6fb3fba0cd85dbd81ec4b251fb24 path_provider_foundation: 29f094ae23ebbca9d3d0cec13889cd9060c0e943 -PODFILE CHECKSUM: 353c8bcc5d5b0994e508d035b5431cfe18c1dea7 +PODFILE CHECKSUM: 236401fc2c932af29a9fcf0e97baeeb2d750d367 COCOAPODS: 1.12.1 diff --git a/packages/audioplayers/example/macos/Runner.xcodeproj/project.pbxproj b/packages/audioplayers/example/macos/Runner.xcodeproj/project.pbxproj index 773565436..25d6e05c2 100644 --- a/packages/audioplayers/example/macos/Runner.xcodeproj/project.pbxproj +++ b/packages/audioplayers/example/macos/Runner.xcodeproj/project.pbxproj @@ -21,15 +21,24 @@ /* End PBXAggregateTarget section */ /* Begin PBXBuildFile section */ - 1CFF2593EC4F7D036CDEEE23 /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 63DD5086589C7A5450A5F49A /* Pods_Runner.framework */; }; + 331C80D8294CF71000263BE5 /* RunnerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 331C80D7294CF71000263BE5 /* RunnerTests.swift */; }; 335BBD1B22A9A15E00E9071D /* GeneratedPluginRegistrant.swift in Sources */ = {isa = PBXBuildFile; fileRef = 335BBD1A22A9A15E00E9071D /* GeneratedPluginRegistrant.swift */; }; 33CC10F12044A3C60003C045 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 33CC10F02044A3C60003C045 /* AppDelegate.swift */; }; 33CC10F32044A3C60003C045 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 33CC10F22044A3C60003C045 /* Assets.xcassets */; }; 33CC10F62044A3C60003C045 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 33CC10F42044A3C60003C045 /* MainMenu.xib */; }; 33CC11132044BFA00003C045 /* MainFlutterWindow.swift in Sources */ = {isa = PBXBuildFile; fileRef = 33CC11122044BFA00003C045 /* MainFlutterWindow.swift */; }; + 372711C1D236634A4401FADB /* Pods_RunnerTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F801C37C79F366B79C507101 /* Pods_RunnerTests.framework */; }; + FA773D3D6D523833050287A7 /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B5A6A4CB122231797A4E4FFA /* Pods_Runner.framework */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ + 331C80D9294CF71000263BE5 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 33CC10E52044A3C60003C045 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 33CC10EC2044A3C60003C045; + remoteInfo = Runner; + }; 33CC111F2044C79F0003C045 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 33CC10E52044A3C60003C045 /* Project object */; @@ -53,9 +62,11 @@ /* End PBXCopyFilesBuildPhase section */ /* Begin PBXFileReference section */ + 331C80D5294CF71000263BE5 /* RunnerTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = RunnerTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; + 331C80D7294CF71000263BE5 /* RunnerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RunnerTests.swift; sourceTree = ""; }; 333000ED22D3DE5D00554162 /* Warnings.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Warnings.xcconfig; sourceTree = ""; }; 335BBD1A22A9A15E00E9071D /* GeneratedPluginRegistrant.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GeneratedPluginRegistrant.swift; sourceTree = ""; }; - 33CC10ED2044A3C60003C045 /* AudioPlayers Example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "AudioPlayers Example.app"; sourceTree = BUILT_PRODUCTS_DIR; }; + 33CC10ED2044A3C60003C045 /* audioplayers_example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "audioplayers_example.app"; sourceTree = BUILT_PRODUCTS_DIR; }; 33CC10F02044A3C60003C045 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 33CC10F22044A3C60003C045 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Assets.xcassets; path = Runner/Assets.xcassets; sourceTree = ""; }; 33CC10F52044A3C60003C045 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/MainMenu.xib; sourceTree = ""; }; @@ -67,26 +78,60 @@ 33E51913231747F40026EE4D /* DebugProfile.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = DebugProfile.entitlements; sourceTree = ""; }; 33E51914231749380026EE4D /* Release.entitlements */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.entitlements; path = Release.entitlements; sourceTree = ""; }; 33E5194F232828860026EE4D /* AppInfo.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = AppInfo.xcconfig; sourceTree = ""; }; - 63DD5086589C7A5450A5F49A /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Release.xcconfig; sourceTree = ""; }; 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Debug.xcconfig; sourceTree = ""; }; - AE29A370CDF6BEBDA60333C1 /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = ""; }; - D7059FDE42F995B3D35E68A8 /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = ""; }; - FDD10DC00EB8DEE530B505B7 /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = ""; }; + 9BE4B456FA7D243E3BA1A356 /* Pods-RunnerTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.debug.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.debug.xcconfig"; sourceTree = ""; }; + 9F3D173F9AC6A8F2FC038294 /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = ""; }; + ADDA3CA2979E37EBCE017DDF /* Pods-RunnerTests.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.profile.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.profile.xcconfig"; sourceTree = ""; }; + B5A6A4CB122231797A4E4FFA /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + C833DA01AA1197E82E1027EB /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = ""; }; + E9F75D3BCD6872AD5A6C69D2 /* Pods-RunnerTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.release.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.release.xcconfig"; sourceTree = ""; }; + EC18ACC3DA86C71E57BE5578 /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = ""; }; + F801C37C79F366B79C507101 /* Pods_RunnerTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_RunnerTests.framework; sourceTree = BUILT_PRODUCTS_DIR; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ + 331C80D2294CF70F00263BE5 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 372711C1D236634A4401FADB /* Pods_RunnerTests.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; 33CC10EA2044A3C60003C045 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 1CFF2593EC4F7D036CDEEE23 /* Pods_Runner.framework in Frameworks */, + FA773D3D6D523833050287A7 /* Pods_Runner.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ + 0E79D146C8DCC0B1993D7456 /* Pods */ = { + isa = PBXGroup; + children = ( + C833DA01AA1197E82E1027EB /* Pods-Runner.debug.xcconfig */, + 9F3D173F9AC6A8F2FC038294 /* Pods-Runner.release.xcconfig */, + EC18ACC3DA86C71E57BE5578 /* Pods-Runner.profile.xcconfig */, + 9BE4B456FA7D243E3BA1A356 /* Pods-RunnerTests.debug.xcconfig */, + E9F75D3BCD6872AD5A6C69D2 /* Pods-RunnerTests.release.xcconfig */, + ADDA3CA2979E37EBCE017DDF /* Pods-RunnerTests.profile.xcconfig */, + ); + name = Pods; + path = Pods; + sourceTree = ""; + }; + 331C80D6294CF71000263BE5 /* RunnerTests */ = { + isa = PBXGroup; + children = ( + 331C80D7294CF71000263BE5 /* RunnerTests.swift */, + ); + path = RunnerTests; + sourceTree = ""; + }; 33BA886A226E78AF003329D5 /* Configs */ = { isa = PBXGroup; children = ( @@ -103,16 +148,18 @@ children = ( 33FAB671232836740065AC1E /* Runner */, 33CEB47122A05771004F2AC0 /* Flutter */, + 331C80D6294CF71000263BE5 /* RunnerTests */, 33CC10EE2044A3C60003C045 /* Products */, D73912EC22F37F3D000D13A0 /* Frameworks */, - 4EE09F690BFE2EDC6B8A0655 /* Pods */, + 0E79D146C8DCC0B1993D7456 /* Pods */, ); sourceTree = ""; }; 33CC10EE2044A3C60003C045 /* Products */ = { isa = PBXGroup; children = ( - 33CC10ED2044A3C60003C045 /* AudioPlayers Example.app */, + 33CC10ED2044A3C60003C045 /* audioplayers_example.app */, + 331C80D5294CF71000263BE5 /* RunnerTests.xctest */, ); name = Products; sourceTree = ""; @@ -152,20 +199,11 @@ path = Runner; sourceTree = ""; }; - 4EE09F690BFE2EDC6B8A0655 /* Pods */ = { - isa = PBXGroup; - children = ( - AE29A370CDF6BEBDA60333C1 /* Pods-Runner.debug.xcconfig */, - FDD10DC00EB8DEE530B505B7 /* Pods-Runner.release.xcconfig */, - D7059FDE42F995B3D35E68A8 /* Pods-Runner.profile.xcconfig */, - ); - path = Pods; - sourceTree = ""; - }; D73912EC22F37F3D000D13A0 /* Frameworks */ = { isa = PBXGroup; children = ( - 63DD5086589C7A5450A5F49A /* Pods_Runner.framework */, + B5A6A4CB122231797A4E4FFA /* Pods_Runner.framework */, + F801C37C79F366B79C507101 /* Pods_RunnerTests.framework */, ); name = Frameworks; sourceTree = ""; @@ -173,17 +211,36 @@ /* End PBXGroup section */ /* Begin PBXNativeTarget section */ + 331C80D4294CF70F00263BE5 /* RunnerTests */ = { + isa = PBXNativeTarget; + buildConfigurationList = 331C80DE294CF71000263BE5 /* Build configuration list for PBXNativeTarget "RunnerTests" */; + buildPhases = ( + 12421805FEDCB14FDA7E721D /* [CP] Check Pods Manifest.lock */, + 331C80D1294CF70F00263BE5 /* Sources */, + 331C80D2294CF70F00263BE5 /* Frameworks */, + 331C80D3294CF70F00263BE5 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + 331C80DA294CF71000263BE5 /* PBXTargetDependency */, + ); + name = RunnerTests; + productName = RunnerTests; + productReference = 331C80D5294CF71000263BE5 /* RunnerTests.xctest */; + productType = "com.apple.product-type.bundle.unit-test"; + }; 33CC10EC2044A3C60003C045 /* Runner */ = { isa = PBXNativeTarget; buildConfigurationList = 33CC10FB2044A3C60003C045 /* Build configuration list for PBXNativeTarget "Runner" */; buildPhases = ( - 78086EAC071DDF78C3B7D9FA /* [CP] Check Pods Manifest.lock */, + 5C679570F087B148047874FE /* [CP] Check Pods Manifest.lock */, 33CC10E92044A3C60003C045 /* Sources */, 33CC10EA2044A3C60003C045 /* Frameworks */, 33CC10EB2044A3C60003C045 /* Resources */, 33CC110E2044A8840003C045 /* Bundle Framework */, 3399D490228B24CF009A79C7 /* ShellScript */, - BBAB6A286DD0AF4BFA652E76 /* [CP] Embed Pods Frameworks */, + 35A821EC52254DAC87835082 /* [CP] Embed Pods Frameworks */, ); buildRules = ( ); @@ -192,7 +249,7 @@ ); name = Runner; productName = Runner; - productReference = 33CC10ED2044A3C60003C045 /* AudioPlayers Example.app */; + productReference = 33CC10ED2044A3C60003C045 /* audioplayers_example.app */; productType = "com.apple.product-type.application"; }; /* End PBXNativeTarget section */ @@ -202,9 +259,13 @@ isa = PBXProject; attributes = { LastSwiftUpdateCheck = 0920; - LastUpgradeCheck = 1300; - ORGANIZATIONNAME = "The Flutter Authors"; + LastUpgradeCheck = 1430; + ORGANIZATIONNAME = "Blue Fire"; TargetAttributes = { + 331C80D4294CF70F00263BE5 = { + CreatedOnToolsVersion = 14.0; + TestTargetID = 33CC10EC2044A3C60003C045; + }; 33CC10EC2044A3C60003C045 = { CreatedOnToolsVersion = 9.2; LastSwiftMigration = 1100; @@ -222,7 +283,7 @@ }; }; buildConfigurationList = 33CC10E82044A3C60003C045 /* Build configuration list for PBXProject "Runner" */; - compatibilityVersion = "Xcode 8.0"; + compatibilityVersion = "Xcode 9.3"; developmentRegion = en; hasScannedForEncodings = 0; knownRegions = ( @@ -235,12 +296,20 @@ projectRoot = ""; targets = ( 33CC10EC2044A3C60003C045 /* Runner */, + 331C80D4294CF70F00263BE5 /* RunnerTests */, 33CC111A2044C6BA0003C045 /* Flutter Assemble */, ); }; /* End PBXProject section */ /* Begin PBXResourcesBuildPhase section */ + 331C80D3294CF70F00263BE5 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; 33CC10EB2044A3C60003C045 /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; @@ -253,6 +322,28 @@ /* End PBXResourcesBuildPhase section */ /* Begin PBXShellScriptBuildPhase section */ + 12421805FEDCB14FDA7E721D /* [CP] Check Pods Manifest.lock */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", + ); + name = "[CP] Check Pods Manifest.lock"; + outputFileListPaths = ( + ); + outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-RunnerTests-checkManifestLockResult.txt", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; + showEnvVarsInLog = 0; + }; 3399D490228B24CF009A79C7 /* ShellScript */ = { isa = PBXShellScriptBuildPhase; alwaysOutOfDate = 1; @@ -291,51 +382,56 @@ shellPath = /bin/sh; shellScript = "\"$FLUTTER_ROOT\"/packages/flutter_tools/bin/macos_assemble.sh && touch Flutter/ephemeral/tripwire"; }; - 78086EAC071DDF78C3B7D9FA /* [CP] Check Pods Manifest.lock */ = { + 35A821EC52254DAC87835082 /* [CP] Embed Pods Frameworks */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); inputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-input-files.xcfilelist", ); - inputPaths = ( - "${PODS_PODFILE_DIR_PATH}/Podfile.lock", - "${PODS_ROOT}/Manifest.lock", - ); - name = "[CP] Check Pods Manifest.lock"; + name = "[CP] Embed Pods Frameworks"; outputFileListPaths = ( - ); - outputPaths = ( - "$(DERIVED_FILE_DIR)/Pods-Runner-checkManifestLockResult.txt", + "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-output-files.xcfilelist", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n"; showEnvVarsInLog = 0; }; - BBAB6A286DD0AF4BFA652E76 /* [CP] Embed Pods Frameworks */ = { + 5C679570F087B148047874FE /* [CP] Check Pods Manifest.lock */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); + inputFileListPaths = ( + ); inputPaths = ( - "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh", - "${BUILT_PRODUCTS_DIR}/audioplayers_darwin/audioplayers_darwin.framework", - "${BUILT_PRODUCTS_DIR}/path_provider_foundation/path_provider_foundation.framework", + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", + ); + name = "[CP] Check Pods Manifest.lock"; + outputFileListPaths = ( ); - name = "[CP] Embed Pods Frameworks"; outputPaths = ( - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/audioplayers_darwin.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/path_provider_foundation.framework", + "$(DERIVED_FILE_DIR)/Pods-Runner-checkManifestLockResult.txt", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n"; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; showEnvVarsInLog = 0; }; /* End PBXShellScriptBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ + 331C80D1294CF70F00263BE5 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 331C80D8294CF71000263BE5 /* RunnerTests.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; 33CC10E92044A3C60003C045 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; @@ -349,6 +445,11 @@ /* End PBXSourcesBuildPhase section */ /* Begin PBXTargetDependency section */ + 331C80DA294CF71000263BE5 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 33CC10EC2044A3C60003C045 /* Runner */; + targetProxy = 331C80D9294CF71000263BE5 /* PBXContainerItemProxy */; + }; 33CC11202044C79F0003C045 /* PBXTargetDependency */ = { isa = PBXTargetDependency; target = 33CC111A2044C6BA0003C045 /* Flutter Assemble */; @@ -369,6 +470,51 @@ /* End PBXVariantGroup section */ /* Begin XCBuildConfiguration section */ + 331C80DB294CF71000263BE5 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 9BE4B456FA7D243E3BA1A356 /* Pods-RunnerTests.debug.xcconfig */; + buildSettings = { + BUNDLE_LOADER = "$(TEST_HOST)"; + CURRENT_PROJECT_VERSION = 1; + GENERATE_INFOPLIST_FILE = YES; + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = xyz.luan.audioplayers.example.RunnerTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 5.0; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/example.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/example"; + }; + name = Debug; + }; + 331C80DC294CF71000263BE5 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = E9F75D3BCD6872AD5A6C69D2 /* Pods-RunnerTests.release.xcconfig */; + buildSettings = { + BUNDLE_LOADER = "$(TEST_HOST)"; + CURRENT_PROJECT_VERSION = 1; + GENERATE_INFOPLIST_FILE = YES; + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = xyz.luan.audioplayers.example.RunnerTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 5.0; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/example.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/example"; + }; + name = Release; + }; + 331C80DD294CF71000263BE5 /* Profile */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = ADDA3CA2979E37EBCE017DDF /* Pods-RunnerTests.profile.xcconfig */; + buildSettings = { + BUNDLE_LOADER = "$(TEST_HOST)"; + CURRENT_PROJECT_VERSION = 1; + GENERATE_INFOPLIST_FILE = YES; + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = xyz.luan.audioplayers.example.RunnerTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 5.0; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/example.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/example"; + }; + name = Profile; + }; 338D0CE9231458BD00FA5F75 /* Profile */ = { isa = XCBuildConfiguration; baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; @@ -424,10 +570,6 @@ CODE_SIGN_ENTITLEMENTS = Runner/DebugProfile.entitlements; CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; - FRAMEWORK_SEARCH_PATHS = ( - "$(inherited)", - "$(PROJECT_DIR)/Flutter/ephemeral", - ); INFOPLIST_FILE = Runner/Info.plist; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", @@ -554,10 +696,6 @@ CODE_SIGN_ENTITLEMENTS = Runner/DebugProfile.entitlements; CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; - FRAMEWORK_SEARCH_PATHS = ( - "$(inherited)", - "$(PROJECT_DIR)/Flutter/ephemeral", - ); INFOPLIST_FILE = Runner/Info.plist; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", @@ -578,10 +716,6 @@ CODE_SIGN_ENTITLEMENTS = Runner/Release.entitlements; CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; - FRAMEWORK_SEARCH_PATHS = ( - "$(inherited)", - "$(PROJECT_DIR)/Flutter/ephemeral", - ); INFOPLIST_FILE = Runner/Info.plist; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", @@ -611,6 +745,16 @@ /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ + 331C80DE294CF71000263BE5 /* Build configuration list for PBXNativeTarget "RunnerTests" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 331C80DB294CF71000263BE5 /* Debug */, + 331C80DC294CF71000263BE5 /* Release */, + 331C80DD294CF71000263BE5 /* Profile */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; 33CC10E82044A3C60003C045 /* Build configuration list for PBXProject "Runner" */ = { isa = XCConfigurationList; buildConfigurations = ( diff --git a/packages/audioplayers/example/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/packages/audioplayers/example/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme index 93f896b3e..7ae990719 100644 --- a/packages/audioplayers/example/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme +++ b/packages/audioplayers/example/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme @@ -1,6 +1,6 @@ @@ -31,19 +31,20 @@ + skipped = "NO" + parallelizable = "YES"> @@ -64,14 +65,14 @@ diff --git a/packages/audioplayers/example/macos/Runner/Base.lproj/MainMenu.xib b/packages/audioplayers/example/macos/Runner/Base.lproj/MainMenu.xib index 537341abf..80e867a4e 100644 --- a/packages/audioplayers/example/macos/Runner/Base.lproj/MainMenu.xib +++ b/packages/audioplayers/example/macos/Runner/Base.lproj/MainMenu.xib @@ -323,6 +323,10 @@ + + + + diff --git a/packages/audioplayers/example/macos/Runner/Configs/AppInfo.xcconfig b/packages/audioplayers/example/macos/Runner/Configs/AppInfo.xcconfig index 30e4c2530..c74856f0a 100644 --- a/packages/audioplayers/example/macos/Runner/Configs/AppInfo.xcconfig +++ b/packages/audioplayers/example/macos/Runner/Configs/AppInfo.xcconfig @@ -11,4 +11,4 @@ PRODUCT_NAME = AudioPlayers Example PRODUCT_BUNDLE_IDENTIFIER = xyz.luan.audioplayers.example // The copyright displayed in application information -PRODUCT_COPYRIGHT = Copyright © 2020 xyz.luan.audioplayers. All rights reserved. +PRODUCT_COPYRIGHT = Copyright © 2023 xyz.luan.audioplayers. All rights reserved. diff --git a/packages/audioplayers/example/macos/Runner/MainFlutterWindow.swift b/packages/audioplayers/example/macos/Runner/MainFlutterWindow.swift index 2722837ec..3cc05eb23 100644 --- a/packages/audioplayers/example/macos/Runner/MainFlutterWindow.swift +++ b/packages/audioplayers/example/macos/Runner/MainFlutterWindow.swift @@ -3,7 +3,7 @@ import FlutterMacOS class MainFlutterWindow: NSWindow { override func awakeFromNib() { - let flutterViewController = FlutterViewController.init() + let flutterViewController = FlutterViewController() let windowFrame = self.frame self.contentViewController = flutterViewController self.setFrame(windowFrame, display: true)