diff --git a/Example/SwiftAudio.xcodeproj/project.pbxproj b/Example/SwiftAudio.xcodeproj/project.pbxproj index 03658e9..f28568e 100644 --- a/Example/SwiftAudio.xcodeproj/project.pbxproj +++ b/Example/SwiftAudio.xcodeproj/project.pbxproj @@ -306,7 +306,7 @@ TargetAttributes = { 607FACCF1AFB9204008FA782 = { CreatedOnToolsVersion = 6.3.1; - DevelopmentTeam = HPNZWPB9JK; + DevelopmentTeam = H9Y26B6GZB; LastSwiftMigration = 1020; SystemCapabilities = { com.apple.BackgroundModes = { @@ -316,7 +316,7 @@ }; 607FACE41AFB9204008FA782 = { CreatedOnToolsVersion = 6.3.1; - DevelopmentTeam = HPNZWPB9JK; + DevelopmentTeam = H9Y26B6GZB; LastSwiftMigration = 1020; TestTargetID = 607FACCF1AFB9204008FA782; }; @@ -623,12 +623,12 @@ baseConfigurationReference = C344B34C66182CD1C5AD6DD2 /* Pods-SwiftAudio_Example.debug.xcconfig */; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - DEVELOPMENT_TEAM = HPNZWPB9JK; + DEVELOPMENT_TEAM = H9Y26B6GZB; INFOPLIST_FILE = SwiftAudio/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 10.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; MODULE_NAME = ExampleApp; - PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.demo.$(PRODUCT_NAME:rfc1034identifier)"; + PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.demo.SwiftAudio-Example-jan"; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = 1; @@ -640,12 +640,12 @@ baseConfigurationReference = CAD65BC49F7B60C24AB20FDA /* Pods-SwiftAudio_Example.release.xcconfig */; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - DEVELOPMENT_TEAM = HPNZWPB9JK; + DEVELOPMENT_TEAM = H9Y26B6GZB; INFOPLIST_FILE = SwiftAudio/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 10.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; MODULE_NAME = ExampleApp; - PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.demo.$(PRODUCT_NAME:rfc1034identifier)"; + PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.demo.SwiftAudio-Example-jan"; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = 1; @@ -656,7 +656,7 @@ isa = XCBuildConfiguration; baseConfigurationReference = 521F3AEC1228A2FA2637355F /* Pods-SwiftAudio_Tests.debug.xcconfig */; buildSettings = { - DEVELOPMENT_TEAM = HPNZWPB9JK; + DEVELOPMENT_TEAM = H9Y26B6GZB; FRAMEWORK_SEARCH_PATHS = ( "$(SDKROOT)/Developer/Library/Frameworks", "$(inherited)", @@ -678,7 +678,7 @@ isa = XCBuildConfiguration; baseConfigurationReference = C4C4423F4BAFCE03507BC386 /* Pods-SwiftAudio_Tests.release.xcconfig */; buildSettings = { - DEVELOPMENT_TEAM = HPNZWPB9JK; + DEVELOPMENT_TEAM = H9Y26B6GZB; FRAMEWORK_SEARCH_PATHS = ( "$(SDKROOT)/Developer/Library/Frameworks", "$(inherited)", diff --git a/Example/SwiftAudio/AudioController.swift b/Example/SwiftAudio/AudioController.swift index 9426bdc..f01b972 100644 --- a/Example/SwiftAudio/AudioController.swift +++ b/Example/SwiftAudio/AudioController.swift @@ -20,7 +20,8 @@ class AudioController { DefaultAudioItem(audioUrl: "https://p.scdn.co/mp3-preview/67b51d90ffddd6bb3f095059997021b589845f81?cid=d8a5ed958d274c2e8ee717e6a4b0971d", artist: "Bon Iver", title: "33 \"GOD\"", albumTitle: "22, A Million", sourceType: .stream, artwork: #imageLiteral(resourceName: "22AMI")), DefaultAudioItem(audioUrl: "https://p.scdn.co/mp3-preview/081447adc23dad4f79ba4f1082615d1c56edf5e1?cid=d8a5ed958d274c2e8ee717e6a4b0971d", artist: "Bon Iver", title: "8 (circle)", albumTitle: "22, A Million", sourceType: .stream, artwork: #imageLiteral(resourceName: "22AMI")), DefaultAudioItem(audioUrl: "https://p.scdn.co/mp3-preview/6f9999d909b017eabef97234dd7a206355720d9d?cid=d8a5ed958d274c2e8ee717e6a4b0971d", artist: "Bon Iver", title: "715 - CRΣΣKS", albumTitle: "22, A Million", sourceType: .stream, artwork: #imageLiteral(resourceName: "22AMI")), - DefaultAudioItem(audioUrl: "https://p.scdn.co/mp3-preview/bf9bdd403c67fdbe06a582e7b292487c8cfd1f7e?cid=d8a5ed958d274c2e8ee717e6a4b0971d", artist: "Bon Iver", title: "____45_____", albumTitle: "22, A Million", sourceType: .stream, artwork: #imageLiteral(resourceName: "22AMI")) + DefaultAudioItem(audioUrl: "https://p.scdn.co/mp3-preview/bf9bdd403c67fdbe06a582e7b292487c8cfd1f7e?cid=d8a5ed958d274c2e8ee717e6a4b0971d", artist: "Bon Iver", title: "____45_____", albumTitle: "22, A Million", sourceType: .stream, artwork: #imageLiteral(resourceName: "22AMI")), + DefaultAudioItem(audioUrl: "https://www.eclassical.com/custom/eclassical/files/BIS1447-002-flac_24.flac", artist: "Unknow Artist", title: "Unknow Title", albumTitle: "Unknow Album Title", sourceType: .stream, artwork: #imageLiteral(resourceName: "22AMI")) ] init() { diff --git a/SwiftAudio/Classes/AVPlayerWrapper/AVPlayerWrapper.swift b/SwiftAudio/Classes/AVPlayerWrapper/AVPlayerWrapper.swift index d17c936..e27b3d4 100755 --- a/SwiftAudio/Classes/AVPlayerWrapper/AVPlayerWrapper.swift +++ b/SwiftAudio/Classes/AVPlayerWrapper/AVPlayerWrapper.swift @@ -136,6 +136,14 @@ class AVPlayerWrapper: AVPlayerWrapperProtocol { avPlayer.play() } + func playImmediately(){ + if rate == 0 { + avPlayer.playImmediately(atRate: 1.0) + } else { + avPlayer.playImmediately(atRate: rate) + } + } + func pause() { avPlayer.pause() } diff --git a/SwiftAudio/Classes/AVPlayerWrapper/AVPlayerWrapperProtocol.swift b/SwiftAudio/Classes/AVPlayerWrapper/AVPlayerWrapperProtocol.swift index d541ddf..030e4a4 100755 --- a/SwiftAudio/Classes/AVPlayerWrapper/AVPlayerWrapperProtocol.swift +++ b/SwiftAudio/Classes/AVPlayerWrapper/AVPlayerWrapperProtocol.swift @@ -41,6 +41,8 @@ protocol AVPlayerWrapperProtocol: class { func play() + func playImmediately() + func pause() func togglePlaying() diff --git a/SwiftAudio/Classes/AudioPlayer.swift b/SwiftAudio/Classes/AudioPlayer.swift index cf551a2..0491210 100755 --- a/SwiftAudio/Classes/AudioPlayer.swift +++ b/SwiftAudio/Classes/AudioPlayer.swift @@ -186,6 +186,13 @@ public class AudioPlayer: AVPlayerWrapperDelegate { self.wrapper.play() } + /** + Start playback immediately + */ + public func playImmediately(){ + self.wrapper.playImmediately() + } + /** Pause playback */