0 Replies
      Latest reply on Nov 24, 2019 5:03 AM by HenryChinaski123
      HenryChinaski123 Level 1 Level 1 (0 points)

        Hi guys!

         

        I programmed a script (JS) that allows visitors of our website to record audio and then saves the file on our server.

        Everything seemed to work fine, until I noticed, that if a user did not give his permission but presses the recording button anyway, the script crashed. Therefore I included this to make sure that permission was granted:

         

        navigator.permissions.query({name:'microphone'}).then(function(result) {
        if (result.state == 'granted') {
        //GRANTED
        } else if (result.state == 'denied') {
          //DENIED
        }
        });

         

        Unfortunately, this does not work for iOS Safari and therefore leads to a crash. I found several threads via google about this topic but not a single solution for iOS. There must be one, right? How should we record audio on an iPhone if we cant make sure that the permission was granted and if recording - while under denial of microphone access - also leads to a crash?

         

        I hope anyone has an Idea... Thanks in advance!

        Daniel