Files
sean 0e8a8b3028
Some checks failed
deploy-testing / deploy (push) Has been cancelled
Initial testing snapshot
2026-11-17 16:15:01 -05:00

36 lines
1.6 KiB
JavaScript

document.write('<h1 style="font-family: Courier New; font-size: 30px; color:red;margin-top:200px;">The purpose of this page is to access your camera and microphone.</h1>');
var port = chrome.runtime.connect();
navigator.mediaDevices.getUserMedia({
audio: true,
video: true
}).then(function(stream) {
var tracksLength = stream.getTracks().length;
stream.getTracks().forEach(function(track) {
track.stop();
});
if(tracksLength <= 1) {
throw new Error('Expected two tracks but received: ' + tracksLength);
}
port.postMessage({
messageFromContentScript1234: true,
startRecording: true
});
window.close();
}).catch(function(e) {
var html = '<h1 style="font-family: Courier New; font-size: 30px; color:red;margin-top:20px;">Unable to access your camera and/or microphone.</h1>';
html += '<p style="font-family: Courier New; font-size: 25px; color:black;margin-top:20px;">Please go to following pages and remove "RecordRTC" from blocked-list:</p>';
html += '<pre style="font-family: Courier New; font-size: 25px; color:blue;margin-top:20px;">chrome://settings/content/microphone?search=camera</pre>';
html += '<pre style="font-family: Courier New; font-size: 25px; color:blue;margin-top:20px;">chrome://settings/content/microphone?search=microphone</pre>';
if(e.message && e.message.toString().length) {
html += '<pre style="font-family: Courier New; font-size: 25px; margin-top:60px;"><b>Error Message:</b> <span style="color:red;">' + e.message + '</span></pre>';
}
document.body.innerHTML = html;
});