Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

macOS packages have missing .lproj directories which prevents getUserMedia working #524

Closed
charlielee opened this issue Jan 26, 2020 · 1 comment
Labels
bug Priority: 1

Comments

@charlielee
Copy link

I use nw-builder to build an application of mine that uses the WebRTC getUserMedia API to capture images.

The capture part of the program has stopped working in macOS Mojave and above once built with nw-builder. The issue is that the macOS's "application x" would like to use your camera prompt is not displayed when the navigator.deviceMedia.getUserMedia() function is called.

I have determined that the issue occurs because packages built with nw-builder do not include .lproj directories inside of Contents > Resources.

The fix is to simply add a method to copy these .lproj directories from the downloaded binary to the packaged application. The .strings files inside of the .lproj directories contain lots of references to Chromium and nwjs so it would be good if these could be renamed to the selected appName.

Here is a comparison between manually building the same app (as per http://docs.nwjs.io/en/latest/For%20Users/Package%20and%20Distribute/#package-your-app) and using nw-builder:

Manual build steps

  1. Download nw.js 0.43.6 from nwjs.io
  2. Copy custom app.icns and document.icns files
  3. Open the macOS package and copy an app.nw directory to Contents > Resources.
  4. Contents > Resources contains the following files:

image

Building the same app with nw-builder

  1. Run the following:
var NwBuilder = require('nw-builder');
var nw = new NwBuilder({
  "platforms": ["osx64"],
  "files": [
    "app/**",
    "icons/**",
    "package.json"
  ],
  "version": "0.43.6",
  "winIco": "icons/icon.ico",
  "macIcns": "icons/icon.icns",
  "flavor": "normal"
});

// Log stuff you want
nw.on('log',  console.log);

nw.build().then(function () {
   console.log('all done!');
}).catch(function (error) {
    console.error(error);
});
  1. Contents > Resources of the generated package contains the following:

image

@ayushmanchhabra
Copy link
Collaborator

Fixed by #389

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Priority: 1
Projects
None yet
Development

No branches or pull requests

2 participants