Fast Rewind & Fast Forward in AVAudioPlayer

后端 未结 2 744
一个人的身影
一个人的身影 2020-12-21 23:03

I am implementing AVAudioPlayer and fast-rewind,fast-forward functionality. I have made two button with gesture, images and glow effects. Currently when I tab on fast-forwar

相关标签:
2条回答
  • 2020-12-21 23:27

    You can use an AVPlayer instead and change the rate property on touch down. Change it to -2 for rewind and 2 for fast-forward. And remember to change the rate back to 1 on touch up inside/outside.

    EDIT AVPlayer's rate property supports values outside the 0.0-1.0 range IF

    the associated player item returns YES for the AVPlayerItem properties canPlaySlowForward or canPlayFastForward

    https://developer.apple.com/documentation/avfoundation/avplayer/1388846-rate

    0 讨论(0)
  • 2020-12-21 23:28

    One possible solution is to implement the repeating action by an NSTimer. Have a look at UIButton Touch and Hold.

    0 讨论(0)
提交回复
热议问题