我知道您可以使用 Mediaplayer seekto()
从特定点开始。
但是有没有办法让轨道(播放的音频)停在某个点?还是必须在定时器循环上使用 if 语句?
最佳答案
如果不在计时器循环中求助于 seekto() ,似乎不可能(如果我错了请纠正我)使用媒体播放器执行此操作。但是,您可以尝试将 AudioTrack 与设置通知标记结合使用:
AudioTrack.setNotificationMarkerPosition
Sets the position of the notification marker.
并覆盖播放位置更新监听器AudioTrack.OnPlaybackPositionUpdateListener
Interface definition for a callback to be invoked when the playback head position of an AudioTrack has reached a notification marker or has increased by a certain period.
关于java - 在 Android 上停止轨道(在某个点),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2709488/