promise API support in Chrome

688 views
Skip to first unread message

Rajmohan Banavi

unread,
Dec 10, 2015, 7:17:41 AM12/10/15
to discuss...@googlegroups.com
Does Chrome support the promise based APIs? I am using adaptor and tried specifically getUserMedia() API. And I received the following error

This appears to be Chrome
adapter-latest.js:32 chrome: {"audio":true,"video":true}
adapter-latest.js:410 Uncaught TypeError: Failed to execute 'webkitGetUserMedia' on 'Navigator': The callback provided as parameter 2 is not a function.

So can I am presume from above that Chrome does not support the promise based API (specifically getUserMedia) yet? Is there any resource/link that gives the implementation status of the promised based API across the browsers?

                
if (getUserMedia) {
    getUserMedia(options)
    .then(function (stream) {
        console.log("Acquired audio and video!");
    })
    .catch(function (err) {
        console.log(err.name + ": " + err.message);
    });
} else {
    alert("WebRTC not supported on this browser");
}

Philipp Hancke

unread,
Dec 10, 2015, 9:59:07 AM12/10/15
to discuss...@googlegroups.com
2015-12-10 4:17 GMT-08:00 Rajmohan Banavi <rajmoha...@gmail.com>:
Does Chrome support the promise based APIs? I am using adaptor and tried specifically getUserMedia() API. And I received the following error

This appears to be Chrome
adapter-latest.js:32 chrome: {"audio":true,"video":true}
adapter-latest.js:410 Uncaught TypeError: Failed to execute 'webkitGetUserMedia' on 'Navigator': The callback provided as parameter 2 is not a function.

Looks like you are trying to use navigator.getUserMedia, i.e.
   navigator.getUserMedia({audio: true}).then(function(stream) { console.log(stream); })
Try
  navigator.mediaDevices.getUserMedia({audio: true}).then(function(stream) { console.log(stream); })
instead. AFAIK the old navigator.getUserMedia is not defined with promise support. And window.getUserMedia from adapter.js should not be used.
 
So can I am presume from above that Chrome does not support the promise based API (specifically getUserMedia) yet? Is there any resource/link that gives the implementation status of the promised based API across the browsers?

Works in Firefox and Edge, needs adapter.js as a shim in Chrome. See https://code.google.com/p/chromium/issues/detail?id=503227 for the status of the native Chrome support.

                
if (getUserMedia) {
    getUserMedia(options)
    .then(function (stream) {
        console.log("Acquired audio and video!");
    })
    .catch(function (err) {
        console.log(err.name + ": " + err.message);
    });
} else {
    alert("WebRTC not supported on this browser");
}

--

---
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/CAJWm%2BfEoX9CYDhuufPX_rOXh8w8fNVszz_q094bH8UX6vAYH4w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages