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

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.

Related

Low latency RTMP playback with video.js

i'am trying to play a RTMP stream with low latency uinsg HTML5, vido.js and videojs-flash. For now i can get the stream to display with a 3-4 seconds latency but playing the same stream with ffplay gives a sub-second latency.
Looking at older videojs version it seems that some code that allowed to specify flashvars to be passed to the swf object were never merged. In newer video.js version, one can use the videojs-flash plugin to play a flash video and this plugin seems to support flashVars in the player options and this vars are passed to the swf object.
Did anyone used this feature and how can i provide the flashVars option to the videojs object .
This is the code i tried so far :
var player = videojs('my-video', {
autoplay: true,
muted: true,
preload: "auto",
sources: [{
type: "rtmp/flv",
}],
flashVars: {
buffertime: 0
}
});
if found an answer to my own question that reduces the latency quite a lot. It's not very stable for now since i sometimes get ~1s latency but can go up to 3s. The solution is to use a patched swf that will interpre take into account the buffering options. Now the player initialization becomes:
var player = videojs('my-video', {
techOrder: ['flash'],
autoplay: true,
sources: [{
type: "rtmp/flv",
}],
bufferTime: 0,
flash: {
swf: "js/video-js.swf",
flashVars: {
bufferTime: 0,
autoPlay: true,
bufferTimeMax: 0.25
}
}
});
the video-js.swf is compiled from the patched version at :
https://github.com/sea-kg/video-js-swf.git
Just compile this version and use the "swf:" flash option to provide the path to this swf.
This reduces the latency significantly but in my experience, the latency can vary per connection.

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.

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

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()

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}