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

时间:2018-11-29 03:34:33

标签: ios chromecast google-cast

在Documents中,GCKRemoteMediaClient具有play(),pause()。没有resume() 并且play()的描述是“播放总是从流的开头开始。”

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

setPlaybackrate也不起作用。

在我的自定义课程中

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
}

1 个答案:

答案 0 :(得分:1)

按照Cast SDK的说明,您需要调用play(目标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;