无论移动设备上的安全上下文/ HTTPS如何,语音邮件捕获都不再有效

问题描述 投票:0回答:1

我正在建立一个预约安排网络应用程序(类似日历),允许用户在某些时间点留下语音消息(解释),其他人可以在方便时远程检索。它在PC上运行良好,但我不能让它在移动设备上工作了。显然有新的安全上下文标准(WebRTC?)并且必须提供安全上下文,但是虽然我使用HTTPS(SSL站点/域),但我无法在任何主要浏览器中使用它。我怎样才能提供这样的安全上下文?

我附加的代码很受欢迎,并且用得很好(它仍然可以在笔记本电脑上运行!)。如何在移动电话(IOS,Android,平板电脑)上提供正确的上下文?感谢您的任何帮助。

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
});
progressive-web-apps getusermedia voice-recording
1个回答
0
投票

这可能是由于Chrome 71中的自动播放更改所致。有关详细信息,请参阅https://developers.google.com/web/updates/2017/09/autoplay-policy-changes以及https://bugs.chromium.org/p/chromium/issues/detail?id=835767

您可能希望记录audioContext.state是“正在运行”。如果没有,您需要在用户操作(例如按钮单击)上调用audioContext.resume()

© www.soinside.com 2019 - 2024. All rights reserved.