0

I am building an appointment scheduling web app (calendar like) that allows users to leave voice messages (explanations) at certain time points that others can retrieve remotely at their convenience. It works well on PC but I can't get it to work on mobiles anymore. Apparently new security context standards are in place (WebRTC?) and a Secure Context must be provided, but though I am using HTTPS (SSL Site/Domain), I can't get it to work in any of the major browsers. How else can I provide such a Secure Context?

The code I attach is quite popular and used to work well (it still does on laptops!). What can I do to provide the right context on mobile-phones (IOS, Android, Tablets)? Thank you for any help.

navigator.mediaDevices.getUserMedia(constraints).then(function(stream) {
        //console.log("getUserMedia() success, stream created, initializing Speakit_recorder.js ...");
        audioContext = new AudioContext();
        //update the format 
        /*  assign to gumStream for later use  */
        gumStream = stream;
        /* use the stream */
        input = audioContext.createMediaStreamSource(stream);
        /* Create the Recorder object, configure to record mono sound(1channel). Recording 2channels  will double the file size */
        rec = new Recorder(input,{numChannels:2})
        //start the recording process                       
        rec.record();
        //console.log("Recording started");
}).catch(function(err) {                
        //do whatever is necesssary if getUserMedia() fails
});
sideshowbarker
  • 81,827
  • 26
  • 193
  • 197
Anonymouse
  • 19
  • 3

1 Answers1

0

This might be due to the autoplay changes that landed in Chrome 71. See https://developers.google.com/web/updates/2017/09/autoplay-policy-changes as well as https://bugs.chromium.org/p/chromium/issues/detail?id=835767 for details.

You might want to log audioContext.state is 'running'. If not, you need to call audioContext.resume() on a user action (such as a button click)

Philipp Hancke
  • 15,855
  • 2
  • 23
  • 31
  • Thank you Philipp, but what I seem to find on the web is that it looks like the ww web consortium (W3C) may have changed the way this works in mobiles and increased security standards. Apparently this approach is being replaced by a WebRTC based approach. I looked with https://whatwebcando.today on my mobiles and it says getUserMedia is not supported on mobiles on any browser :( – Anonymouse Apr 27 '19 at 22:13