mbebenita / Broadway

A JavaScript H.264 decoder.
Other
2.73k stars 424 forks source link

ReferenceError: global is not defined #177

Closed fxfactorial closed 4 years ago

fxfactorial commented 6 years ago

using 0.0.2 in a create-react-app project

and getting this error

Decoder.js:58 Uncaught ReferenceError: global is not defined
    at Object.getModule (Decoder.js:58)
    at new Decoder (Decoder.js:169)
    at Decoder.js:733

in this kind of code sample:

import H264Player from 'broadwayjs/Player/Player';

    this.player = new H264Player({
      useWorker: true,
      // reuseMemory: true,
      webgl: 'auto',
      workerFile: '/Decoder.js'
    });

where /Decoder.js is located in my public/Decoder.js so I assume it means the broadway will do its own query for this Decoder.js file.

So I am not clear why global would not be defined in the worker thread

soliton4 commented 6 years ago

make sure you use the latest version workerfile is simple the url from which the workter thread is initialized

fxfactorial commented 6 years ago

@soliton4 sorry, I don't quite understand.

I did cp node_modules/broadway/Decoder.js public

Can you show me a code sample of what you mean?

soliton4 commented 6 years ago

this is not the same as the node module. the node module was created by someone else. please ask there for support

fxfactorial commented 6 years ago

Okay so I could just copy your Decoder.js and my current step would work ?

Sent from my iPhone

On Jun 19, 2018, at 1:25 PM, soliton4 notifications@github.com wrote:

this is not the same as the node module. the node module was created by someone else. please ask there for support

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.