You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by GitBox <gi...@apache.org> on 2020/07/10 12:20:47 UTC

[GitHub] [cordova-ios] RonnySchleicher opened a new issue #937: With Cordova and the cordova-plugin-wkwebview-engine I can no longer play sounds without direct user action when the App is installed over the official Apple App-Store!

RonnySchleicher opened a new issue #937:
URL: https://github.com/apache/cordova-ios/issues/937


   # Bug Report
   If I use the cordova-plugin-wkwebview-engine and play a soundfile, i beome follow **assertion.**
   ```
   2020-07-10 13:40:04.054571+0200 TEST[1927:49192] [assertion] Error acquiring assertion: <NSError: 0x600002e7ba80; domain: RBSAssertionErrorDomain; code: 2; reason: "Client is missing required entitlement"> {
       userInfo = {
           RBSAssertionAttribute = <RBSLegacyAttribute: 0x7fce0fd216e0; requestedReason: MediaPlayback; reason: MediaPlayback; flags: PreventTaskSuspend | PreventTaskThrottleDown | WantsForegroundResourcePriority>;
       }
   }
   ```
   This is not nice but not the real problem.
   
   If I install this app via the app store and the audio object of this sound file plays automatically without user action, for example after receiving an SIO message, the assertion causes the app to crash.
   
   The really deadly problem is that with Cordova and the cordova-plugin-wkwebview-engine I can no longer play sounds without direct user action when the App is installed  over the official Apple App-Store!
   
   ## Steps to reproduce the Assertion in X-Code
   * Install the newest X-Code Version 11.5 (11E608c) on your Mac with macOS 10.15.5 
   * Create a fresh and new Cordova App for iOS. You can use follow script:
   ```
   #!use this two lines to install the lastest cordova version 
   #!sudo npm uninstall -g cordova
   #!sudo npm install -g cordova
   rm -r PhoneGap_ios
   cordova create PhoneGap_ios de.test.test Test
   cd PhoneGap_ios
   cordova platform add ios
   cordova plugin add cordova-plugin-wkwebview-engine
   cordova plugin ls
   ```
   * Open the X-Code Project and add follow line in the cordova **index.html** (project/Staging/www/index.html):
   ```
   <input type="button" id="buttontest" value="Click me..."/>
   ```
   The complete changed **index.html** look like this:
   ```
   <!DOCTYPE html>
   <!--
       Licensed to the Apache Software Foundation (ASF) under one
       or more contributor license agreements.  See the NOTICE file
       distributed with this work for additional information
       regarding copyright ownership.  The ASF licenses this file
       to you under the Apache License, Version 2.0 (the
       "License"); you may not use this file except in compliance
       with the License.  You may obtain a copy of the License at
   
       http://www.apache.org/licenses/LICENSE-2.0
   
       Unless required by applicable law or agreed to in writing,
       software distributed under the License is distributed on an
       "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
        KIND, either express or implied.  See the License for the
       specific language governing permissions and limitations
       under the License.
   -->
   <html>
       <head>
           <!--
           Customize this policy to fit your own app's needs. For more guidance, see:
               https://github.com/apache/cordova-plugin-whitelist/blob/master/README.md#content-security-policy
           Some notes:
               * gap: is required only on iOS (when using UIWebView) and is needed for JS->native communication
               * https://ssl.gstatic.com is required only on Android and is needed for TalkBack to function properly
               * Disables use of inline scripts in order to mitigate risk of XSS vulnerabilities. To change this:
                   * Enable inline JS: add 'unsafe-inline' to default-src
           -->
           <meta http-equiv="Content-Security-Policy" content="default-src 'self' data: gap: https://ssl.gstatic.com 'unsafe-eval'; style-src 'self' 'unsafe-inline'; media-src *">
           <meta name="format-detection" content="telephone=no">
           <meta name="msapplication-tap-highlight" content="no">
           <meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width">
           <link rel="stylesheet" type="text/css" href="css/index.css">
           <title>Hello World</title>
       </head>
       <body>
           <div class="app">
               <h1>Apache Cordova</h1>
               <div id="deviceready" class="blink">
                   <p class="event listening">Connecting to Device</p>
                   <p class="event received">Device is Ready</p>
               </div>
               <input type="button" id="buttontest" value="Click me..."/>
           </div>
           <script type="text/javascript" src="cordova.js"></script>
           <script type="text/javascript" src="js/index.js"></script>
       </body>
   </html>
   ```
   
   * Open the X-Code Project and add follow line in the cordova **index.js** (project/Staging/www/js/index.js):
   ```
   onDeviceReady: function() {
           this.receivedEvent('deviceready');
           
           document.getElementById('buttontest').addEventListener('click', function() {
               console.log('Received Event click: start #############################');
               try {
                 var audio = new Audio('sounds/s1.wav');
                 audio.play();
               }
               catch(err) {
                 console.log(err.message);
               }
   
               console.log('Received Event click: end -----------------------------');
           });
       },
   ```
   
   The complete changed **index.js** look like this:
   ```
   /*
    * Licensed to the Apache Software Foundation (ASF) under one
    * or more contributor license agreements.  See the NOTICE file
    * distributed with this work for additional information
    * regarding copyright ownership.  The ASF licenses this file
    * to you under the Apache License, Version 2.0 (the
    * "License"); you may not use this file except in compliance
    * with the License.  You may obtain a copy of the License at
    *
    * http://www.apache.org/licenses/LICENSE-2.0
    *
    * Unless required by applicable law or agreed to in writing,
    * software distributed under the License is distributed on an
    * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    * KIND, either express or implied.  See the License for the
    * specific language governing permissions and limitations
    * under the License.
    */
   var app = {
       // Application Constructor
       initialize: function() {
           document.addEventListener('deviceready', this.onDeviceReady.bind(this), false);
       },
   
       // deviceready Event Handler
       //
       // Bind any cordova events here. Common events are:
       // 'pause', 'resume', etc.
       onDeviceReady: function() {
           this.receivedEvent('deviceready');
           
           document.getElementById('buttontest').addEventListener('click', function() {
               console.log('Received Event click: start #############################');
               try {
                 var audio = new Audio('sounds/s1.wav');
                 audio.play();
               }
               catch(err) {
                 console.log(err.message);
               }
   
               console.log('Received Event click: end -----------------------------');
           });
       },
   
       // Update DOM on a Received Event
       receivedEvent: function(id) {
           var parentElement = document.getElementById(id);
           var listeningElement = parentElement.querySelector('.listening');
           var receivedElement = parentElement.querySelector('.received');
   
           listeningElement.setAttribute('style', 'display:none;');
           receivedElement.setAttribute('style', 'display:block;');
   
           console.log('Received Event: ' + id);
       }
   };
   
   app.initialize();
   ```
   When I start the app on the iPhone (in this sample it is an iPhone X), the new button is showing. 
   
   <img width="450" alt="Bildschirmfoto 2020-07-10 um 14 12 49" src="https://user-images.githubusercontent.com/1914203/87153324-93a3a300-c2b7-11ea-8987-565fc85377ab.png">
   
   After click the button follow message is showing in the X-Code 
   
   ```
   2020-07-10 14:16:40.964661+0200 FAMANICE[2123:63730] Received Event click: start #############################
   2020-07-10 14:16:40.983068+0200 FAMANICE[2123:63730] Received Event click: end -----------------------------
   2020-07-10 14:16:41.101598+0200 FAMANICE[2123:63842] [assertion] Error acquiring assertion: <NSError: 0x6000029ec4b0; domain: RBSAssertionErrorDomain; code: 2; reason: "Client is missing required entitlement"> {
       userInfo = {
           RBSAssertionAttribute = <RBSLegacyAttribute: 0x7fce0fd202c0; requestedReason: MediaPlayback; reason: MediaPlayback; flags: PreventTaskSuspend | PreventTaskThrottleDown | WantsForegroundResourcePriority>;
       }
   }
   2020-07-10 14:16:41.101697+0200 FAMANICE[2123:63842] [ProcessSuspension]  0x116baab68 - ProcessAssertion() PID 2123 Unable to acquire assertion for process with PID 2123
   2020-07-10 14:16:41.101786+0200 FAMANICE[2123:63730] [ProcessSuspension] 0x116baab68 - ProcessAssertion::processAssertionWasInvalidated()
   2020-07-10 14:16:41.103452+0200 FAMANICE[2123:63842] [assertion] Error acquiring assertion: <NSError: 0x6000029dd0b0; domain: RBSAssertionErrorDomain; code: 2; reason: "Client is missing required entitlement"> {
       userInfo = {
           RBSAssertionAttribute = <RBSLegacyAttribute: 0x7fce11229040; requestedReason: MediaPlayback; reason: MediaPlayback; flags: PreventTaskSuspend | PreventTaskThrottleDown | WantsForegroundResourcePriority>;
       }
   }
   2020-07-10 14:16:41.103541+0200 FAMANICE[2123:63842] [ProcessSuspension]  0x116baabb8 - ProcessAssertion() PID 2123 Unable to acquire assertion for process with PID 2129
   2020-07-10 14:16:41.103617+0200 FAMANICE[2123:63730] [ProcessSuspension] 0x116baabb8 - ProcessAssertion::processAssertionWasInvalidated()
   ```
   
   ### What is expected to happen?
   No error message appeares.
   
   ### What does actually happen?
   The error message appeares.
   
   ### Command or Code
   see above
   
   ### Environment, Platform, Device
   * iMac17,1 with macOS 10.15.3 (19D76)
   * X-Code Version 11.4 beta (11N111s) with the related SDK 
   * iPhone X with iOS 13.4 (also tested with other iPhone with iOS 13.4) 
   * Latest Cordova Version ('5.1.1' in cordova.js)
   
   ### Version information
   see above
   
   ## Checklist
   - [x] I searched for existing GitHub issues
   - [x] I updated all Cordova tooling to most recent version
   - [x] I included all the necessary information above


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org


