cvat-data/src/ts/3rdparty/README.md
These files are from the Broadway.js repository:
Authors don't provide an npm package, so we need to store these components in our repository. We use this dependency to decode video chunks from a server and split them to frames on client side.
We need to run this package in node environment (for example for debug, or for running unit tests).
But there aren't any ways to do that (even with synthetic environment, provided for example by the package browser-env).
For example there are issues with canvas using (webpack doesn't work with binary canvas package for node-js) and others.
So, we have solved to write patch file for this library.
It modifies source code a little to support our scenario of using.
Clone Emscripten SDK, install and activate the latest fastcomp SDK:
git clone https://github.com/emscripten-core/emsdk.git && cd emsdk
./emsdk install latest-fastcomp
./emsdk activate latest-fastcomp
Clone Broadway.js
git clone https://github.com/mbebenita/Broadway.git && cd Broadway/Decoder
Edit make.py:
'-s', 'NO_BROWSER=1','-s', 'PRECISE_I64_MATH=0',"HEAP8", "HEAP16", "HEAP32" from the EXPORTED_FUNCTIONS list.ALLOW_MEMORY_GROWTH, but this option has not been tested):'-s', 'TOTAL_MEMORY=' + str(100*1024*1024),'-s', "ENVIRONMENT='worker'",'-s', 'WASM=1',Activate emsdk environment and build Broadway.js:
. /tmp/emsdk/emsdk_env.sh
python2 make.py
Copy the following files to cvat-data 3rdparty source folder:
cd ..
cp Player/avc.wasm Player/Decoder.cjs Player/mp4.js <CVAT_FOLDER>/cvat-data/src/
js/3rdparty