W3C home > Mailing lists > Public > public-webrtc@w3.org > April 2015

Re: Can getUserMedia() get called on a callback/event ?

From: Iñaki Baz Castillo <ibc@aliax.net>
Date: Fri, 17 Apr 2015 11:47:06 +0200
Message-ID: <CALiegfnGmday2T7wiSR4GuAkE_mGHuMBwGCZ5OR2=FY3UaXeDg@mail.gmail.com>
To: Justin Uberti <juberti@google.com>
Cc: Martin Thomson <martin.thomson@gmail.com>, "Cullen Jennings (fluffy)" <fluffy@cisco.com>, "public-webrtc@w3.org" <public-webrtc@w3.org>
2015-04-14 3:52 GMT+02:00 Justin Uberti <juberti@google.com>:
> Inaki, do you have a JSFiddle demonstrating the problem? It's not clear to
> me what exactly in your app Chrome is not happy about.

Justin, I'm getting crazy. Now it works in every case, in Chrome 42,
Canary and Firefox:

http://jsfiddle.net/ibcaliax/Lcmy7r1t/

Note that there I do:

- On DOM ready run a 1s timer.
- On timeout run a WebSocket that produces a connection error.
- On ws error run another 1s timer.
- On timeout create a PC and run setRemoteDescription() with a wrong
description.
- On failure callback run another 1s timer.
- On timeout callback run getUserMedia().
- ...and getUserMedia() works (prompt shown).


I'm pretty sure the behavior has changed somehow since the same did
not work in Chrome when I opened this issue (in fact check my first
mail with a similar usecase in which gUM was called in the
ws.onmessage:


ws.onmessage = function (event) {
  var sdp = event.data;

// First try to set it as remote description
pc.setRemoteDescription(
      new RTCSessionDescription({type:'offer', sdp:sdp}),
      // If valid, prompt the user for audio/video.
      getUserMedia({video:true}, onSuccess, onFailure),
      // failure
      function(error) {
          console.error(error);
      }
);


That did not work 4 month ago...


-- 
Iñaki Baz Castillo
<ibc@aliax.net>
Received on Friday, 17 April 2015 09:47:54 UTC

This archive was generated by hypermail 2.3.1 : Monday, 23 October 2017 15:19:43 UTC