phoboslab / jsmpeg

MPEG1 Video Decoder in JavaScript
MIT License
6.34k stars 1.43k forks source link

Use jsmpeg in worker (disable document references from jsmpeg.js) #177

Open saste opened 7 years ago

saste commented 7 years ago

Hi, I have a use case where I use jsmpeg.js in a worker. In order to make this possible, I had to disable many modules which I do not use in the output file, and remove the references to the document in the src/jsmpeg.js file.

I wonder if could be possible to make it possible to make this configurable. Editing a custom build.sh file is pretty easy, so the main issue would be to disable/enable document references from src/jsmpeg.js.

samsonradu commented 7 years ago

I'm afraid the bigger problem would be the use of WebGL in a WebWorker. Last time I checked only Mozilla offered this option.

See https://github.com/phoboslab/jsmpeg/issues/157

saste commented 7 years ago

As far as I understand WebGL is only used for rendering. In my use case I'm using the worker only to perform decoding, while rendering is performed in the main thread, so I don't mind if using WebGL from the worker is possible or not.

ssssssssssss commented 7 years ago

@saste @samsonradu Any progress here? Would be possible to use web workers with transferable objects to do the decoding and transfer the result back for rendering.