音频-向前跳30秒

问题描述:

我有一个音频播放器,可以播放从Core Date检索到的音频.玩&暂停工作正常.我正在尝试实现跳转30秒"按钮,并寻求有关如何实现此目标的任何指针.

I've got an audio player that plays audio retrieved from Core Date. Play & pause work fine. I'm trying to implement a 'Jump Forward 30 Seconds' button and seeking any pointers as to how I would go about that.

播放/暂停"按钮的代码

Code for my 'Play/pause' button

@IBAction func playPressed(sender: AnyObject) { 

    let play = UIImage(named: "play")
    let pause = UIImage(named: "pause")
    if audioPlayer.playing {
        pauseAudioPlayer()
        audioPlayer.playing ? "\(playButton.setImage( pause, forState: UIControlState.Normal))" : "\(playButton.setImage(play , forState: UIControlState.Normal))"

    }else{
        playAudio()
        audioPlayer.playing ? "\(playButton.setImage( pause, forState: UIControlState.Normal))" : "\(playButton.setImage(play , forState: UIControlState.Normal))"
    }

}

swift 3 中的

:

player.play()
player.currentTime=60

单位是第二 无需停止