Ivshti / wcjs-prebuilt

Install pre-built WebChimera.js with bundled VLC for Electron
43 stars 21 forks source link

WCjs is outside node_modules/ and it works for Stremio #36

Closed Nextdrive-NeilChen closed 8 years ago

Nextdrive-NeilChen commented 8 years ago

Hello lvshti,

Newbie here; tried to search for a solution but unable to find out yet. Many thanks in ahead if you can help me out.

I am building an Electron app so that it can play an IPCam utilizing wcjs-prebuilt. It works great when in dev mode (npm start) but when I pack it using electron-packager, it no longer works.

The parameters I used to pass in electron-packager are like this:

electron-packager . myAPP --asar --overwrite --platform=win32 --arch=ia32 --icon=assets/app-icon/win/app.ico --prune=true --out=out .....

And once it packs successfully, and I tried to run myApp.exe, this is

The specified module could not be found. \?\C:\Users\chenn\AppData\Local\Temp[random].tmp.node

I tried to study Electron's documents, and found out that we can use --asar-unpack=*.node

This solves the (WebChimera.js.node) not found, but still can not get all the bin/plugins

This line (work-around for Win) is in my main.js already for sure

if (process.platform == 'win32') process.env['VLC_PLUGIN_PATH'] = require('path').join(__dirname, '.node_modules/wcjs-prebuilt/bin/plugins');

Then I downloaded Stremio and unpacked it on my Win 10. Out of curiosity, I noticed that you have 'WCjs' outside of node_modules/ (which should have by default been packed into an app.asar under resources/) and of course your WCjs/ and contents should be pretty much the same as mine wcjs-prebuilt/ under node_modules/ except you have your WCjs/ under the project root and it still work (utilizing wcjs), but not mine (may due to asar pack but I doubt it)

Would really appreciate to learn from you,

  1. why you have WCjs/ outside node_modules/ (would it be because you knew it wouldn't work or you might have been through what I have thus you choose to have it outside)
  2. how did you do that, having WCjs/ outside, after electron-packager (thus asar) and still be able to refer bin/plugins?

Maybe I am totally wrong in directions, would you please help pointing me a right one? Truly appreciate.

Best regards, Neil

Nextdrive-NeilChen commented 8 years ago

after posting question here then I found out that:

https://github.com/jaruba/node-vlcPlayer-demo/issues/8

could be it, I will give it a try and come back with my findings.

Thank you.

Ivshti commented 8 years ago

The reason is simple: when vlc is inside the ASAR, it cannot really be read. To init vlc, native libraries have to be read, which is on q system level. ASAR is hacked into the high levels of electron, so it only really covers what the browser and nodejs FS module reads

Hope that helps

On Thursday, 1 September 2016, neil notifications@github.com wrote:

after posting question here then I found out that:

jaruba/node-vlcPlayer-demo#8 https://github.com/jaruba/node-vlcPlayer-demo/issues/8

could be it, I will give it a try and come back with my findings.

Thank you.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/Ivshti/wcjs-prebuilt/issues/36#issuecomment-243991091, or mute the thread https://github.com/notifications/unsubscribe-auth/ABMJjQSPRjWjw8w3gfIU_93AkULZgv7Fks5qlnU1gaJpZM4JyUJX .

Nextdrive-NeilChen commented 8 years ago

All right!! Instructions by @jaruba work out great! And thank you @Ivshti for your great work! Cheers, Neil