RTC doesn't render video on android










0















I am working on RTC Oney Example
I have used the most basic example but still i am unable to view my localstream in RTC view, I dont see any error on logs, Can anyone help me what am i doing wrong?



Here is my code :



'use strict';

import React from 'react';
import
Platform,
Animated,
StyleSheet,
View,
Text
from 'react-native';

import
RTCPeerConnection,
RTCIceCandidate,
RTCSessionDescription,
RTCView,
MediaStream,
MediaStreamTrack,
getUserMedia
from 'react-native-webrtc'

export default class WebRTC extends React.Component

state =
videoURL: null,
isFront: true


componentDidMount()
const configuration = "iceServers": [ "url": "stun:stun.l.google.com:19302" ] ;
const pc = new RTCPeerConnection(configuration);
const isFront = this.state;
MediaStreamTrack.getSources(sourceInfos =>
console.log('MediaStreamTrack.getSources', sourceInfos);
let videoSourceId;
for (let i = 0; i < sourceInfos.length; i++)
const sourceInfo = sourceInfos[i];
if (sourceInfo.kind === 'video' && sourceInfo.facing === (isFront ? 'front' : 'back'))
videoSourceId = sourceInfo.id;


getUserMedia(
audio: true,
video:
mandatory:
minWidth: 500,
minHeight: 500
,
facingMode: (isFront ? 'user' : 'environment'),
optional: (videoSourceId ? [ sourceId: videoSourceId ] : )

, (stream) =>
console.log('Streaming OK', stream);
this.setState(
videoURL: stream.toURL()
);
pc.addStream(stream);
, error =>
console.log('Oops, we getting error', error.message);
throw error;
);
);
pc.createOffer((desc) =>
pc.setLocalDescription(desc, () =>
console.log('pc.setLocalDescription');
, (e) => throw e; );
, (e) => throw e; );

pc.onicecandidate = (event) =>
console.log('onicecandidate', event);
;



render()
if (this.state.videoURL)
console.warn(this.state.videoURL);
return (
<View style=styles.container>
<Text style=styles.text>Working On Web RTC</Text>
<RTCView streamURL=this.state.videoURL />
</View>

);

else
return (
<View>
<Text style=styles.text>Not Working On Web RTC</Text>
</View>

);




const styles =
text:
textAlign: "center"
,
container:
flex: 1,
backgroundColor: '#ccc',
borderWidth: 1,
borderColor: '#000'

;


It says that I need to use a signaling server, But i followed this tutorial and its working without any signaling server.




I am using : react-native-cli: 2.0.1 react-native: 0.57.4











share|improve this question






















  • Issue is solved, I just need to add new style for RTCView : flex: 1

    – Bilal Zafar
    Nov 14 '18 at 8:48















0















I am working on RTC Oney Example
I have used the most basic example but still i am unable to view my localstream in RTC view, I dont see any error on logs, Can anyone help me what am i doing wrong?



Here is my code :



'use strict';

import React from 'react';
import
Platform,
Animated,
StyleSheet,
View,
Text
from 'react-native';

import
RTCPeerConnection,
RTCIceCandidate,
RTCSessionDescription,
RTCView,
MediaStream,
MediaStreamTrack,
getUserMedia
from 'react-native-webrtc'

export default class WebRTC extends React.Component

state =
videoURL: null,
isFront: true


componentDidMount()
const configuration = "iceServers": [ "url": "stun:stun.l.google.com:19302" ] ;
const pc = new RTCPeerConnection(configuration);
const isFront = this.state;
MediaStreamTrack.getSources(sourceInfos =>
console.log('MediaStreamTrack.getSources', sourceInfos);
let videoSourceId;
for (let i = 0; i < sourceInfos.length; i++)
const sourceInfo = sourceInfos[i];
if (sourceInfo.kind === 'video' && sourceInfo.facing === (isFront ? 'front' : 'back'))
videoSourceId = sourceInfo.id;


getUserMedia(
audio: true,
video:
mandatory:
minWidth: 500,
minHeight: 500
,
facingMode: (isFront ? 'user' : 'environment'),
optional: (videoSourceId ? [ sourceId: videoSourceId ] : )

, (stream) =>
console.log('Streaming OK', stream);
this.setState(
videoURL: stream.toURL()
);
pc.addStream(stream);
, error =>
console.log('Oops, we getting error', error.message);
throw error;
);
);
pc.createOffer((desc) =>
pc.setLocalDescription(desc, () =>
console.log('pc.setLocalDescription');
, (e) => throw e; );
, (e) => throw e; );

pc.onicecandidate = (event) =>
console.log('onicecandidate', event);
;



render()
if (this.state.videoURL)
console.warn(this.state.videoURL);
return (
<View style=styles.container>
<Text style=styles.text>Working On Web RTC</Text>
<RTCView streamURL=this.state.videoURL />
</View>

);

else
return (
<View>
<Text style=styles.text>Not Working On Web RTC</Text>
</View>

);




const styles =
text:
textAlign: "center"
,
container:
flex: 1,
backgroundColor: '#ccc',
borderWidth: 1,
borderColor: '#000'

;


It says that I need to use a signaling server, But i followed this tutorial and its working without any signaling server.




I am using : react-native-cli: 2.0.1 react-native: 0.57.4











share|improve this question






















  • Issue is solved, I just need to add new style for RTCView : flex: 1

    – Bilal Zafar
    Nov 14 '18 at 8:48













0












0








0


1






I am working on RTC Oney Example
I have used the most basic example but still i am unable to view my localstream in RTC view, I dont see any error on logs, Can anyone help me what am i doing wrong?



Here is my code :



'use strict';

import React from 'react';
import
Platform,
Animated,
StyleSheet,
View,
Text
from 'react-native';

