我必须合并音频文件和录制的语音.例如录制的语音是47秒.我必须将4分钟的音频歌曲剪切或修剪为47秒.并合并音频文件.
var url:NSURL?
if self.audioRecorder != nil
{
url = self.audioRecorder!.url
}
else
{
url = self.soundFileURL!
}
print("playing \(url)")
do
{
self.newplayer = try AVPlayer(URL: url!)
let avAsset = AVURLAsset(URL: url!, options: nil)
print("\(avAsset)")
let audioDuration = avAsset.duration
let totalSeconds = CMTimeGetSeconds(audioDuration)
let hours = floor(totalSeconds / 3600)
var minutes = floor(totalSeconds % 3600 / 60)
var seconds = floor(totalSeconds % 3600 % 60)
print("hours = \(hours),minutes = \(minutes),seconds = \(seconds)")}
Run Code Online (Sandbox Code Playgroud)
这是输出:// hours = 0.0,minutes = 0.0,seconds = 42.0 …
我正在做 iOS swift 项目。我想用应用程序本身发送邮件。当用户单击应用程序内的提交按钮时,邮件需要在后台发送,否则弹出窗口将出现在应用程序内,而无需导航到邮件编辑器。
\n if MFMailComposeViewController.canSendMail() {\n let mail = MFMailComposeViewController()\n mail.mailComposeDelegate = self\n mail.setToRecipients([ApplicationModel.sharedInstance.mailAddress])\n mail.setSubject("Feedback: \\(UserDefaults.Id)")\n mail.setMessageBody(sendBpodyMessage(), isHTML: false)\n present(mail, animated: true)\n } else {\n if let emailUrl = createEmailUrl(to: ApplicationModel.sharedInstance.mailAddress,\n subject: "Feedback", body: sendBpodyMessage()) {\n UIApplication.shared.open(emailUrl)\n }\n }\nRun Code Online (Sandbox Code Playgroud)\n我参考了很多答案,所有人都说没有办法,苹果没有这个功能。有可能吗,或者还有其他方法吗?
\n大多数人说使用API发送到自己的服务器。如果我没有\xe2\x80\x99t 有任何与上述问题相关的选项,我会尝试一下。
\n