These is a self answering question.
Problem: Can not play videos which are protected by PlayReady DRM.
Here is the working sample
if m.VideoPlayer = invalid m.VideoPlayer = m.top.createChild("Video") m.VideoPlayer.id = "VideoPlayer" m.VideoPlayer.observeField("state", "OnVideoStateChange") end if drmParams = {} videoContent = createObject("RoSGNode", "ContentNode") videoContent.Live = remoteContent.IsLive videoContent.Url = remoteContent.Path if remoteContent.CodecType = "DashWideVineDrm" then videoContent.StreamFormat = "dash" drmparams.licenseServerURL = remoteContent.DrmRightsUrl drmParams.KeySystem = "widevine" else if remoteContent.CodecType = "PlayReadyDrm" then videoContent.StreamFormat = "ism" drmParams.KeySystem = "playready" drmParams.encodingType = "PlayReadyLicenseAcquisitionUrl" drmParams.encodingKey = remoteContent.DrmRightsUrl else videoContent.StreamFormat = "mp4" end if videoContent.drmParams = drmParams device = CreateObject("roDeviceInfo") httpAgent = CreateObject("roHttpAgent") if httpAgent <> invalid then httpAgent.SetCertificatesFile("common:/certs/ca-bundle.crt") httpAgent.InitClientCertificates() httpAgent.EnableCookies() httpAgent.AddHeader("X-Roku-Reserved-Dev-Id", "") if remoteContent.MYCUSTOMHEADER1 <> invalid and remoteContent.MYCUSTOMHEADER1 <> "" then httpAgent.AddHeader("MY-CUSTOM-HEADER2", remoteContent.MYCUSTOMHEADER1) end if if remoteContent.MYCUSTOMHEADER2 <> invalid and remoteContent.MYCUSTOMHEADER2 <> "" then httpAgent.AddHeader("MY-CUSTOM-HEADER2", remoteContent.MYCUSTOMHEADER2) end if m.VideoPlayer.setHttpAgent(httpAgent) else headers = [] headers.push("X-Roku-Reserved-Dev-Id:") if remoteContent.MYCUSTOMHEADER1 <> invalid and remoteContent.MYCUSTOMHEADER1 <> "" then headers.push("MY-CUSTOM-HEADER1:" + remoteContent.MYCUSTOMHEADER1) if remoteContent.MYCUSTOMHEADER2 <> invalid and remoteContent.MYCUSTOMHEADER2 <> "" then headers.push("MY-CUSTOM-HEADER2:" + remoteContent.MYCUSTOMHEADER2) videoContent.HttpHeaders = headers videoContent.HttpSendClientCertificates = true videoContent.HttpCertificatesFile = "common:/certs/ca-bundle.crt" m.VideoPlayer.EnableCookies() m.VideoPlayer.SetCertificatesFile("common:/certs/ca-bundle.crt") m.VideoPlayer.InitClientCertificates() end if m.VideoPlayer.content = videoContent m.VideoPlayer.control = "play"
NOTE: If you use PlayReady DO NOT FILL drmParams.licenseServerURL, because it will fail to play with DRM Error (-6).
Here is the working sample
NOTE: If you use PlayReady DO NOT FILL drmParams.licenseServerURL, because it will fail to play with DRM Error (-6).