【问题标题】:Roku (Brightscript) - Playing DRM Protected Video ContentRoku (Brightscript) - 播放受 DRM 保护的视频内容
【发布时间】:2019-04-06 13:06:33
【问题描述】:

这是一个自我回答的问题。

问题: 无法播放受 PlayReady DRM 保护的视频。

【问题讨论】:

    标签: drm roku brightscript widevine playready


    【解决方案1】:

    这是工作示例

        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"
    

    注意: 如果您使用 PlayReady,请勿填写 drmParams.licenseServerURL,因为它将无法播放并出现 DRM 错误 (-6)。

    【讨论】:

      猜你喜欢
      • 2017-12-23
      • 2017-04-24
      • 2019-09-17
      • 2017-03-30
      • 1970-01-01
      • 2017-06-28
      • 2013-05-13
      • 2017-10-08
      • 1970-01-01
      相关资源
      最近更新 更多