muxinc / videojs-mux-kit

MIT License
33 stars 11 forks source link

TypeError: Cannot read property 'NETWORK_ERROR' of undefined #59

Closed 4-life closed 2 years ago

4-life commented 2 years ago

Version 0.6.0 doesn't work at all. How to check: Just import lib on a page:

import videojs from '@mux/videojs-kit';

That's it.

You can try it on npm runkit: https://npm.runkit.com/%40mux%2Fvideojs-kit

cjpillsbury commented 2 years ago

Hey @4-life sorry you're running into issues. I may need more context. I have a fairly simple working example using @mux/videojs-kit v0.6.0 as an npm import here: https://codesandbox.io/s/determined-merkle-wsvnj?file=/src/index.js

Is it possible you've got something in your code trying to load an undefined/invalid source or playback id?

4-life commented 2 years ago

Thanks for your answer @cjpillsbury

Hey @4-life sorry you're running into issues. I may need more context. I have a fairly simple working example using @mux/videojs-kit v0.6.0 as an npm import here: https://codesandbox.io/s/determined-merkle-wsvnj?file=/src/index.js

Is it possible you've got something in your code trying to load an undefined/invalid source or playback id?

I've just defined videojs in react app and that's all. I see that your example works as expected. That's strange. Maybe i have some libs that broke the @mux/videojs-kit.

But why the same error occur in npm runkit?

marcneander commented 2 years ago

Getting same error. Unusable.

alexplumb commented 2 years ago

I also started having issues with v0.6.0 - after investigating I was able to narrow it down to Webpack/Babel. In order to get this to work, I needed to add node_modules/@mux to the list of folders ignored by Babel. I feel like doing this would have unexpected effects on browser compatibility so I'm hesitant to call this a solution.

loader: 'babel-loader',
          options: {
            cacheDirectory: true,
            babelrc: false,
            sourceType: 'unambiguous',
            presets: [ ...presets  ],
            plugins: [ ...plugins ],
            ignore: [
              'node_modules/@mux',
            ],
          },
troyer commented 2 years ago

same issue here using nuxt.js

stolinski commented 2 years ago

Also seeing with usage in Svelte Kit

Error when evaluating SSR module /src/lib/tutorials/TutorialsMain.svelte:
TypeError: Cannot read properties of undefined (reading 'NETWORK_ERROR')
    at Object.819 (/Users/scotttolinski/Sites/Level-Up-Tutorials/node_modules/.pnpm/@mux+videojs-kit@0.7.0/node_modules/@mux/videojs-kit/dist/index.js:77:4852)
    at Qe (/Users/scotttolinski/Sites/Level-Up-Tutorials/node_modules/.pnpm/@mux+videojs-kit@0.7.0/node_modules/@mux/videojs-kit/dist/index.js:78:1629)
    at Object.18 (/Users/scotttolinski/Sites/Level-Up-Tutorials/node_modules/.pnpm/@mux+videojs-kit@0.7.0/node_modules/@mux/videojs-kit/dist/index.js:77:4128)
    at Qe (/Users/scotttolinski/Sites/Level-Up-Tutorials/node_modules/.pnpm/@mux+videojs-kit@0.7.0/node_modules/@mux/videojs-kit/dist/index.js:78:1629)
    at /Users/scotttolinski/Sites/Level-Up-Tutorials/node_modules/.pnpm/@mux+videojs-kit@0.7.0/node_modules/@mux/videojs-kit/dist/index.js:78:2137
    at /Users/scotttolinski/Sites/Level-Up-Tutorials/node_modules/.pnpm/@mux+videojs-kit@0.7.0/node_modules/@mux/videojs-kit/dist/index.js:78:2155
    at /Users/scotttolinski/Sites/Level-Up-Tutorials/node_modules/.pnpm/@mux+videojs-kit@0.7.0/node_modules/@mux/videojs-kit/dist/index.js:1:83
    at Object.<anonymous> (/Users/scotttolinski/Sites/Level-Up-Tutorials/node_modules/.pnpm/@mux+videojs-kit@0.7.0/node_modules/@mux/videojs-kit/dist/index.js:1:203)
    at Module._compile (node:internal/modules/cjs/loader:1095:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1147:10)
adyz commented 2 years ago

Same here, looks like this happens only on the new versions, the 0.5.0 was working fine.

ramiel commented 2 years ago

Same on next.js. This makes the project not usable

cjpillsbury commented 2 years ago

runkit's been slow on the uptake for picking up 0.7.1, but confirmed nextjs and require in a node runtime looks 👌.