Re: [rtcweb] determining mic/webcam availability on page load

Harald Alvestrand <harald@alvestrand.no> Mon, 23 September 2013 05:06 UTC

Return-Path: <harald@alvestrand.no>
X-Original-To: rtcweb@ietfa.amsl.com
Delivered-To: rtcweb@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id DC5B221F9C16 for <rtcweb@ietfa.amsl.com>; Sun, 22 Sep 2013 22:06:04 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -110.425
X-Spam-Level:
X-Spam-Status: No, score=-110.425 tagged_above=-999 required=5 tests=[AWL=0.174, BAYES_00=-2.599, RCVD_IN_DNSWL_HI=-8, USER_IN_WHITELIST=-100]
Received: from mail.ietf.org ([12.22.58.30]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id KfHLaWp-M+fV for <rtcweb@ietfa.amsl.com>; Sun, 22 Sep 2013 22:06:00 -0700 (PDT)
Received: from eikenes.alvestrand.no (eikenes.alvestrand.no [158.38.152.233]) by ietfa.amsl.com (Postfix) with ESMTP id 52D4521F8F61 for <rtcweb@ietf.org>; Sun, 22 Sep 2013 22:06:00 -0700 (PDT)
Received: from localhost (localhost [127.0.0.1]) by eikenes.alvestrand.no (Postfix) with ESMTP id A3E1239E24F for <rtcweb@ietf.org>; Mon, 23 Sep 2013 07:05:49 +0200 (CEST)
X-Virus-Scanned: Debian amavisd-new at eikenes.alvestrand.no
Received: from eikenes.alvestrand.no ([127.0.0.1]) by localhost (eikenes.alvestrand.no [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Uv91dLI1WmLn for <rtcweb@ietf.org>; Mon, 23 Sep 2013 07:05:48 +0200 (CEST)
Received: from [IPv6:2001:470:de0a:27:c879:8be:f46e:7da8] (unknown [IPv6:2001:470:de0a:27:c879:8be:f46e:7da8]) by eikenes.alvestrand.no (Postfix) with ESMTPSA id 3CAFF39E058 for <rtcweb@ietf.org>; Mon, 23 Sep 2013 07:05:48 +0200 (CEST)
Message-ID: <523FCC86.8070302@alvestrand.no>
Date: Mon, 23 Sep 2013 07:07:18 +0200
From: Harald Alvestrand <harald@alvestrand.no>
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130804 Thunderbird/17.0.8
MIME-Version: 1.0
To: rtcweb@ietf.org
References: <523F3407.1060204@pocock.com.au>
In-Reply-To: <523F3407.1060204@pocock.com.au>
Content-Type: text/plain; charset="ISO-8859-1"; format="flowed"
Content-Transfer-Encoding: 7bit
Subject: Re: [rtcweb] determining mic/webcam availability on page load
X-BeenThere: rtcweb@ietf.org
X-Mailman-Version: 2.1.12
Precedence: list
List-Id: Real-Time Communication in WEB-browsers working group list <rtcweb.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/rtcweb>, <mailto:rtcweb-request@ietf.org?subject=unsubscribe>
List-Archive: <http://www.ietf.org/mail-archive/web/rtcweb>
List-Post: <mailto:rtcweb@ietf.org>
List-Help: <mailto:rtcweb-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/rtcweb>, <mailto:rtcweb-request@ietf.org?subject=subscribe>
X-List-Received-Date: Mon, 23 Sep 2013 05:06:06 -0000

On 09/22/2013 08:16 PM, Daniel Pocock wrote:
>
>
> Hi,
>
> I'm not sure if this has been discussed before, but I think it would be
> very useful for some applications to determine what hardware is
> available very early, well before trying to do things like SIP
> registration or making a call.
>
> However, if I use the code below, the result is that the user is
> prompted twice for permissions, once during the initial hardware
> detection and later when they try to make or receive a call.

This is an API issue, so it should go to public-webrtc@w3.org

But it's a solved issue in the spec, even though the implementations may 
be lagging: Use the getSourceInfos call to probe, not the getUserMedia call.


http://dev.w3.org/2011/webrtc/editor/getusermedia.html#methods-1
>
> Regards,
>
> Daniel
>
>
>
> navigator.webkitGetUserMedia(
>
>   {audio: true, video: true},
>
>    function (stream) {
>            var has_audio = false;
>            var has_video = false;
> 	  if(stream.getAudioTracks().length > 0)
> 		  has_audio = true;
> 	  if(stream.getVideoTracks().length > 0)
> 		  has_video = true;
> 	  console.log("closing unused stream");
> 	  stream.stop();
> 	  delete stream;
>            checksDone(has_audio, has_video);
>    },
>
>    function(err) {
> 	  console.log(err.name + ": " + err.message);
>            checksDone(false, false);
>    }
>
> );
>
> _______________________________________________
> rtcweb mailing list
> rtcweb@ietf.org
> https://www.ietf.org/mailman/listinfo/rtcweb