Rendering Playback
Access the Webrtc view to show the Playback
To render the Playback or access the player to show the Playback, add below view:
let liveView = liveViewObject.remoteViews.first
Connect/disconect playback
Playback starts at playbackCurrentTime — a public property that defaults to the start of the previous hour, local time. Set it before connect, or call seekToTime afterwards.
To connect playback you will need
playbackEndTime(optional): Epoch seconds at which playback should stop. Defaults to 23:59:59 local time of the start day.
liveViewObject.connect(playbackEndTime: <Epoch time>)
To disconnect live view you will need
liveViewObject.disconnect()
Observing the status of Playback
To observer the status of the playback, The following observer can be used:
liveViewObject.onConnected = {
// the stream is up; hide the spinner
}
liveViewObject.onLiveViewTerminate = {
// the session was torn down
}
liveViewObject.onError = {
// a connection error that the SDK will not retry
}
liveViewObject.onReconnect = {
// the SDK is re-establishing the stream
}
liveViewObject.onTimeout = {
// the connection did not come up within 30 s
}
liveViewObject.onDataChannelMessage = { (data: Data) in
// playback messages — decode as PlaybackMessage; actions are PlaybackAction
// (RSSI and sensor readings are delivered through $rssi, $temperature, $humidity instead)
}
liveViewObject.onDataChannelOpen = { (isOpen: Bool) in
// the data channel opened or closed
}
liveViewObject.onDeviceRefresh = { (device: DeviceModel) in
// the SDK refreshed the device record while reconnecting
}
liveViewObject.onFrameTimeout = {
// no video frame for 15 s
}
liveViewObject.onStreamEnded = {
// the camera ended the stream
}
liveViewObject.onStreamFailed = {
// the stream failed
}
These are optional closure properties — assign them (=); trailing-closure call syntax does not compile. Assign them before connect, and clear them when the screen goes away: the model is cached and outlives the view controller.PlaybackAction``` }
liveViewObject.onDataChannelOpen { // status is updated when ever data channel is open }
liveViewObject.onDeviceRefresh { // status is updated when ever devices is refreshed by SDK }
liveViewObject.onFrameTimeout { // status is updated when ever live is frame timed out }
liveViewObject.onStreamEnded { // status is updated when ever live stream ends }
liveViewObject.onStreamFailed { // status is updated when ever live stream fails } ```