[GitHub] [cordova-ios] RonnySchleicher commented on issue #937: With Cordova and the cordova-plugin-wkwebview-engine I can no longer play sounds without direct user action when the App is installed over the official Apple App-Store!

Posted by GitBox <gi...@apache.org>.
RonnySchleicher commented on issue #937:
URL: https://github.com/apache/cordova-ios/issues/937#issuecomment-675525075


   @bkervaski I will try this out asap.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org


[GitHub] [cordova-ios] RonnySchleicher closed issue #937: With Cordova and the cordova-plugin-wkwebview-engine I can no longer play sounds without direct user action when the App is installed over the official Apple App-Store!

Posted by GitBox <gi...@apache.org>.
RonnySchleicher closed issue #937:
URL: https://github.com/apache/cordova-ios/issues/937


   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org


[GitHub] [cordova-ios] RonnySchleicher commented on issue #937: With Cordova and the cordova-plugin-wkwebview-engine I can no longer play sounds without direct user action when the App is installed over the official Apple App-Store!

Posted by GitBox <gi...@apache.org>.
RonnySchleicher commented on issue #937:
URL: https://github.com/apache/cordova-ios/issues/937#issuecomment-656660752


   Important NOTE:
   
   This assertion also occurs in the iPhone simulator.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org


[GitHub] [cordova-ios] RonnySchleicher commented on issue #937: With Cordova and the cordova-plugin-wkwebview-engine I can no longer play sounds without direct user action when the App is installed over the official Apple App-Store!

