pwa-builder / PWABuilder-CLI

Node.js tool for App Generation
Other
1.63k stars 142 forks source link

PWABuilder can't generate Windows 10 apps with backgroundMediaPlayback capability #291

Closed JudahGabriel closed 6 years ago

JudahGabriel commented 6 years ago

It appears PWABuilder doesn't know about the Windows 10 backgroundMediaPlayback capability, and so it fails if I add that to my .appxmanifest.

My manifest has these capabilities:

<Capabilities>
    <Capability Name="backgroundMediaPlayback"/>
    <Capability Name="internetClient"/>
</Capabilities>

Running the command:

pwabuilder run windows10

Will fail with the following error:

Failed to launch the Windows 10 Platform app. Comamnd failed: [snip] D:[snip]\appxmanifest.xml. The Appx package's manifest is invalid. App manifest validation error: The app manifest must be valid as per schema: Line 54, Column 15.

Reason: 'backgroundMediaPlayback' violates enumeration constraint of 'internetClient internaetClientServer privateNetworkClientServer, allJoyn codeGeneration'.

image

@boyofgreen I'm willing to submit a PR to fix this...if I could find where this is failing. From that error message, it looks like it's in hwa, but I'm unsure where those are on GitHub.

JudahGabriel commented 6 years ago

Closing this; it's not a PWABuilder issue, but an issue in the way my capabilities were declared.

The issue is that the Capability needs to be changed to include the uap3 namespace:

    <Capabilities>
        <Capability Name="internetClient"/>
        <uap3:Capability Name="backgroundMediaPlayback" />
    </Capabilities>

And at the top of the appxmanifest, I had to add uap3 to the list of namespaces:

<Package xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10" xmlns:mp="http://schemas.microsoft.com/appx/2014/phone/manifest" xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10" xmlns:uap3="http://schemas.microsoft.com/appx/manifest/uap/windows10/3" xmlns:build="http://schemas.microsoft.com/developer/appx/2015/build" IgnorableNamespaces="uap mp build uap3">

Doing this allows me to build the app with PWABuilder.

boyofgreen commented 6 years ago

Best of luck!. BTW, we are trying to figure out the best way to formulate this, but in the fugure if you add this member to your manifest (can be done in the web flow too):

    "mjs_capabilities": [
      "picturesLibrary",
      "videosLibrary",
      "contacts",
      "webcam"
    ]

then it will add the capabilities for you into the windows app.

JudahGabriel commented 6 years ago

Whoa. Super cool. That's a future feature - not something available now?

p.s. I've now got my PWA audio app in Windows 10 store and in the Google Play store. All thanks to PWA Builder! Thanks so much for this awesome tool. I feel like more web devs need to know about this and Microsoft needs to give you a great big bonus check for making this thing. 💯

boyofgreen commented 6 years ago

that syntax is available now, but we are trying to figure out if that is the approach we want to go with for these type of things, so it might change at some point. It's really great to see your apps published! Do you mind if I share it around?

JudahGabriel commented 6 years ago

Awesome. Well, I look forward to what you guys come up with.

"Do you mind if I share it around?"

By all means! Thank you!