0

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.

amateur
  • 51
  • 1
  • 8

2 Answers2

1

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.

Philipp Hancke
  • 15,855
  • 2
  • 23
  • 31
  • 1
    works for me by adding a media object with both audio/video set to false [here](https://github.com/andyet/SimpleWebRTC/blob/master/index.html#L54) and joining the same room in [the demo](https://simplewebrtc.com/demo.html) – Philipp Hancke Jul 18 '16 at 11:38
  • What if she/he doesn't have any camera/microphone?? So the browser won't ask to get access to camera/microphone and the result is nothing :( – amateur Jul 18 '16 at 11:57
  • If you don't ask for the camera/mic, then it doesn't matter whether she has them or not. – jib Jul 18 '16 at 14:59
  • @jib I know, but if I don't ask, it couldn't receive either, exactly my problem is this :(. I want not to ask and receive, but if I don't ask it doesn't receive too :( – amateur Jul 19 '16 at 09:23
  • https://simplewebrtc.com/notsosimple.html#device-selection shows how to use enumerateDevices. You can also count the kinds of devices there which allows you to make a decision whether to request audio/video – Philipp Hancke Jul 19 '16 at 10:52
  • I think is mandatory to ask the user for permission. Are you saying that if I enter to your webpage you can see me without me knowing it? – Samuel Méndez Jul 19 '16 at 11:25
  • navigator.mediaDevices.enumerateDevices can not grab picture data from websites so... no. – Philipp Hancke Jul 19 '16 at 12:04
  • @SamuelMéndez If the user has no camera or mic, then `getUserMedia` should fail right away with `NotFoundError`. Catch that error and move on. Or use `enumerateDevices` to learn what the user has. See [my answer to a similar question](http://stackoverflow.com/questions/25308486/make-video-stream-optional-in-getusermedia/33770858#33770858). – jib Jul 19 '16 at 12:38
  • @jib yes, i understand that. I just wanted to make sure the OP understands the needs of asking for permission. Thanks ;) – Samuel Méndez Jul 20 '16 at 06:18
0

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

Plamen Peshev
  • 403
  • 3
  • 7
  • That's still going to ask for permission, so this doesn't seem like a good answer. – jib Jul 19 '16 at 14:10