Commit 3c37240a by SunARcTech2

form changes

parent e9be7a5f
No preview for this file type
...@@ -2124,6 +2124,9 @@ ...@@ -2124,6 +2124,9 @@
LastSwiftMigration = 0920; LastSwiftMigration = 0920;
ProvisioningStyle = Manual; ProvisioningStyle = Manual;
SystemCapabilities = { SystemCapabilities = {
com.apple.BackgroundModes = {
enabled = 1;
};
com.apple.Push = { com.apple.Push = {
enabled = 1; enabled = 1;
}; };
...@@ -2919,7 +2922,7 @@ ...@@ -2919,7 +2922,7 @@
CODE_SIGN_STYLE = Manual; CODE_SIGN_STYLE = Manual;
DEVELOPMENT_TEAM = AY4776L6L2; DEVELOPMENT_TEAM = AY4776L6L2;
INFOPLIST_FILE = Bhagyashree/Info.plist; INFOPLIST_FILE = Bhagyashree/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 10.0; IPHONEOS_DEPLOYMENT_TARGET = 11.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.gdi.yuanzhongsiuseller; PRODUCT_BUNDLE_IDENTIFIER = com.gdi.yuanzhongsiuseller;
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
...@@ -2944,7 +2947,7 @@ ...@@ -2944,7 +2947,7 @@
CODE_SIGN_STYLE = Manual; CODE_SIGN_STYLE = Manual;
DEVELOPMENT_TEAM = AY4776L6L2; DEVELOPMENT_TEAM = AY4776L6L2;
INFOPLIST_FILE = Bhagyashree/Info.plist; INFOPLIST_FILE = Bhagyashree/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 10.0; IPHONEOS_DEPLOYMENT_TARGET = 11.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.gdi.yuanzhongsiuseller; PRODUCT_BUNDLE_IDENTIFIER = com.gdi.yuanzhongsiuseller;
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
......
...@@ -147,5 +147,21 @@ ...@@ -147,5 +147,21 @@
landmarkType = "7"> landmarkType = "7">
</BreakpointContent> </BreakpointContent>
</BreakpointProxy> </BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Bhagyashree/Sunarc/Other/Audio.swift"
timestampString = "561276157.105332"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "64"
endingLineNumber = "64"
landmarkName = "playAudio(audioPath:success:failure:progress:)"
landmarkType = "7">
</BreakpointContent>
</BreakpointProxy>
</Breakpoints> </Breakpoints>
</Bucket> </Bucket>
...@@ -4,6 +4,8 @@ ...@@ -4,6 +4,8 @@
<dict> <dict>
<key>CFBundleDevelopmentRegion</key> <key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string> <string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleDisplayName</key>
<string>iAstro(Master)</string>
<key>CFBundleExecutable</key> <key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string> <string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key> <key>CFBundleIdentifier</key>
...@@ -17,7 +19,7 @@ ...@@ -17,7 +19,7 @@
<key>CFBundleShortVersionString</key> <key>CFBundleShortVersionString</key>
<string>1.0</string> <string>1.0</string>
<key>CFBundleVersion</key> <key>CFBundleVersion</key>
<string>1</string> <string>4</string>
<key>Fabric</key> <key>Fabric</key>
<dict> <dict>
<key>APIKey</key> <key>APIKey</key>
...@@ -49,6 +51,11 @@ ...@@ -49,6 +51,11 @@
<string>Fengushi would like to access your photos for sharing</string> <string>Fengushi would like to access your photos for sharing</string>
<key>NSPhotoLibraryUsageDescription</key> <key>NSPhotoLibraryUsageDescription</key>
<string>Fengushi would like to access your photos for sharing</string> <string>Fengushi would like to access your photos for sharing</string>
<key>UIBackgroundModes</key>
<array>
<string>fetch</string>
<string>remote-notification</string>
</array>
<key>UILaunchStoryboardName</key> <key>UILaunchStoryboardName</key>
<string>LaunchScreen</string> <string>LaunchScreen</string>
<key>UIMainStoryboardFile</key> <key>UIMainStoryboardFile</key>
...@@ -60,7 +67,7 @@ ...@@ -60,7 +67,7 @@
<string>armv7</string> <string>armv7</string>
</array> </array>
<key>UIRequiresFullScreen</key> <key>UIRequiresFullScreen</key>
<false/> <true/>
<key>UIStatusBarStyle</key> <key>UIStatusBarStyle</key>
<string>UIStatusBarStyleLightContent</string> <string>UIStatusBarStyleLightContent</string>
<key>UISupportedInterfaceOrientations</key> <key>UISupportedInterfaceOrientations</key>
......
...@@ -43,11 +43,20 @@ class PlayAudioCell: UITableViewCell { ...@@ -43,11 +43,20 @@ class PlayAudioCell: UITableViewCell {
func playAudioFile() { func playAudioFile() {
Audio.playAudio(audioPath: audioRecording!.audioPath, success: {
self.audioRecording?.isPlaying = true Audio.playAudio(audioPath: audioRecording!.audioPath, success: { (max) in
}) { (errorMesaage) in print(max)
// TO DO: show tost }, failure: { (errorMessage) in
print(errorMessage)
}) { (current) in
print("current = \(current)")
} }
// Audio.playAudio(audioPath: audioRecording!.audioPath, success: {
// self.audioRecording?.isPlaying = true
// }) { (errorMesaage) in
// // TO DO: show tost
// }
} }
......
...@@ -473,11 +473,22 @@ class ResultAudioCell: UITableViewCell { ...@@ -473,11 +473,22 @@ class ResultAudioCell: UITableViewCell {
} }
if let audioPath = audioPath { if let audioPath = audioPath {
Audio.playAudio(audioPath: audioPath, success: {
Audio.playAudio(audioPath: audioPath, success: { (max) in
print("max = \(max)")
self.delegate?.playingAudioAtIndex(index: cellIndex) self.delegate?.playingAudioAtIndex(index: cellIndex)
}) { (errorMesssage) in }, failure: { (errorMessage) in
self.viewController()?.view.showToast(errorMesssage, position: .bottom, popTime: 2.0, dismissOnTap: false) print(errorMessage)
}) { (current) in
print("current = \(current)")
} }
// Audio.playAudio(audioPath: audioPath, success: {
// self.delegate?.playingAudioAtIndex(index: cellIndex)
// }) { (errorMesssage) in
// self.viewController()?.view.showToast(errorMesssage, position: .bottom, popTime: 2.0, dismissOnTap: false)
// }
} else { } else {
self.viewController()?.view.showToast("Audio missing", position: .bottom, popTime: 2.0, dismissOnTap: false) self.viewController()?.view.showToast("Audio missing", position: .bottom, popTime: 2.0, dismissOnTap: false)
} }
......
...@@ -351,11 +351,20 @@ class OnlineEnquiryMasterAudioCell: UITableViewCell { ...@@ -351,11 +351,20 @@ class OnlineEnquiryMasterAudioCell: UITableViewCell {
@IBAction func play() { @IBAction func play() {
if let audioPath = audioPath { if let audioPath = audioPath {
Audio.playAudio(audioPath: audioPath, success: {
Audio.playAudio(audioPath: audioPath, success: { (max) in
}) { (errorMesssage) in print("max = \(max)")
self.viewController()?.view.showToast(errorMesssage, position: .bottom, popTime: 2.0, dismissOnTap: false) }, failure: { (errorMessage) in
print(errorMessage)
}) { (current) in
print("current = \(current)")
} }
// Audio.playAudio(audioPath: audioPath, success: {
//
// }) { (errorMesssage) in
// self.viewController()?.view.showToast(errorMesssage, position: .bottom, popTime: 2.0, dismissOnTap: false)
// }
} else { } else {
self.viewController()?.view.showToast("Audio missing", position: .bottom, popTime: 2.0, dismissOnTap: false) self.viewController()?.view.showToast("Audio missing", position: .bottom, popTime: 2.0, dismissOnTap: false)
} }
...@@ -385,11 +394,20 @@ class OnlineEnquiryCustomerAudioCell: UITableViewCell { ...@@ -385,11 +394,20 @@ class OnlineEnquiryCustomerAudioCell: UITableViewCell {
@IBAction func play() { @IBAction func play() {
if let audioPath = audioPath { if let audioPath = audioPath {
Audio.playAudio(audioPath: audioPath, success: {
Audio.playAudio(audioPath: audioPath, success: { (max) in
}) { (errorMesssage) in print("Max = \(max)")
self.viewController()?.view.showToast(errorMesssage, position: .bottom, popTime: 2.0, dismissOnTap: false) }, failure: { (errorMessage) in
print(errorMessage)
}) { (current) in
print("current = \(current)")
} }
// Audio.playAudio(audioPath: audioPath, success: {
//
// }) { (errorMesssage) in
// self.viewController()?.view.showToast(errorMesssage, position: .bottom, popTime: 2.0, dismissOnTap: false)
// }
} else { } else {
self.viewController()?.view.showToast("Audio missing", position: .bottom, popTime: 2.0, dismissOnTap: false) self.viewController()?.view.showToast("Audio missing", position: .bottom, popTime: 2.0, dismissOnTap: false)
} }
......
...@@ -14,6 +14,7 @@ class Audio { ...@@ -14,6 +14,7 @@ class Audio {
var audioRecorder:AVAudioRecorder! var audioRecorder:AVAudioRecorder!
var audioPlayer: AVPlayer? var audioPlayer: AVPlayer?
var playerItem:AVPlayerItem?
var audioPlayerForLocalFile: AVAudioPlayer? var audioPlayerForLocalFile: AVAudioPlayer?
var currentRecordingPath: String? var currentRecordingPath: String?
static let shared = Audio() static let shared = Audio()
...@@ -58,7 +59,7 @@ class Audio { ...@@ -58,7 +59,7 @@ class Audio {
} }
class func playAudio(audioPath: String, success:() -> Void, failure: (_ message: String) -> Void) { class func playAudio(audioPath: String, success:(_ max: Float64) -> Void, failure: (_ message: String) -> Void, progress: @escaping (_ current: Float64) -> Void) {
if audioPath.first == "/" { // local file path if audioPath.first == "/" { // local file path
let audioURL = URL(fileURLWithPath: audioPath) let audioURL = URL(fileURLWithPath: audioPath)
...@@ -69,16 +70,31 @@ class Audio { ...@@ -69,16 +70,31 @@ class Audio {
try Audio.shared.audioPlayerForLocalFile = AVAudioPlayer(contentsOf: audioURL) try Audio.shared.audioPlayerForLocalFile = AVAudioPlayer(contentsOf: audioURL)
Audio.shared.audioPlayerForLocalFile!.prepareToPlay() Audio.shared.audioPlayerForLocalFile!.prepareToPlay()
Audio.shared.audioPlayerForLocalFile!.play() Audio.shared.audioPlayerForLocalFile!.play()
success() success(Audio.shared.audioPlayerForLocalFile!.duration)
Timer.scheduledTimer(withTimeInterval: 1.0, repeats: true) { (timer) in
progress(Audio.shared.audioPlayerForLocalFile!.currentTime)
}
} catch { } catch {
failure(error.localizedDescription) failure(error.localizedDescription)
} }
} else { // remote path } else { // remote path
let url = URL(string: audioPath) let url = URL(string: audioPath)
Audio.shared.audioPlayer = AVPlayer(url: url!) Audio.shared.playerItem = AVPlayerItem(url: url!)
Audio.shared.audioPlayer = AVPlayer(playerItem: Audio.shared.playerItem)
Audio.shared.audioPlayer?.play() Audio.shared.audioPlayer?.play()
success()
Audio.shared.audioPlayer!.addPeriodicTimeObserver(forInterval: CMTimeMakeWithSeconds(1, 1), queue: DispatchQueue.main) { (CMTime) -> Void in
progress(CMTimeGetSeconds(Audio.shared.audioPlayer!.currentTime()))
}
let duration : CMTime = Audio.shared.playerItem!.asset.duration
let maxSeconds : Float64 = CMTimeGetSeconds(duration)
success(maxSeconds)
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment