Failing to access local media in react native <WebView/>

Viewed 1068

I'm learning a bit about webRTC and react-native and am trying to load the webRTC demo site inside a react-native app.

So I've put this in the index.android.js:

import React, {Component} from 'react';
import {AppRegistry, StyleSheet, Text, WebView} from 'react-native';

export default class testRTC extends Component {
  render() {
    return (
      <WebView
        source={{uri:'https://appr.tc/r/<Any random room number>'}}
        />
    );
  }
}

AppRegistry.registerComponent('testRTC', () => testRTC);

But when running react-native run-android, when the WebView loads I get the following message: "Failed to get access to local media. Error name was NotAllowedError" I've tried adding the following permissions to the AndroidManifest.xml, unsuccesfully:

    <uses-permission android:name="android.permission.CAMERA" />
    <uses-feature android:name="android.hardware.camera" />
    <uses-feature android:name="android.hardware.camera.autofocus"/>

    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
    <uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
    <uses-permission android:name="android.permission.RECORD_AUDIO" />
    <uses-permission android:name="android.permission.WAKE_LOCK" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>

I'm trying to undersatnd what I'm missing so I can load the demo app in my testRTC react-native app

1 Answers

After looking through the Android api documentation, appears that the WebView doesn't implement the underlying getUserMedia() chrome API correctly.

Source

Since the android API isn't implemented the react native api doesn't work correctly either.

Related