Can I receive video without giving permission to browser to use my camera in SimpleWebRTC? - webrtc

Does SimpleWebRTC has this feature to get data(video/audio) without giving permission to browser to use my camera/microphone?
// create our webrtc connection
var webrtc = new SimpleWebRTC({
// the id/element dom element that will hold "our" video
localVideoEl: 'localVideo',
// the id/element dom element that will hold remote videos
remoteVideosEl: '',
// immediately ask for camera access
**autoRequestMedia: true,**
debug: true,
detectSpeakingEvents: true,
autoAdjustMic: false,
media: {
video: false,
**audio: true**
},
});
When I change those parts surrounded by asterisks to true it works, otherwise it doesn't.

Have you tried setting autoRequestMedia to true and while having both video and audio of the media object set to false? You should receive the readyToCall event and can join the room as shown on the simplewebrtc homepage.

First negotiate (accept the call/join the room) with video and audio and then disable the video, somehting like webrtc.videoStreams.disable()

Related

WebRTC what is the correct way to removeStream and addStream again

My RTC session was started with text only. And video is added by user when needed (renegotiation)
navigator.getUserMedia({ video: true, audio: false }, function (myStream) {
localVideo[0].srcObject = myStream;
myConn.addStream(myStream);
}, function (error) {
console.log(error);
});
When user do not need the video session anymore, I remove using:
var tracks = localVideo[0].srcObject.getTracks();
tracks.forEach(function (t) {
t.stop();
});
myConn.removeStream(localVideo[0].srcObject);
localVideo[0].srcObject = null;
Everything is working fine, until I try to add the video again I noticed that the createOffer() request size is getting larger and larger.
Seems to me that WebRTC didn't forget about the previous stream, and is adding to the offer again and again. Or maybe my way of removing a video stream / track is wrong?
This is a known issue see this thread on the W3C list.
The best way to get around this is to use replaceTrack and is suggested in the thread.
Note: It is still possible to prevent the list of transceivers from growing
by *manually* recycling them using transceiver.sender.replaceTrack() and
transceiver.direction, but that still wastes resources on transceivers
currently not used, and implies you probably shouldn't use
transceiver.stop() in most cases.
Also see the "Unified Plan" Transition Guide

I'm trying to implement Screenshare but getting this error: MediaError "Access to screen denied"

I am using the Web SDK for Agora.io and trying to implement video chat feature and have screen sharing enabled. However, I am getting this issue:
MediaError "Access to screen denied
Seems like your web page does not have the right to access the device. Not sure which browser you are working with. If your browser is Chrome/Chromium, try: Change site permissions.
Or test your browser with their tools: Agora Web Trouble shooting, Agora Web Demo
You can use Chrome or Firefox with Agora.io to screenshare. Make sure that you are deploying to HTTPS.
Firefox:
screenStream = AgoraRTC.createStream({
streamID: uid,
audio: false,
video: false,
screen: true,
mediaSource: 'screen' // 'screen', 'application', 'window'
});
Chrome:
screenStream = AgoraRTC.createStream({
streamID: uid,
audio: false,
video: false,
screen: true,
//chrome extension ID
extensionId: 'EXTENTION-ID-HERE'
});
Are you using Chrome? Check a few things:
Check that the extension ID matches
Check the domain name matches in the manifest.json file
Chrome Plugin Reference page

How to receive audio/video without accepting the autorequest popup in WebRTC?

I want to receive audio/video without accepting the permission that browser asks to access mic/cam. Is it possible?
I'm using SimpleWebRTC, my code is here:
// create our webrtc connection
var webrtc = new SimpleWebRTC({
// the id/element dom element that will hold "our" video
localVideoEl: 'localVideo',
// the id/element dom element that will hold remote videos
remoteVideosEl: '',
// immediately ask for camera access
autoRequestMedia: true,
debug: false,
detectSpeakingEvents: true,
autoAdjustMic: false,
media: {
video: {
frameRate: {
max: 30
},
width: {
max: 176
},
height: {
max: 144
}
},
audio: true
},
});
If I delete this => autoRequestMedia: true or change it to false, so it doesn't ask to get permission and the result is NOTHING
:(
If I leave this => autoRequestMedia: true to be true, so the browser asks to get permission,
2-1: if I don't accept, the result is NOTHING :(
2-2: if I accept, it works :)
So my problem is how I can receive(not send) data(audio/video) without accepting that permission popup or even set that autoRequestMedia to false and receive data?
Thanks
This is a browser restriction. Otherwise any application could open your devices silently in the background and listen for you.
However it is possible to call getUserMedia() only once at your app start (this is where the popups appears) and reuse that onward everywhere thus preventing any additional popups at incoming audio/video.

WebRTC video: false on one user turns video off for both

I am having a strange issue with WebRTC.
Two peers are connected through RTCPeerConnection.
One with getusermedia {video: false, audio: true}
and the other getusermedia {video: true, audio: true}
The problem is that video is turned off for both!
Is this normal behavior or am I doing something wrong?
I am using adapter.js from https://github.com/Temasys/AdapterJS/blob/master/source/adapter.js
Make sure you call createOffer with {offerToReceiveAudio: 1, offerToReceiveVideo: 1}, especially if the user that does not request video is creating the connection.

WebRTC infintive voice loop

When i start my webcam in WebRTC, sound is going to loop and very tiny voice starting.
navigator.getUserMedia({audio: true, video: true}, function(stream){
window.localStream = stream;
stream.getAudioTracks()[0].enabled = false;
stream.getVideoTracks()[0].enabled = true;
$('#my-video').prop('src', URL.createObjectURL(stream));
}
This solution is disabling all audio. I just want to mute only "stream" audio not window.localSream so send audio remote.
Not quite sure what you mean by "sound is going to loop and very tiny voice starting". Do you mean the voice is too low and you hear echoing?
In your code, the audio track is still in your localStream, but just not rendered by disabling it, so the other end user will not hear any voice from you, you can also turn it on on fly but enable it, and your voice will be heard again.
To not include audio at all, you will have to set your constraints like {audio: false, video: true}