Skip to content

crewtimer/crewtimer-video-review

Repository files navigation

CrewTimer Video Review

CrewTimer Video Review is built using Electron, and specificlly the Electron React Boilerplate Project.

See the VSCode plugins suggested here.

For an internal code overview, see INTERNALS.md.

Development Environment Setup

Node version 18 or later is recommended.

Quickstart

nvm install 18
nvm use 18
nvm alias default v18
npm i -g node-gyp@latest
npm i -g yarn
npm i -g ts-node

git clone git@github.com:crewtimer/crewtimer-video-review.git
yarn install
yarn start

If the build fails with a node-gyp error, be sure node-gyp is installed globally.

The crewtimer_video_reader native module contains pre-built binaries for mac and win targets. If this repo is private, a github token is required to retrieve the pre-built binaries.

  1. Obtain your github token
  2. Add it to ~/.prebuild-installrc
  3. e.g. token=ghp_8bh6rSO2EhGf3nVCgY4GrEvs1dqd324
  • For firebase, edit webpack.config.renderer.dev.dll.ts and modify renderer field entry: { renderer: Object.keys(dependencies || {}).filter((it) => it !== 'firebase'), }, . See stackoverflow for issue it resolves.
  • In resolve: section of , add fallback: { path: require.resolve('path-browserify'), }, to make path available from the renderer.

Native modules

A native module is used to read mp4 files from storage using the ffmpeg and opencv libraries. This code is prebuilt and stored on github.

To make updates to the native code, see Instructions for the native video reader. Access to both windows and Mac is required. Parallels Desktop on Mac works well as a windows VM.

Debugging

Starting from VSCode seems broke. Try this command line

yarn "start:main" "--inspect=5858" "--remote-debugging-port=9223"

Open dev window with releases code:

yarn cross-env DEBUG_PROD=true yarn package

See also the Electron React Boilerplate page.

File Locations

Windows

  • CrewTimer.db No longer correct: C:\Users\glenne\AppData\Local\Programs\crewtimer-fl-connector\CrewTimer.db
  • Images and assets C:\Users\glenne\AppData\Local\Programs\crewtimer-fl-connector\resources\assets
  • config.json C:\Users\glenne\AppData\Roaming\CrewTimer Video Review\ct-video-review.json
  • applog.txt C:\Users\glenne\AppData\Roaming\CrewTimer Video Review\applog.txt

MacOS

  • CrewTimer.db '/Users/glenne/Library/Application Support/Electron/CrewTimer.db'
  • config.json debug: '/Users/glenne//Library/Application Support/Electron/ct-video-review.json'
  • config.json installed: '/Users/glenne/Library/Application Support/crewtimer-video-review/ct-video-review.json'
  • applog.txt installed: '/Users/glenne/Library/Application Support/crewtimer-video-review/applog.txt'

Releasing new versions

  1. Edit release/app/package.json and adjust version info
  2. Edit WhatsNew.md
  3. Execute yarn clean && yarn install && yarn build:mac && yarn build:win
  4. Look in release/ for the dmg and exe files
  5. Copy the dmg and exe to a Releases set on github

Windows packaging notes

When packaging on Windows from a locally-built native module (i.e. you've just rebuilt crewtimer_video_reader.node from source per native/ffreader/README.md), don't run yarn build:win directly — run electron-builder yourself with -c.npmRebuild=false:

yarn build                                                    # main + renderer webpack bundles
./node_modules/.bin/electron-builder --win -c.npmRebuild=false

The -c.npmRebuild=false flag is required for two reasons:

  1. sqlite3 source rebuild is broken. Without the flag, electron-builder tries to rebuild every native dep against the electron ABI. sqlite3@5.1.7 has no prebuilt for current N-API versions, falls back to node-gyp rebuild, which fails because sqlite3's bundled node-gyp install is broken.
  2. Your locally-built crewtimer_video_reader.node gets silently clobbered. Even with prebuild-install -r napi || yarn rebuild as the install script, electron-builder's rebuild step runs prebuild-install --force for every native dep, which downloads the published prebuilt from GitHub and overwrites your file at release/app/node_modules/crewtimer_video_reader/build/Release/. The packaged app then behaves like the stock release, not your source. No error is shown; watch for this builder log line as a warning sign:
    • install prebuilt binary  name=crewtimer_video_reader version=...
    
    The line you want to see is:
    • skipped dependencies rebuild  reason=npmRebuild is set to false
    

If you've already been bitten, re-copy the freshly-built .node per the ffreader README's step 7, then re-run electron-builder with the flag, or use ./node_modules/.bin/electron-builder --win --prepackaged release/build/win-unpacked to re-zip without touching deps.

Outputs in release/build/: win-unpacked/ (portable directory, ~346 MB) and CrewTimer Video Review Setup <version>.exe (NSIS installer, ~96 MB).

Tips

Using opencv for frame interpolation

Code signing for MacOS

In order to install apps downloaded outside the app store without diving into security exception settings, apps must be signed and notarized. This process takes several minutes as the binary must be uploaded to Apple to get notarized. To disable notariztion during development, set "notarize" : "false" in the build.mac section of package.json

Requirements for signing:

  1. A 'Developer ID Application' signing identity certificate as well as it's associated private key to be in the keychain.
  2. Signing credentials with app specific password stored in the keychain.

You can verify you have a valid signing identity with command below. It should list a key such as "Developer ID Application: Entazza LLC (P87Q63DNL4)".

security find-identity -v -p codesigning

Create an app specific password: Sign in at appleid.apple.com with your Apple ID.

  1. Under Security, find App-Specific Passwords and click Generate Password….
  2. Enter a label (e.g., “notarize-script”) and click Create.
  3. Copy the generated password (one-time view) and paste it into the command below

Once you have obtained an app specific password from your developer account, store it into the keychain with this command:

xcrun notarytool store-credentials "crewtimer-app-signing" --apple-id "glenne@engel.org" --team-id P87Q63DNL4 --password app-specific-passord-hash

Signing is configured by setting the env variable APPLE_KEYCHAIN_PROFILE to the name of the profile in the keychain that has the credentials. See macPackager.js and notarize for other options.

If notarization fails, add console.log info to macPackager.js.

Note: As of 12/2024 the notarize.js script in .erb/scripts is not utilized.

About

Utility app for connecting to FinishLynx or recorded video

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

 
 
 

Contributors