Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to use this library to detect SupportedCDMs #191

Open
vanminhquangtri opened this issue Jun 29, 2023 · 4 comments
Open

How to use this library to detect SupportedCDMs #191

vanminhquangtri opened this issue Jun 29, 2023 · 4 comments

Comments

@vanminhquangtri
Copy link

vanminhquangtri commented Jun 29, 2023

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'

window.player = window.videojs(
        videoElement,
        myConfigObject,
        () => {
          window.player.eme()
        }
)

But it keep show error: window.player.eme is not a function

@lapalb
Copy link

lapalb commented Jun 29, 2023

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.

@vanminhquangtri
Copy link
Author

vanminhquangtri commented Jun 30, 2023

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.

@vanminhquangtri
Copy link
Author

@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)
            }
          })
        })
      })

@damanV5
Copy link

damanV5 commented Aug 14, 2023

@vanminhquangtri I am also facing the same issue, maybe they forgot to expose the function as I cannot see detectSupportedCDMs inside the eme object.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants