Build of this native module should be made inside of the client-sdk for all supported platforms except win32.
For win32 we can just copy this vn-player folder to some Windows box and build it there. In such a case all needed
precompiled binaries will be downloaded automatically.
The result of the build are native modules for the node and for the electron,
which must be packetized and placed on the public available HTTPS-capable host.
All stages will be considered in detail below.

IMPORTANT!!! VN_Player.js is an important part of implementation. So it is planned by design that it should be extended
and reused in all projects that use the vn-player native addon!

--- BUILD REQUIREMENTS ---
- Prebuilt client-sdk and 3rdparty libraries for the desired platform and architecture.
- NodeJS installed
- build environment

Also please note that build is slightly different depending on the platform.


********** For *nix-like including MacOS and Linux **********

--- BUILD ---
cd client-sdk/src/nodejs/vn-player
npm run init    # initial preparation to build from source

-- build node
npm run build-node

-- build electron
npm run build-electron


--- PACKAGE ---
npm pack
npm run pack-node
npm run pack-electron

********** For Windows **********
First of all let's prepare build environment.
Simply open Powershell or Git Bash with administrator privileges and execute (it is assumed that the NodeJS is already installed):

npm install --global --production windows-build-tools

Once installed you still need to set PYTHON environment variable. Validate Python is indeed found in the correct folder:
"%USERPROFILE%\.windows-build-tools\python27\python.exe"

If so, create your (user) environment variable:
setx PYTHON "%USERPROFILE%\.windows-build-tools\python27\python.exe"

Restart cmd, and verify that variable exists via set PYTHON which should return the variable.

After such preparatory steps, let's proceed to build native module itself.


cd vn-player
npm run init    # initial preparation to build from source. Includes downloading prebuilt client-sdk

-- build node
npm run build-node

-- build electron
npm run build-electron

--- PACKAGE ---
npm pack
npm run pack-node
npm run pack-electron


As a result we have one tarball in ./ and two in build/stage .
We need to copy them manually to the public available HTTPS-capable host.
I chose our ftp for this purpose: ftp.videonext.net

Examples for x86_64-darwin arch:

scp vn-player-1.0.3.tgz <user>@ftp.videonext.net:/ftp/data/private/native-addons/
scp build/stage/node-darwin-x64.tar.gz <user>@ftp.videonext.net:/ftp/data/private/native-addons/vn_player/v1.0.3/
scp build/stage/electron-darwin-x64.tar.gz <user>@ftp.videonext.net:/ftp/data/private/native-addons/vn_player/v1.0.3/

After this is done, we can use our native module by adding it via url to some package.json:

...
"dependencies": {
    "vn-player": "https://ftp.videonext.net/private/native-addons/vn-player-1.0.3.tgz",
...


--- TEST ---
You can run the test script using any of the following commands:

npm test
node test.js


--- PREPARE SDK PREBUILT ---
This step relates more for win32 platform.
First of all build the sdk briefly like this (build environment must be configured, including installed mingw32 compiler, cmake, etc...):

cd client-sdk/3rdparty/src/
./build.sh x86_64-mingw32
cd ../../build
make -f x86_64-mingw32.mak

After that we need to pack our prebuilt package, put it to FTP or AWS S3 and add to or update vn-player package.json optional dev dependencies like this:

cd ../src/nodejs/vn-player/sdk
BUILD_TARGET=x86_64-mingw32 npm pack

If storing into FTP:
    scp vn-sdk-prebuilt-x86_64-mingw32-<12 SYMBOLS FROM LAST GIT COMMIT>-<VERSION>.tgz <user>@ftp.videonext.net:/ftp/data/private/native-addons/
If storing into AWS S3:
    aws-2.7 s3 cp vn-sdk-prebuilt-x86_64-mingw32-<12 SYMBOLS FROM LAST GIT COMMIT>-<VERSION>.tgz s3://files.titansys.com/private/native-addons/
...
"optionalDevDependencies": {
    "vn-sdk-prebuilt": "https://ftp.videonext.net/private/native-addons/vn-sdk-prebuilt-x86_64-mingw32-1db9df11b63a-1.0.0.tgz"
}
...


Good luck!;)
