Compare commits

...

3 Commits

Author SHA1 Message Date
tanhakabir 27d5ce4f03 fix error 2021-08-16 21:04:23 -07:00
tanhakabir 3f93bd1a86 Release 6.3.1 2021-08-16 19:52:35 -07:00
tanhakabir 20c0253f68 Fix documentation 2021-08-16 19:52:15 -07:00
5 changed files with 25 additions and 25 deletions
+1
View File
@@ -239,5 +239,6 @@ class AudioEngine: AudioEngineProtocol {
if let audioModifiers = audioModifiers, audioModifiers.count > 0 {
audioModifiers.forEach { engine.detach($0) }
}
Log.info("invalidated engine for key \(key)")
}
}
+2 -2
View File
@@ -527,9 +527,9 @@ extension SAPlayer {
}
/**
Remove the first queued audio if one exists. Receive the first URL removed back.
Clear the list of queued audio.
- Returns the URL of the removed audio.
- Returns the list of removed audio URLs
*/
public func clearAllQueuedAudio() -> [URL] {
return presenter.handleClearQueued()
+6 -6
View File
@@ -55,10 +55,10 @@ public struct SALockScreenInfo {
Use to add audio to be queued for playback.
*/
public struct SAAudioQueueItem {
var loc: Location
var url: URL
var mediaInfo: SALockScreenInfo?
var bitrate: SAPlayerBitrate
public var loc: Location
public var url: URL
public var mediaInfo: SALockScreenInfo?
public var bitrate: SAPlayerBitrate
/**
Use to add audio to be queued for playback.
@@ -68,7 +68,7 @@ public struct SAAudioQueueItem {
- Parameter mediaInfo: Relevant lockscreen media info for the queued audio.
- Parameter bitrate: For streamed remote audio specifiy a bitrate if different from high. Use low bitrate for radio streams.
*/
init(loc: Location, url: URL, mediaInfo: SALockScreenInfo?, bitrate: SAPlayerBitrate = .high) {
public init(loc: Location, url: URL, mediaInfo: SALockScreenInfo?, bitrate: SAPlayerBitrate = .high) {
self.loc = loc
self.url = url
self.mediaInfo = mediaInfo
@@ -78,7 +78,7 @@ public struct SAAudioQueueItem {
/**
Where the queued audio is sourced. Remote to be streamed or locally saved on device.
*/
enum Location {
public enum Location {
case remote
case saved
}
+15 -16
View File
@@ -144,13 +144,16 @@ class SAPlayerPresenter {
return
}
self.isPlaying = isPlaying
if(self.isPlaying == .paused && self.shouldPlayImmediately) {
if(isPlaying == .paused && self.shouldPlayImmediately) {
self.shouldPlayImmediately = false
self.handlePlay()
}
// solves bug nil == owningEngine || GetEngine() == owningEngine where too many
// ended statuses were notified to cause 2 engines to be initialized and causes an error.
guard isPlaying != self.isPlaying else { return }
self.isPlaying = isPlaying
if(self.isPlaying == .ended) {
self.playNextAudioIfExists()
}
@@ -246,19 +249,15 @@ extension SAPlayerPresenter {
delegate?.mediaInfo = nextAudioURL.mediaInfo
// We need to give a second to clean up the previous engine properly. Deinit takes some time.
Timer.scheduledTimer(withTimeInterval: 1.0, repeats: false) { [weak self] (_) in
guard let self = self else { return }
switch nextAudioURL.loc {
case .remote:
self.handlePlayStreamedAudio(withRemoteUrl: nextAudioURL.url, bitrate: nextAudioURL.bitrate)
break
case .saved:
self.handlePlaySavedAudio(withSavedUrl: nextAudioURL.url)
}
self.shouldPlayImmediately = true
switch nextAudioURL.loc {
case .remote:
handlePlayStreamedAudio(withRemoteUrl: nextAudioURL.url, bitrate: nextAudioURL.bitrate)
break
case .saved:
handlePlaySavedAudio(withSavedUrl: nextAudioURL.url)
break
}
shouldPlayImmediately = true
}
}
+1 -1
View File
@@ -8,7 +8,7 @@
Pod::Spec.new do |s|
s.name = 'SwiftAudioPlayer'
s.version = '6.3.0'
s.version = '6.3.1'
s.summary = 'SwiftAudioPlayer is a Swift based audio player that can handle streaming from a remote location and audio manipulation.'
# This description is used to generate tags and improve search results.