Live-to-VOD transition
What you learn​
You're instantiating DIVA Player in your your Roku app and relying on DIVA Back Office as the video streaming source.
The goal of this article is to build the simplest Roku app to stream a video from the DIVA Back Office and manage the video transition from Live to VOD.
Before starting​
- Ensure
Diva Player libandDIVA Back Office Adapter libdownloaded. (Setup > Step 13). - Ask your video engineers team the
<video id>and the related<settings URL>. - Ensure the VideoMetadata contains the asset state, which is what your app reads to get whether the video is either Live or VOD.
Instantiation​
Write the Basic instantiation code, then add the code to read the assetState within the VideoMetadata:
sub launchBOAdapter(launchParams as object)
m.prevAssetState = ""
m.assetState = ""
m.prevVideoId = ""
m.videoId = ""
m.boAdapterNode = CreateObject("roSGNode", "DivaBOAdapter:DivaBOAdapter")
...
m.boAdapterNode.observeField("videoDataNode", "onBOAdapterVideoDataNodeHandler")
...
end sub
sub onBOAdapterVideoDataNodeHandler(evt as dynamic)
data = evt.getData()
m.videoId = data.videoId
assetState = data.assetState
if assetState <> invalid
m.assetState = lcase(assetState)
if m.prevAssetState = "vod" and m.assetState = "live" and m.videoId = m.prevVideoId
'Write the logic when transitioning from Live to VOD <----
end if
m.prevAssetState = m.assetState
end if
m.prevVideoId = m.videoId
' Setup Diva Player Metadata
m.dpUtilsNode.callFunc("setMetaData", data)
end sub