Migrating from Native Video Node to the Bitmovin Player

In this guide, we will show you how to migrate from the Roku Native Video Node to the Bitmovin Player in just two simple steps.

Step 1: Add & configure your Bitmovin Player

First, we need to add our component library to your app. To do that create a ComponentLibrary node.

m.bitmovinPlayerSDK = CreateObject("roSGNode", "ComponentLibrary")
m.bitmovinPlayerSDK.id = "BitmovinPlayerSDK"
m.bitmovinPlayerSDK.uri = "https://cdn.bitmovin.com/player/roku/1/bitmovinplayer.pkg"

Next, start the download of the component library by adding it to your scene and check for the download being finished by observing the loadStatus field.

m.top.appendChild(m.bitmovinPlayerSDK)  
m.bitmovinPlayerSDK.observeField("loadStatus", "onLoadStatusChanged")

Once the download of the library is complete you can create an instance of the player.

sub onLoadStatusChanged()
	if (m.bitmovinPlayerSDK.loadStatus = "ready") then
		m.bitmovinPlayer = CreateObject("roSGNode", "BitmovinPlayerSDK:BitmovinPlayer")
end sub

And finally, add the Bitmovin Player License Key to your channel manifest:

# License key
bitmovin_player_license_key=YOUR_LICENSE_KEY

You can find your license key in your Bitmovin Dashboard under "Player" -> "Licenses". This security mechanism protects your license from being used elsewhere.


Step 2: Replace native video node references in your project

Remove all instances of roSGNode of type Video from your app and use the Bitmovin Player instead. You can use the same contentNode you have been using before.

- m.video = CreateObject("roSGNode", "Video")
- m.video.content = contentNode
- m.video.control = "play"

+ m.bitmovinPlayer = CreateObject("roSGNode", "BitmovinPlayerSDK:BitmovinPlayer")
+ m.bitmovinPlayer.callFunc("load", contentNode)
+ m.bitmovinPlayer.callFunc("play", invalid)

📘

Note

It is good practice to only ever have one instance of a video node on Roku, be that a native one or the Bitmovin one, to avoid conflicts between the two as well as unexpected behaviours.


Summary

In this guide, we demonstrated how easy it is to migrate from the Native Video Node to the Bitmovin Player in just two simple steps: adding the Bitmovin Player and simply replacing the video node with it.

Next, you can


Appendix: Mapping Tables

For more advanced use cases, we've created the following mapping tables to support your migration.

Video node ➡️ Player function mapping

Video NodeBitmovin Player
video.content = contentNodebitmovinPlayer.callFunc("load", contentNode) or
bitmovinPlayer.callFunc("load", bitmovinSourceConfig)
video.control = "play"bitmovinPlayer.callFunc("play", invalid)
video.control = "pause"bitmovinPlayer.callFunc("pause", invalid)
video.control = "stop"bitmovinPlayer.callFunc("unload", invalid)
video.seek = targetbitmovinPlayer.callFunc("seek", target) ' For VoD content
bitmovinPlayer.callFunc("timeShift", target) ' For live content
video.durationbitmovinPlayer.callFunc("getDuration", invalid)
video.mute = true and
video.mute = false
bitmovinPlayer.callFunc("mute", invalid) and
bitmovinPlayer.callFunc("unmute", invalid)

For a full list of all available functions check out our Bitmovin Player API reference.

Video node ➡️ Player field mapping

Video NodeBitmovin Player
video.statebitmovinPlayer.playerState
video.errorCode, video.errorMsg, video.errorStrbitmovinPlayer.error.code, bitmovinPlayer.error.message, bitmovinPlayer.error.name
video.positionbitmovinPlayer.timeChanged
video.timedMetaDatabitmovinPlayer.metadata

For a full list of all available fields check out our Bitmovin Player API reference.