Closed darcyrailip closed 2 years ago
The error is correct in this case because 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.
The error is correct in this case because the function is replaced with an object when the plugin has initialised.
this.eme()
initialises the plugin, soplayer.eme
is now an object. It should only be called once.
Sorry, I meant to just showcase the two options that I'd tried. Using both this.eme()
and player.eme()
don't work.
Look at this example, based on your code above. The type of eme
is logged to the console before each call.
https://jsbin.com/zijevigabi/edit?html,console,output
this.eme()
does "work" here, it's being called (without options) and initialising. If you're not getting playback with protected content then there's probably configuration missing. It would be helpful to focus on a reduced test case of the actual implementation.
Thanks for the example. Looks like my import of:
https://cdn.jsdelivr.net/npm/videojs-contrib-eme@4.0.0/dist/videojs-contrib-eme.cjs.min.js
Needed to be, as you mentioned:
https://cdn.jsdelivr.net/npm/videojs-contrib-eme@4.0.0/dist/videojs-contrib-eme.min.js
I tried implementing this in my React app and keep encountering:
player.eme is not a function
.The React app was using the NPM package.
For convenience, here's a simple HTML showing the same error:
Once I hit the button "Load Source", the console spits out the same error.
I feel like I'm missing something extremely obvious, but I'm not sure what it is.