Posted by GitBox <gi...@apache.org>.
RonnySchleicher commented on issue #937:
URL: https://github.com/apache/cordova-ios/issues/937#issuecomment-694917830


   In my opinion it is not possible to play sounds in **the old way**.
   It is necessary to request a promise to allow a url to an audio file to be played.
   
   ### See the follow link 
   https://webkit.org/blog/7734/auto-play-policy-changes-for-macos/
   
   I solved the problem for myself by using the cordova-plugin-media
   https://cordova.apache.org/docs/en/latest/reference/cordova-plugin-media/


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org


[GitHub] [cordova-ios] breautek commented on issue #937: With Cordova and the cordova-plugin-wkwebview-engine I can no longer play sounds without direct user action when the App is installed over the official Apple App-Store!

Posted by GitBox <gi...@apache.org>.
breautek commented on issue #937:
URL: https://github.com/apache/cordova-ios/issues/937#issuecomment-693796271


   There was a known bug that affected iOS 13.2-13.3 with fix landing in iOS 13.4 that caused problems from audio playback from webviews.
   
   https://bugs.webkit.org/show_bug.cgi?id=203435
   
   No one in this thread has mentioned what iOS version they were experiencing this issue on, so it would be great if someone could help us identify that this bug is related to the WKWebView bug.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org


