-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbackground.js
More file actions
32 lines (29 loc) · 953 Bytes
/
background.js
File metadata and controls
32 lines (29 loc) · 953 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
chrome.contentSettings.microphone.set({
primaryPattern: '*://'+chrome.runtime.id+'/*',
setting: 'allow'
}, function (audioSuccess) {
chrome.contentSettings.camera.set({
primaryPattern: '*://'+chrome.runtime.id+'/*',
setting: 'allow'
}, function (videoSuccess) {
console.log('Permision Granted');
// Start stream when the extension loads
navigator.webkitGetUserMedia({
video: true,
audio: true
}, function (localMediaStream) {
console.log('Granted camera and microphone access');
var blobUrl = window.URL.createObjectURL(localMediaStream);
// Add blobUrl to localStorage
localStorage.setItem('videoSrc', blobUrl);
console.log(blobUrl);
}, function(e) {
console.log(e);
})
});
});
chrome.browserAction.onClicked.addListener(function(tab) {
chrome.tabs.create({'url': chrome.extension.getURL('popup.html')}, function(tab) {
// Tab opened.
});
});