gpt4 book ai didi

objective-c - 分割音频文件

转载 作者:行者123 更新时间:2023-12-02 23:41:44 25 4
gpt4 key购买 nike

我正在使用AVAudioRecorder和AVAudioPlayer录制和播放音频。我想通过放置标记在特定时间将音频插入AVAudioPlayer中。谁能帮我怎么做?

最佳答案

试试这个 :

    -(void)Play
{
AVAudioPlayer *avPlayer = [[AVAudioPlayer alloc]initWithContentsOfURL:[NSURL fileURLWithPath:[FileDetailsRec valueForKey:@"Path"]] error:nil];
[avPlayer setCurrentTime:5.01f];
[avPlayer prepareToPlay];
[avPlayer play];
objTimer = [NSTimer scheduledTimerWithTimeInterval:1.07f target:self selector:@selector(stop) userInfo:nil repeats:NO];
}

-(void)stop
{
[objTimer invalidate];
[avPlayer stop];
}

请检查一次。。希望对您有所帮助。

https://documentation.apple.com/en/soundtrackpro/usermanual/index.html#chapter=6%26section=18%26tasks=true

关于objective-c - 分割音频文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37384047/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com