相关疑难解决方法(0)

NotReadableError:无法启动源代码

我在我的项目中添加了这段代码

if (navigator.mediaDevices === undefined) {
  navigator.mediaDevices = {};
}

if (navigator.mediaDevices.getUserMedia === undefined) {
  navigator.mediaDevices.getUserMedia = function (constraints) {

    var getUserMedia = (
      navigator.getUserMedia ||
      navigator.webkitGetUserMedia ||
      navigator.mozGetUserMedia
    );

    if (!getUserMedia) {
      return Promise.reject(new Error('getUserMedia is not implemented in this browser'));
    }

    return new Promise(function (resolve, reject) {
      getUserMedia.call(navigator, constraints, resolve, reject);
    });

  };
}
Run Code Online (Sandbox Code Playgroud)

然后我正在尝试使用的视频流 getUserMedia

navigator.mediaDevices.getUserMedia({
    video: true,
    audio: false
}).then(stream => {
    // do stuff
}).catch(error => {
    console.log(error.name + " " + error.message);
});
Run Code Online (Sandbox Code Playgroud)

当我在我的模拟器中测试它时,它适用于Android版本5及更高版本,但是当我在实际设备上运行时,我收到此错误 …

javascript cordova getusermedia

12
推荐指数
2
解决办法
1万
查看次数

为什么CordovaWebViewClient不再在Cordova 6中工作

我编写了自定义webviewclient类来覆盖onPageStarted, onPageFinished etccordova 3.7,它工作正常.

在下面的代码中,我已经将www目录托管到Web服务器并从那里交互cordova插件(条形码扫描器,nfc,蓝牙等).

public class MainActivity extends CordovaActivity {
    private WebView webView;

    @Override
    public void onCreate(Bundle savedInstanceState) {

        super.onCreate(savedInstanceState);
        super.init();

        loadUrl("https://example.com");
    }

    public class CustomCordovaWebViewClient extends CordovaWebViewClient {

        public CustomCordovaWebViewClient(CordovaInterface cordova, CordovaWebView view) {
            super(cordova, view);
        }

        @Override
        public void onPageStarted(WebView view, String url, Bitmap favicon) {
            super.onPageStarted(view, url, favicon);
            Log.i("CSP Log", "onPageStarted: " + url);
        }

        @Override
        public void onPageFinished(WebView view, String url) {
            super.onPageFinished(view, url);
            Log.i("CSP Log", "onPageFinished: " + url);
        }

        @Override
        public …
Run Code Online (Sandbox Code Playgroud)

android android-webview cordova

3
推荐指数
1
解决办法
2085
查看次数

渐进式Web应用程序:访问navigator.mediaDevices.getUserMedia时出错?

我的应用程序访问相机以用于webrtc,并且正常工作.

我正在使用pwacompatGoogle实验室pwa为我的网络应用添加功能.

当作为一个应用程序运行时pwa,一切正常,直到我访问相机.然后我得到这个console.log错误:

getUserMedia failedObject {type:"error",msg:"undefined不是对象(评估'navigat ..."}

getUserMedia失败类型:错误消息:undefined不是对象(评估'navigator.mediaDevices.getUserMedia')

我错过了什么?

webrtc getusermedia progressive-web-apps agora.io

1
推荐指数
1
解决办法
1591
查看次数

在ionic-webview中不允许Ionic 4 getUserMedia

这发生在离子应用的Android版本中。我正在使用iframe测试getUserMedia。webrtc的演示页面给我“ GetUserMedia:不允许的错误”。我已经在AndroidManifest.xml中授予了所有权限,但仍然无法访问相机。为了获得外部网站的摄像头访问权,还有什么需要做的吗?

home.html

<ion-content class= 'padding has-subheader'>
  <iframe class= 'webPage' name= "eventsPage" src="https://webrtc.github.io/samples/src/content/getusermedia/gum/">
 </iframe>
</ion-content>
Run Code Online (Sandbox Code Playgroud)

config.xml

<plugin name="cordova-plugin-statusbar" spec="2.4.2" />
<plugin name="cordova-plugin-device" spec="2.0.2" />
<plugin name="cordova-plugin-splashscreen" spec="5.0.2" />
<plugin name="cordova-plugin-ionic-webview" spec="^2.0.0" />
<plugin name="cordova-plugin-ionic-keyboard" spec="^2.0.5" />
<plugin name="cordova-plugin-camera" spec="^4.0.3" />
<plugin name="android-camera-permission" spec="^1.0.0" />
<plugin name="cordova-plugin-media" spec="^5.0.2" />
<plugin name="cordova-opentok-android-permissions" spec="^1.0.1" />
<plugin name="cordova.plugins.diagnostic" spec="^4.0.10" />
<plugin name="cordova-plugin-android-permissions" spec="^1.0.0" />
<plugin name="cordova-plugin-media-capture" spec="^3.0.2" />
<plugin name="cordova-plugin-compat" spec="^1.2.0" />
<plugin name="cordova-plugin-whitelist" spec="^1.3.3" />
<engine name="android" spec="7.0.0" />
Run Code Online (Sandbox Code Playgroud)

android getusermedia ionic-framework ionic4 ionic-webview

0
推荐指数
1
解决办法
1484
查看次数