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-forward, it initially forward the playing item to 10 sec and then playing same way as in normal, even though I am still pressing the button. I want to implement it exactly same like in Iphone/Ipod standard app.
One possible solution is to implement the repeating action by an NSTimer
. Have a look at UIButton Touch and Hold .
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
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.