Getting user media in Chrome extension

98 views
Skip to first unread message

Josh

unread,
Dec 2, 2014, 4:26:23 PM12/2/14
to chromium-...@chromium.org
Hello,

I'm currently developing a WebRTC - based solution that can make and receive audio/video calls based on Sipml5. However, I am currently only able to write this functionality in a web page (this does work fine), as when I put this code in an extension, the attempt to use getUserMedia causes a script error. Furthermore, adding "permissions" : [ "videoCapture", "audioCapture" ] prevents the extension from even being loaded. I have tried working around this limitation by framing in my hosted page from the background page of my extension, though this still does not work.

The principle advantage to my implementing this in an extension rather than as a page in my website is that I could maintain the state of a call across page loads, and I could always be listening for a call. Obviously this could also be accomplished by popping out a new window that is a web page, though this isn't very clean. Is there some other way to accomplish this need?

Is there currently a sanctioned method for getting user media (mic, camera) in an extension? If not, is there any possibility for this to be added?

Rob Wu

unread,
Dec 2, 2014, 4:55:29 PM12/2/14
to Josh, Chromium-extensions
Adding audioCapture / videoCapture support to extensions is on the radar:
https://crbug.com/323665
https://crbug.com/291242
Even without these permissions, after some initial set up it is already possible to get mic/cam access from an extension (even the background page). I'm not sure whether that is intentional, so I won't publicly post how.

Kind regards,
 Rob
 https://robwu.nl

--
You received this message because you are subscribed to the Google Groups "Chromium-extensions" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-extens...@chromium.org.
To post to this group, send email to chromium-...@chromium.org.
Visit this group at http://groups.google.com/a/chromium.org/group/chromium-extensions/.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/chromium-extensions/1bba410f-33d9-4c84-b9d2-a5bbcd16cf15%40chromium.org.
For more options, visit https://groups.google.com/a/chromium.org/d/optout.

PhistucK

unread,
Dec 3, 2014, 2:10:45 AM12/3/14
to Rob Wu, Josh, Chromium-extensions
Have you filed a security issue for this apparently unintended behavior? Please, do.


PhistucK

Rob Wu

unread,
Dec 3, 2014, 7:39:37 AM12/3/14
to PhistucK, Rob Wu, Josh, Chromium-extensions
I believe that it is not a security or privacy bug because the "initial setup" requires the user's consent, and Chrome shows clear UI indicators when the extension is recording a media stream.

Kind regards,
 Rob
 https://robwu.nl

PhistucK

unread,
Dec 3, 2014, 7:45:03 AM12/3/14
to Rob Wu, Josh, Chromium-extensions
Oh, then why not disclose it?
What, opening an extension tab and calling webkitGetUserMedia?


PhistucK

Rob Wu

unread,
Dec 3, 2014, 8:46:55 AM12/3/14
to PhistucK, Chromium-extensions, Josh

chrome-extension: is a secure scheme, so gUM permissions are persistent. So IF you load such a page in a visible window AND get the user to approve the gUM request, THEN the background page can freely use gUM until the user clears the permissions at the settings page.

This trick also works with https:-schemes.

Kind regards,
Rob
https://robwu.nl

PhistucK

unread,
Dec 3, 2014, 8:55:14 AM12/3/14
to Rob Wu, Chromium-extensions, Josh
Yes, this makes sense. It is not a secret. :)


PhistucK
Reply all
Reply to author
Forward
0 new messages