videojs-contrib-eme icon indicating copy to clipboard operation
videojs-contrib-eme copied to clipboard

Can't get initializeMediaKeys to work

Open marcosthejew opened this issue 2 years ago • 2 comments

Hello! In our use case, we need to reuse the same license for multiple sources for different videos, I came across the initializeMediaKeys function, but when called with the following emeOptions:

var emeOptions = { 
              keySystems : {
                  "com.widevine.alpha": { 
                  url : myUrl,
                  audioRobustness: 'SW_SECURE_CRYPTO',
                  videoRobustness: 'SW_SECURE_CRYPTO'
                  }
              }
      }

I've tried several variations of this object as a parameter but I always get a:

instrument.js:109 VIDEOJS: ERROR: (CODE:5 MEDIA_ERR_ENCRYPTED) Unsupported keySystem or supportedConfigurations. 
MediaError {code: 5, message: 'Unsupported keySystem or supportedConfigurations.'}

And opening the media error object I get:


MediaError {code: 5, message: 'Unsupported keySystem or supportedConfigurations.'}
code: 5
message: "Unsupported keySystem or supportedConfigurations."
responseContentType: "application/dash+xml"
responseStatus: 200
responseURL:[REDACTED]
token=[REDACTED]
[[Prototype]]: Object
MEDIA_ERR_ABORTED: 1
MEDIA_ERR_CUSTOM: 0
MEDIA_ERR_DECODE: 3
MEDIA_ERR_ENCRYPTED: 5
MEDIA_ERR_NETWORK: 2
MEDIA_ERR_SRC_NOT_SUPPORTED: 4
code: 0
message: ""
status: null
constructor: ƒ MediaError(value)
[[Prototype]]: Object

Could someone help me or give me a hint? Thanks.

marcosthejew avatar May 13 '22 18:05 marcosthejew

As an update to this issue, I followed the instructions for setting the options for all sources:

var options = {
     keySystems: myKeySystems
}
    videoPlayer.eme.options = {
        options
     }   

And no error is thrown, but the request to the URL for retrieving the license is never made. Therefore the video won't play. And just to confirm, the exact same myKeySystems object works when setting options per source.

marcosthejew avatar May 18 '22 17:05 marcosthejew

Adding that we experience the same issue. We can't find a way where this feature actually works. Can an actual example that works be provided?

jamescahall avatar Dec 04 '23 17:12 jamescahall