using Webview in react native to share live video from raspberry pi

Viewed 591

Hi Im trying to use webview to share live video in my android app from localhost:8000, Im capturing video with raspberry pi camera and than sharing it to localhost. On site it looks like this: enter image description here

BUT in my android app I can see just white screen, I have installed react webview, connected it and Im using correct IP, any idea what could be the problem?

renderCamera = () => {
        return (<WebView
            source={{uri: "http://"+"mylocalip"+":8000"}}
            style={{flex: 1}}
            //javaScriptEnabled={true}
            //domStorageEnabled={true}
            //startInLoadingState={true}
        />);
}

<View style={styles.topContainer}>
       {this.renderCamera()}
</View>

1 Answers

Try this

<View>
      <WebView
        automaticallyAdjustContentInsets={true}
        scalesPageToFit={true}
        startInLoadingState={false}
        contentInset={{ top: 0, right: 0, left: 0, bottom: 0 }}
        scrollEnabled={false}
        source={{ uri: 'http://mylocalip:8000/stream.mjpg' }} />
    </View>
Related