[GitHub] [cordova-ios] bkervaski edited a comment on issue #937: With Cordova and the cordova-plugin-wkwebview-engine I can no longer play sounds without direct user action when the App is installed over the official Apple App-Store!

Posted by GitBox <gi...@apache.org>.
bkervaski edited a comment on issue #937:
URL: https://github.com/apache/cordova-ios/issues/937#issuecomment-665043977






----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org


[GitHub] [cordova-ios] breautek commented on issue #937: With Cordova and the cordova-plugin-wkwebview-engine I can no longer play sounds without direct user action when the App is installed over the official Apple App-Store!

Posted by GitBox <gi...@apache.org>.
breautek commented on issue #937:
URL: https://github.com/apache/cordova-ios/issues/937#issuecomment-656652253


   Sounds like you need an entitlement now based on:
   
   > reason: "Client is missing required entitlement">
   
   But... there doesn't seem to be any [entitlements](https://developer.apple.com/documentation/bundleresources/entitlements) for media playback. And according to one user on [this thread](https://developer.apple.com/forums/thread/121822):
   
   > Unfortunately, from iOS 13 this ability is under sytem entitlements, com.apple.multitasking.systemappassertions and com.apple.multitasking.unlimitedassertions, you can try it in simulator, no error in log. There is no way to launch it on device thought, as you need an Apple issued provision profile. So, all we can do is to hope that some future release will fix this.
   
   I don't have a test device, so I can't really play around with this, just posting some relevant information I found while searching for potential solutions and/or workarounds.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org


[GitHub] [cordova-ios] RonnySchleicher commented on issue #937: With Cordova and the cordova-plugin-wkwebview-engine I can no longer play sounds without direct user action when the App is installed over the official Apple App-Store!

Posted by GitBox <gi...@apache.org>.
RonnySchleicher commented on issue #937:
URL: https://github.com/apache/cordova-ios/issues/937#issuecomment-661026352


   Hello.
   The problem is really very first. Are there any suggestions to solve it?


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org


[GitHub] [cordova-ios] breautek edited a comment on issue #937: With Cordova and the cordova-plugin-wkwebview-engine I can no longer play sounds without direct user action when the App is installed over the official Apple App-Store!

Posted by GitBox <gi...@apache.org>.
breautek edited a comment on issue #937:
URL: https://github.com/apache/cordova-ios/issues/937#issuecomment-693796271


   There was a known bug that affected iOS 13.1-13.5 with fix landing in iOS 13.6 that caused problems from audio playback from webviews.
   
   https://bugs.webkit.org/show_bug.cgi?id=211394
   
   No one in this thread has mentioned what iOS version they were experiencing this issue on, so it would be great if someone could help us identify that this bug is related to the WKWebView bug.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org


[GitHub] [cordova-ios] vikram1234 commented on issue #937: With Cordova and the cordova-plugin-wkwebview-engine I can no longer play sounds without direct user action when the App is installed over the official Apple App-Store!

Posted by GitBox <gi...@apache.org>.
vikram1234 commented on issue #937:
URL: https://github.com/apache/cordova-ios/issues/937#issuecomment-691608243


   Is there any fix for this issue? i have same problem, not able to play audio in background and stops after 30 seconds - 
   
   domain: RBSAssertionErrorDomain; code: 2; reason: "Client is missing required entitlement"> {
   userInfo = {
   RBSAssertionAttribute = <RBSLegacyAttribute: 0x15b115da0; requestedReason: MediaPlayback; reason: MediaPlayback; flags: PreventTaskSuspend | PreventTaskThrottleDown | WantsForegroundResourcePriority>;
   }
   }


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org


[GitHub] [cordova-ios] bkervaski commented on issue #937: With Cordova and the cordova-plugin-wkwebview-engine I can no longer play sounds without direct user action when the App is installed over the official Apple App-Store!

Posted by GitBox <gi...@apache.org>.
bkervaski commented on issue #937:
URL: https://github.com/apache/cordova-ios/issues/937#issuecomment-665043977


   Try playing a 1s silent audio file in "onDeviceReady":
   
   let silence = new Audio('res/silence.mp3')
   silence.play()


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org