Phonegap Javascript不要问麦克风权限

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

我使用带有WebSocket的麦克风发送音频,但iOS上的我的应用程序不要求麦克风权限,因此无法发送音频

JavaScript的

function initAudio() {

var permissions = cordova.plugins.permissions;
permissions.hasPermission(permissions.RECORD_AUDIO, function( status ){
    if ( status.hasPermission ) {

        navigator.mediaDevices.getUserMedia({'audio': true}).then(function(mediaStream) {
            gotStream(mediaStream);
        });

    }
    else {
      console.log("no");
    }
  });}

XML

    <plugin name="cordova-plugin-media" source="npm" spec="~2.4.1" />
    <plugin name="cordova-plugin-media-capture" source="npm" spec="~1.4.1" />
    <plugin name="cordova-plugin-android-permissions" source="npm"/>

<plugin name="cordova-plugin-inappbrowser" />
<plugin name="phonegap-plugin-media-recorder" />
<gap:plugin name="cordova-plugin-whitelist" source="npm" />
<preference name="phonegap-version" value="cli-7.1.0" />
<allow-intent href="http://*/*" launch-external="yes" />
<allow-intent href="https://*/*" launch-external="yes" />
<edit-config file="*-Info.plist" mode="overwrite" target="NSCameraUsageDescription">
    <string>We are using the Camera for scan qr codes</string>
</edit-config>
<edit-config file="*-Info.plist" mode="overwrite" target="NSMicrophoneUsageDescription">
    <string>We are using the mic for a streaming to a server of audio recognition</string>
</edit-config>

我能做什么?

javascript cordova phonegap
1个回答
0
投票

问题是safari上的audiocontext,这就是为什么它不要求许可

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