import
RTCPeerConnection,
RTCIceCandidate,
RTCSessionDescription,
RTCView,
MediaStream,
MediaStreamTrack,
getUserMedia
from 'react-native-webrtc'

export default class WebRTC extends React.Component

state =
videoURL: null,
isFront: true


componentDidMount()
const configuration = "iceServers": [ "url": "stun:stun.l.google.com:19302" ] ;
const pc = new RTCPeerConnection(configuration);
const isFront = this.state;
MediaStreamTrack.getSources(sourceInfos =>
console.log('MediaStreamTrack.getSources', sourceInfos);
let videoSourceId;
for (let i = 0; i < sourceInfos.length; i++)
const sourceInfo = sourceInfos[i];
if (sourceInfo.kind === 'video' && sourceInfo.facing === (isFront ? 'front' : 'back'))
videoSourceId = sourceInfo.id;


getUserMedia(
audio: true,
video:
mandatory:
minWidth: 500,
minHeight: 500
,
facingMode: (isFront ? 'user' : 'environment'),
optional: (videoSourceId ? [ sourceId: videoSourceId ] : )

, (stream) =>
console.log('Streaming OK', stream);
this.setState(
videoURL: stream.toURL()
);
pc.addStream(stream);
, error =>
console.log('Oops, we getting error', error.message);
throw error;
);
);
pc.createOffer((desc) =>
pc.setLocalDescription(desc, () =>
console.log('pc.setLocalDescription');
, (e) => throw e; );
, (e) => throw e; );

pc.onicecandidate = (event) =>
console.log('onicecandidate', event);
;



render()
if (this.state.videoURL)
console.warn(this.state.videoURL);
return (
<View style=styles.container>
<Text style=styles.text>Working On Web RTC</Text>
<RTCView streamURL=this.state.videoURL />
</View>

);

else
return (
<View>
<Text style=styles.text>Not Working On Web RTC</Text>
</View>

);




const styles =
text:
textAlign: "center"
,
container:
flex: 1,
backgroundColor: '#ccc',
borderWidth: 1,
borderColor: '#000'

;


It says that I need to use a signaling server, But i followed this tutorial and its working without any signaling server.




I am using : react-native-cli: 2.0.1 react-native: 0.57.4











share|improve this question














I am working on RTC Oney Example
I have used the most basic example but still i am unable to view my localstream in RTC view, I dont see any error on logs, Can anyone help me what am i doing wrong?



Here is my code :



'use strict';

import React from 'react';
import
Platform,
Animated,
StyleSheet,
View,
Text
from 'react-native';

import
RTCPeerConnection,
RTCIceCandidate,
RTCSessionDescription,
RTCView,
MediaStream,
MediaStreamTrack,
getUserMedia
from 'react-native-webrtc'

export default class WebRTC extends React.Component

state =
videoURL: null,
isFront: true


componentDidMount()
const configuration = "iceServers": [ "url": "stun:stun.l.google.com:19302" ] ;
const pc = new RTCPeerConnection(configuration);
const isFront = this.state;
MediaStreamTrack.getSources(sourceInfos =>
console.log('MediaStreamTrack.getSources', sourceInfos);
let videoSourceId;
for (let i = 0; i < sourceInfos.length; i++)
const sourceInfo = sourceInfos[i];
if (sourceInfo.kind === 'video' && sourceInfo.facing === (isFront ? 'front' : 'back'))
videoSourceId = sourceInfo.id;


getUserMedia(
audio: true,
video:
mandatory:
minWidth: 500,
minHeight: 500
,
facingMode: (isFront ? 'user' : 'environment'),
optional: (videoSourceId ? [ sourceId: videoSourceId ] : )

, (stream) =>
console.log('Streaming OK', stream);
this.setState(
videoURL: stream.toURL()
);
pc.addStream(stream);
, error =>
console.log('Oops, we getting error', error.message);
throw error;
);
);
pc.createOffer((desc) =>
pc.setLocalDescription(desc, () =>
console.log('pc.setLocalDescription');
, (e) => throw e; );
, (e) => throw e; );

pc.onicecandidate = (event) =>
console.log('onicecandidate', event);
;



render()
if (this.state.videoURL)
console.warn(this.state.videoURL);
return (
<View style=styles.container>
<Text style=styles.text>Working On Web RTC</Text>
<RTCView streamURL=this.state.videoURL />
</View>

);

else
return (
<View>
<Text style=styles.text>Not Working On Web RTC</Text>
</View>

);




const styles =
text:
textAlign: "center"
,
container:
flex: 1,
backgroundColor: '#ccc',
borderWidth: 1,
borderColor: '#000'

;


It says that I need to use a signaling server, But i followed this tutorial and its working without any signaling server.




I am using : react-native-cli: 2.0.1 react-native: 0.57.4








android react-native webrtc






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 14 '18 at 7:59









Bilal ZafarBilal Zafar

333214




333214












  • Issue is solved, I just need to add new style for RTCView : flex: 1

    – Bilal Zafar
    Nov 14 '18 at 8:48

















  • Issue is solved, I just need to add new style for RTCView : flex: 1

    – Bilal Zafar
    Nov 14 '18 at 8:48
















Issue is solved, I just need to add new style for RTCView : flex: 1

– Bilal Zafar
Nov 14 '18 at 8:48





Issue is solved, I just need to add new style for RTCView : flex: 1

– Bilal Zafar
Nov 14 '18 at 8:48












0






active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53295422%2frtc-doesnt-render-video-on-android%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53295422%2frtc-doesnt-render-video-on-android%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







這個網誌中的熱門文章

Barbados

How to read a connectionString WITH PROVIDER in .NET Core?

Node.js Script on GitHub Pages or Amazon S3