question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

RTCView not displaying video stream

See original GitHub issue

Hi all!

After upgrading RN to 0.46.4 I’m having an issue where RTCView is not displaying my local video stream.

I’m using react-native-webrtc master@ce5f05916c9a6ff2ef7572a3da3c72b4e2d63bb1, as the current release (1.58.1) does not work with newer RN versions.

To make it easier I’ve narrowed down my component to just the bare bones:

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

import {
  RTCView,
  getUserMedia,
} from 'react-native-webrtc';

export default class TestVideoScreen extends Component {

  state = {
    localStream: null,
    localStreamUrl: null,
  };

  componentDidMount() {
    getUserMedia({
      audio: false,
      video: {
        mandatory: {},
        facingMode: 'environment',
      }
    },
      (stream => 
        this.setState({
          localStream: stream,
          localStreamUrl: stream.toURL()
        })),
      (error => console.error('getUserMedia failed with error: ' + error))
    );
  }

  render() {
    return (
      <View style={styles.container}>
        <Text>Local stream: {this.state.localStreamUrl}</Text>
        <RTCView 
          style={styles.videoFeed}
          streamURL={this.state.localStreamUrl} />
      </View>
    );
  }
}

const styles = StyleSheet.create({ 
  container: {
    flex:1,
    backgroundColor:'white',
  },
  videoFeed: {
    backgroundColor:'grey',
    flex:1,
    alignSelf:'stretch',
  },
});

Here’s what it looks like: screenshot

You can see that getUserMedia() is definitely working, as localStreamUrl has been set.

I’ve tried this both on an emulator and a real real device. 😃

Any help would be greatly appreciated!

Thanks,

Ben

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:10 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
saghulcommented, Aug 2, 2017

@8BallBomBom Thanks a lot for the help locating the problem and testing! Landed a revert in https://github.com/oney/react-native-webrtc/commit/2e1532ec1bf5aa8c948325057772725a9764f7be

1reaction
bbrcancommented, Jul 19, 2017

Thanks guys

@8BallBomBom As you suggested it seems that commit 057acf6 is the culprit here. I changed the line back to onLayout(false, getLeft(), getTop(), getRight(), getBottom()); and it worked straight away.

Read more comments on GitHub >

github_iconTop Results From Across the Web

RTCView Not Displaying Video on iOS 13.0 simulators #701
It's a remote one. Local stream runs ok. I'll try to figure out where the problem can be or give you a minimal...
Read more >
RTCView not working with remote streaming - Help
Hello all, I have a problem with use of RTCView to make a videoRoom app in react-native. Now i can send local stream...
Read more >
In react-native-webrtc in <RTCView> only video is coming ...
I am working with react-native-webrtc but I am facing one problem I am able to display video captured by the camera but the...
Read more >
react-native-webrtc-rad - npm
RTCView. However, render video stream should be used by React way. ... video specified by "streamURL" should be mirrored during rendering.
Read more >
Remote Video is blank - Google Groups
I am trying to connect Janus from React Native. Everything works fine , except the remote video is showing as blank.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found