Iman
Iman

Reputation: 581

Shaka player - HTMLMediaElement is not defined

When I installed shaka player in Nuxt and mode: universal, I received this error:

enter image description here

In spa mode shaka is working but in universal it doesn't work.


Thanks to the answer, the issue was solved with the following:

if (process.client) {
  window.shaka = require('shaka-player/dist/shaka-player.compiled.js')
  require('shaka-player/dist/shaka-player.ui')
}

Upvotes: 1

Views: 968

Answers (1)

kissu
kissu

Reputation: 46774

You did not provided any code, but I'm 90% sure that this is coming from the fact that window is not present when run on the server.

My answer can be found here: How to fix navigator / window / document is undefined in Nuxt

Upvotes: 1

Related Questions