naviapps / create-nw-react-app

Create NW.js React apps with no build configuration.
MIT License
144 stars 14 forks source link

Building with proprietary codecs support #19

Open woudsma opened 6 years ago

woudsma commented 6 years ago

Nice project! Works right out of the box on my machine (osx64).

I've spent some hours on getting the proprietary codecs to work with an app created with create-nw-react-app. Some videos wouldn't play because of default Chromium codec support.

Also, to re-enable autoplay on videos with audio, i added these Chromium arguments to package.json:

"chromium-args": "--autoplay-policy=no-user-gesture-required --ignore-autoplay-restrictions --disable-popup-blocking"

Would it be an idea to add an option to include the proprietary codecs in development / on build?

At the time of writing, the latest nwjs-ffmpeg-prebuilt binaries are available only for nwjs v0.30.5, and create-nw-react-app automatically downloads the latest version (v0.31.0) in my case, so just copying the prebuilt ffmpeg binaries into the nwjs.app cached by create-nw-react-app wouldn't work.

The way i eventually got it to work was to download and replace libffmpeg.dylib from nwjs-ffmpeg-prebuilt to a corresponding nwjs version, to nwjs.app/Contents/Versions/<version>/libffmpeg.dylib.

Then, replace ./cache/0.31.0-sdk/osx64/nwjs.app and ./cache/0.31.0-normal/osx64/nwjs.app with the 'patched' nwjs.app (v0.30.5). This is a bit hacky IMO.

Any thoughts on this? Are you open to pull requests?