After incorporating the shaka player into my Nuxt project with mode: universal
, I encountered an unexpected error:
https://i.sstatic.net/5AOQk.png
Interestingly, while shaka worked seamlessly in spa
mode, it failed to function properly in universal
.
Fortunately, the solution came in the form of the following code snippet:
if (process.client) {
window.shaka = require('shaka-player/dist/shaka-player.compiled.js')
require('shaka-player/dist/shaka-player.ui')
}