Skip to main content

Audio player

What you learn​

You are instantiating DIVA Player in your' Roku application and relying on DIVA Back Office as the video streaming source.

The goal of this article is to build the simplest Roku application to an audio (podcast or songs) from the DIVA Back Office.

Before starting​

  • Ensure the DIVA Back Office instance you rely on is up and running.
  • Ask your video engineers team the <videoId> and <settings URL>.

Instantiation​

Enrich the Basic instantiation code with

  • videoId It's a string with videoId to display.
  • playerMode added into the config parameter. To enable Audio playback mode, playerMode's value has to be podcast or music. It will display the audio player with the podcast or music controls.

Working sample code (.tsx)​

sub launchBOAdapter(divaLaunchParams as object)
m.boAdapterNode = CreateObject("roSGNode", "DivaBOAdapter:DivaBOAdapter")

m.boAdapterNode.initData = {
"settingId": "<settings URL>"
"videoId": "<video id>"
"dictionaryId": "en_GB"
"entitlementToken": "<entitlementToken>" 'Optional. Uses for Entitlement check. Token sends in the Entitlement request in "User" key
}
...
m.boAdapterNode.observeField("divaLaunchParams", "onBOAdapterDivaLaunchParamsHandler")
...
m.dpUtilsNode = CreateObject("roSGNode", "DivaPlayerSDK:DPUtilsNode")
...
end sub

sub onBOAdapterDivaLaunchParamsHandler(evt as dynamic)
data = evt.getData()

'Adding/modifying the initialization data DIVA Player
data.playerMode = "music"' "podcast". "Fullscreen" - by default

' Setup Diva Player launch parameters
m.dpUtilsNode.callFunc("setLaunchParams", data)
end sub

Dictionary​

Ensure the dictionary (diva_medialist_playing) file contains the relevant key.

Analytics events​

Find here the available analytics events for the Audio player.

Possible event sequences examples:​
  • fullplayer_open > fullplayer_close
  • fullplayer_open > player_next_item_click/player_previous_item_click > fullplayer_close