Open vanminhquangtri opened 1 year ago
The function is replaced with an object when the plugin has initialised. this.eme()
initialises the plugin, so player.eme
is now an object. It should only be called once.
Hello @lapalb , I still can't get what you mean. A bit confused. If posible can you please give me a code sample. That's would be much easier to understand. Thank you.
@lapalb it seem the plugin is added success. But the player.eme.detectSupportedCDMs() not work. it show error player.eme.detectSupportedCDMs is not a function Can you please advice how to fix this? Do I need to pass any param to player.eme() method? This is my code:
import('video.js').then(function ({ default: videojs }) {
import('videojs-contrib-eme').then(function () {
const videoNode = document.getElementById('videoPlayer')
if (!videoNode) return
videojs.registerPlugin('eme', videojsContribEme)
const player = videojs(videoNode, {}, function () {
try {
player.eme()
player.eme.detectSupportedCDMs().then((supportedCDMs) => {
console.log(supportedCDMs)
})
} catch (e) {
console.log(e)
}
})
})
})
@vanminhquangtri I am also facing the same issue, maybe they forgot to expose the function as I cannot see detectSupportedCDMs inside the eme object.
I have used Videojs already and want to use videojs-contrib-eme to detect the support DRM key before apply the DRM. But I don't actually understand how to use detectSupportedCDMs(). I see it has player.eme.detectSupportedCDMs() but don't understand what is player here?
This is my main code: import 'videojs-contrib-eme'
But it keep show error: window.player.eme is not a function