Commit 3c37240a by SunARcTech2

form changes

parent e9be7a5f
No preview for this file type
......@@ -2124,6 +2124,9 @@
LastSwiftMigration = 0920;
ProvisioningStyle = Manual;
SystemCapabilities = {
com.apple.BackgroundModes = {
enabled = 1;
};
com.apple.Push = {
enabled = 1;
};
......@@ -2919,7 +2922,7 @@
CODE_SIGN_STYLE = Manual;
DEVELOPMENT_TEAM = AY4776L6L2;
INFOPLIST_FILE = Bhagyashree/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.gdi.yuanzhongsiuseller;
PRODUCT_NAME = "$(TARGET_NAME)";
......@@ -2944,7 +2947,7 @@
CODE_SIGN_STYLE = Manual;
DEVELOPMENT_TEAM = AY4776L6L2;
INFOPLIST_FILE = Bhagyashree/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.gdi.yuanzhongsiuseller;
PRODUCT_NAME = "$(TARGET_NAME)";
......
......@@ -147,5 +147,21 @@
landmarkType = "7">
</BreakpointContent>
</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>
</Bucket>
......@@ -4,6 +4,8 @@
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleDisplayName</key>
<string>iAstro(Master)</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
......@@ -17,7 +19,7 @@
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleVersion</key>
<string>1</string>
<string>4</string>
<key>Fabric</key>
<dict>
<key>APIKey</key>
......@@ -49,6 +51,11 @@
<string>Fengushi would like to access your photos for sharing</string>
<key>NSPhotoLibraryUsageDescription</key>
<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>
<string>LaunchScreen</string>
<key>UIMainStoryboardFile</key>
......@@ -60,7 +67,7 @@
<string>armv7</string>
</array>
<key>UIRequiresFullScreen</key>
<false/>
<true/>
<key>UIStatusBarStyle</key>
<string>UIStatusBarStyleLightContent</string>
<key>UISupportedInterfaceOrientations</key>
......
......@@ -43,11 +43,20 @@ class PlayAudioCell: UITableViewCell {
func playAudioFile() {
Audio.playAudio(audioPath: audioRecording!.audioPath, success: {
self.audioRecording?.isPlaying = true
}) { (errorMesaage) in
// TO DO: show tost
Audio.playAudio(audioPath: audioRecording!.audioPath, success: { (max) in
print(max)
}, 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 {
}
if let audioPath = audioPath {
Audio.playAudio(audioPath: audioPath, success: {
Audio.playAudio(audioPath: audioPath, success: { (max) in
print("max = \(max)")
self.delegate?.playingAudioAtIndex(index: cellIndex)
}) { (errorMesssage) in
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: {
// self.delegate?.playingAudioAtIndex(index: cellIndex)
// }) { (errorMesssage) in
// self.viewController()?.view.showToast(errorMesssage, position: .bottom, popTime: 2.0, dismissOnTap: false)
// }
} else {
self.viewController()?.view.showToast("Audio missing", position: .bottom, popTime: 2.0, dismissOnTap: false)
}
......
......@@ -351,11 +351,20 @@ class OnlineEnquiryMasterAudioCell: UITableViewCell {
@IBAction func play() {
if let audioPath = audioPath {
Audio.playAudio(audioPath: audioPath, success: {
}) { (errorMesssage) in
self.viewController()?.view.showToast(errorMesssage, position: .bottom, popTime: 2.0, dismissOnTap: false)
Audio.playAudio(audioPath: audioPath, success: { (max) in
print("max = \(max)")
}, 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 {
self.viewController()?.view.showToast("Audio missing", position: .bottom, popTime: 2.0, dismissOnTap: false)
}
......@@ -385,11 +394,20 @@ class OnlineEnquiryCustomerAudioCell: UITableViewCell {
@IBAction func play() {
if let audioPath = audioPath {
Audio.playAudio(audioPath: audioPath, success: {
}) { (errorMesssage) in
self.viewController()?.view.showToast(errorMesssage, position: .bottom, popTime: 2.0, dismissOnTap: false)
Audio.playAudio(audioPath: audioPath, success: { (max) in
print("Max = \(max)")
}, 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 {
self.viewController()?.view.showToast("Audio missing", position: .bottom, popTime: 2.0, dismissOnTap: false)
}
......
......@@ -14,6 +14,7 @@ class Audio {
var audioRecorder:AVAudioRecorder!
var audioPlayer: AVPlayer?
var playerItem:AVPlayerItem?
var audioPlayerForLocalFile: AVAudioPlayer?
var currentRecordingPath: String?
static let shared = 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
let audioURL = URL(fileURLWithPath: audioPath)
......@@ -69,16 +70,31 @@ class Audio {
try Audio.shared.audioPlayerForLocalFile = AVAudioPlayer(contentsOf: audioURL)
Audio.shared.audioPlayerForLocalFile!.prepareToPlay()
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 {
failure(error.localizedDescription)
}
} else { // remote path
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()
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