Microphone permission requested on receive only

381 views
Skip to first unread message

Luciano Orlandini

unread,
Oct 24, 2021, 8:09:28 AM10/24/21
to discuss-webrtc
Hi,

Sorry if my question is not clear, it's my first time submitting one.

I'm creating a C application which streams content from a USB camera using GStreamer and its webrtcbin plugin.
The stream is then received via a web browser and the code that creates the RTC peer connection and all is in Javascript.

When setting up the GStreamer pipeline, I ensure to be manually setting the transceivers to "send only", meaning the web browser will only receive media. Additionally, I am only sending a video stream. No audio at all.

This set up is running locally without TLS.

Despite that, the web browser still requires that I enable microphone access during signalling before establishing the connection. If the mic is enabled, the connection works fine and I receive the video stream. If it's disabled, it does not work.

Considering this is http only, I have to set a flag in the browser to make this actually possible, by recognising the localhost as "secure".

The Javascript code does not include any getUserMedia() calls nor adds any tracks, except for the peerConnection.ontrack event listener to play the stream received.

Am I missing something obvious or is there a way to ensure the application does not ask for any permission?

Thanks

Vitaly Ivanov

unread,
Oct 24, 2021, 9:27:41 PM10/24/21
to discuss...@googlegroups.com
I'm working on a similar thing, it's native webrtc C++ API instead of GStreamer though, never seen this issue. At least with Chrome/Chromium on the client side

--

---
You received this message because you are subscribed to the Google Groups "discuss-webrtc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to discuss-webrt...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/discuss-webrtc/2aa526f8-8b64-4572-9445-886b98a438e3n%40googlegroups.com.

guest271314

unread,
Oct 25, 2021, 5:38:22 PM10/25/21
to discuss-webrtc
Can you link to the JavaScript code?

Luciano Orlandini

unread,
Nov 10, 2021, 4:54:32 AM11/10/21
to discuss-webrtc

Thanks for your responses so far.
The js code has a lot of other things that would just be confusing if I shared. so I'll include just the relevant functions... 

Just as a note, when changing the browser flag to accept http as secure and manually allowing either camera or audio, it works perfect. I just want it to skip the step of asking permission as it is not needed. 

Another note, I'm using Svelte, hence the $ you see, so just ignore.

function createRTCPeerConnection() {
        console.log("*Creating RTCPeerConnection*");
        $peerConnection = new RTCPeerConnection();
        $peerConnection.ondatachannel = (event) => {
            $dataChannel = event.channel;
            $dataChannel.onopen = dataChannelOpen;
            $dataChannel.onmessage = dataChannelMessage;
            $dataChannel.onerror = dataChannelError;
            $dataChannel.onclose = dataChannelClose;
        };
        $peerConnection.ontrack = (event) => {
            if ($videoStream.srcObject !== event.streams[0]) {
                $videoStream.srcObject = event.streams[0];
            }
        };
        $peerConnection.onicecandidate = (event) => {
            if (event.candidate == null) {
                console.log("*All ICE candidates gathered*");
                return;
            }
            var ice = {'ice': event.candidate};
            fetch('/api/rice', {
                method: 'PUT',
                headers: {
                    'Content-Type': 'application/json'
                },
                body: JSON.stringify(ice)  
            });
            console.log("*ICE candidate sent*");  
        };
    }

Now follow an example of the offer sent by the C application:

