Skip to content

Commit a1ae399

Browse files
committed
Make getUserMedia work in <webview>, fixes electron#845
1 parent 48b0d85 commit a1ae399

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

atom/browser/api/atom_api_web_contents.cc

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
#include "content/public/browser/web_contents.h"
2323
#include "native_mate/dictionary.h"
2424
#include "native_mate/object_template_builder.h"
25+
#include "vendor/brightray/browser/media/media_stream_devices_controller.h"
2526

2627
#include "atom/common/node_includes.h"
2728

@@ -134,6 +135,14 @@ content::WebContents* WebContents::OpenURLFromTab(
134135
return web_contents();
135136
}
136137

138+
void WebContents::RequestMediaAccessPermission(
139+
content::WebContents*,
140+
const content::MediaStreamRequest& request,
141+
const content::MediaResponseCallback& callback) {
142+
brightray::MediaStreamDevicesController controller(request, callback);
143+
controller.TakeAction();
144+
}
145+
137146
void WebContents::HandleKeyboardEvent(
138147
content::WebContents* source,
139148
const content::NativeWebKeyboardEvent& event) {

atom/browser/api/atom_api_web_contents.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,10 @@ class WebContents : public mate::EventEmitter,
113113
content::WebContents* OpenURLFromTab(
114114
content::WebContents* source,
115115
const content::OpenURLParams& params) override;
116+
void RequestMediaAccessPermission(
117+
content::WebContents*,
118+
const content::MediaStreamRequest&,
119+
const content::MediaResponseCallback&) override;
116120
void HandleKeyboardEvent(
117121
content::WebContents* source,
118122
const content::NativeWebKeyboardEvent& event) override;

0 commit comments

Comments
 (0)