Cloud playback
Negotiate a recording playback session using the signaling connection.
Cloud playback is a separate WebRTC signaling conversation from a live camera
session. Your application creates the WebRTC peer and SDP offer. Pass the
recording device ID and offer to StartPlayback, apply the returned answer to
the same peer, and exchange ICE candidates if your mode requires them.
playback, err := conn.StartPlayback(ctx, ring.StartPlaybackRequest{
DeviceID: deviceID,
Offer: ring.SessionDescription{
Type: ring.SDPTypeOffer,
SDP: peer.LocalDescription().SDP,
},
})
if err != nil {
return err
}
defer playback.Close()
answer := playback.Answer()
if err := peer.SetRemoteDescription(webrtc.SessionDescription{
Type: webrtc.SDPTypeAnswer,
SDP: answer.SDP,
}); err != nil {
return err
}Use playback.SendICE and playback.Receive for candidate and session event
exchange when using trickle ICE. PlaybackSession does not expose live camera
PTZ controls. Close it when playback ends; closing the parent signaling
connection ends child playback sessions too.
For a recording downloaded over HTTP instead of streamed through a WebRTC
playback session, use Client.GetRecording. Close the response body returned
by that method after consuming the media.
The signaling playback message shapes are described in the generated playback operation. Playback availability can vary by account and recording, so handle errors returned when a recording cannot be opened.