v=0 o=- 5683312150702073703 0 IN IP4 0.0.0.0 s=- t=0 0 a=ice-options:trickle a=group:BUNDLE video0 application1 m=video 9 UDP/TLS/RTP/SAVPF 96 c=IN IP4 0.0.0.0 a=setup:actpass a=ice-ufrag:Ztbgaa1pyn+z3kU/5BgkEYmGoVIGsSK6 a=ice-pwd:YXZ3YmHyBVwIGvjurVvig+LLHlUSgW00 a=rtcp-mux a=rtcp-rsize a=sendonly a=rtpmap:96 VP8/90000 a=rtcp-fb:96 nack pli a=ssrc:3525767168 msid:user1680094828@host-731c8bb3 webrtctransceiver0 a=ssrc:3525767168 cname:user1680094828@host-731c8bb3 a=mid:video0 a=fingerprint:sha-256 6C:09:C8:5B:13:53:90:D1:E8:28:19:E5:69:8A:3F:57:D0:04:26:D1:44:32:4B:B7:C6:A0:74:58:99:AC:A6:36 m=application 0 UDP/DTLS/SCTP webrtc-datachannel c=IN IP4 0.0.0.0 a=setup:actpass a=ice-ufrag:Ztbgaa1pyn+z3kU/5BgkEYmGoVIGsSK6 a=ice-pwd:YXZ3YmHyBVwIGvjurVvig+LLHlUSgW00 a=bundle-only a=mid:application1 a=sctp-port:5000 a=fingerprint:sha-256 6C:09:C8:5B:13:53:90:D1:E8:28:19:E5:69:8A:3F:57:D0:04:26:D1:44:32:4B:B7:C6:A0:74:58:99:AC:A6:36

And the answer sent by the browser, which does state 'recvonly'

v=0 o=- 393586954441480955 2 IN IP4 127.0.0.1 s=- t=0 0 a=group:BUNDLE video0 application1 a=msid-semantic: WMS m=video 9 UDP/TLS/RTP/SAVPF 96 c=IN IP4 0.0.0.0 a=rtcp:9 IN IP4 0.0.0.0 a=ice-ufrag:FnE2 a=ice-pwd:JGXFZkcwnQ6gODUrTwkU5xAb a=ice-options:trickle a=fingerprint:sha-256 BC:37:31:59:7D:8F:AE:96:B6:41:00:2B:96:A3:47:9B:2F:1E:20:73:53:A6:62:11:DE:0A:7D:D1:9A:4E:7F:49 a=setup:active a=mid:video0 a=recvonly a=rtcp-mux a=rtcp-rsize a=rtpmap:96 VP8/90000 a=rtcp-fb:96 nack pli m=application 9 UDP/DTLS/SCTP webrtc-datachannel c=IN IP4 0.0.0.0 a=ice-ufrag:FnE2 a=ice-pwd:JGXFZkcwnQ6gODUrTwkU5xAb a=ice-options:trickle a=fingerprint:sha-256 BC:37:31:59:7D:8F:AE:96:B6:41:00:2B:96:A3:47:9B:2F:1E:20:73:53:A6:62:11:DE:0A:7D:D1:9A:4E:7F:49 a=setup:active a=mid:application1 a=sctp-port:5000

Thanks!

guest271314

unread,
Nov 10, 2021, 7:53:26 PM11/10/21
to discuss-webrtc
Where is microphone permission requested given getUserMedia() is not called in the browser?

Neil Young

unread,
Nov 10, 2021, 8:45:53 PM11/10/21
to discuss-webrtc
I would also claim that nobody would ask you for any permission unless you are explicitly calling getUserMedia(). Some component in your JS code must be doing this. Also, your offer is perfectly sendonly, there is no need for the browser to touch any media input at all.

Luciano Orlandini

unread,
Nov 26, 2021, 3:45:24 AM11/26/21
to discuss-webrtc
Yes, that is my point exactly. My offer is sendonly exclusively and I don't have any getUserMedia() calls, but still, it will only work once I allow for either video or microphone... Very strange

Harald Alvestrand

unread,
Nov 26, 2021, 4:05:38 AM11/26/21
to discuss...@googlegroups.com
1) You shouldn't use HTTP.

2) You probably have a local network setup where MDNS does not work. This means that unless you get Chrome to reveal IP addresses to your application, you won't get local connetions to work. One way to achieve that is to request camera/microphone permission. 


There's a tracking bug for the spec issue: https://github.com/w3c/webrtc-extensions/issues/87


Reply all
Reply to author
Forward
0 new messages