RTCView not displaying video stream
See original GitHub issueHi 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:
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:
- Created 6 years ago
- Comments:10 (9 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@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
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.