如何在视频流中间恢复视频?

How can I resume video at the middle of video stream?

在Documents中,GCKRemoteMediaClient有play(), pause()。不恢复() 而play()的描述是"Playback always begins at the beginning of the stream."

那么,如何在视频流中间恢复视频? (我想暂停 -> 恢复)

setPlaybackrate 也不起作用..

按照我的习惯class

func pause() {
    let request = castSession?.remoteMediaClient?.pause()
    request?.delegate = self

 // not work
 // let request = castSession?.remoteMediaClient?.setPlaybackRate(0)
 // request?.delegate = self
}

func play() {
    let request = castSession?.remoteMediaClient?.play()
    request?.delegate = self

    // not work
    // let request = castSession?.remoteMediaClient?.setPlaybackRate(1)
    // request?.delegate = self
}

按照Cast SDK的说明,需要调用play(objective c)函数,视频会恢复播放。您可以阅读更多 link.

如果您想从视频中间继续播放视频,您应该使用 seek 功能来实现。

/** * Begins (or resumes) playback of the current media item. Playback always begins at the * beginning of the stream. The request will fail if there is no current media status. * * @return The GCKRequest object for tracking this request. */ - (GCKRequest *)play;