gpt4 book ai didi

ios - 停止调用后从头开始播放AvAudioPlayer文件

转载 作者:行者123 更新时间:2023-11-28 21:35:36 25 4
gpt4 key购买 nike

因此,苹果文档这样说:

Discussion Calling this method, or allowing a sound to finish playing, undoes the setup performed upon calling the play or prepareToPlay methods.

Discussion The stop method does not reset the value of the currentTime property to 0. In other words, if you call stop during playback and then call play, playback resumes at the point where it left off.



使用 [mySound stop]停止声音文件后,如果在上一个 session 中未完全播放该文件,如何使用 [mySound play]从头开始重新播放?

我想我的问题是,如何将currentTime属性的值重置为0?

最佳答案

尝试

    AVAudioPlayer *audio = ...;
[audio pause];
audio.currentTime = 0.0;
[audio play];

看看会发生什么。

关于ios - 停止调用后从头开始播放AvAudioPlayer文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34045930/

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