
Security News
MCP Community Begins Work on Official MCP Metaregistry
The MCP community is launching an official registry to standardize AI tool discovery and let agents dynamically find and install MCP servers.
webrtc-screen-capturing
Advanced tools
Capture Screen on Any Domain! This script is a hack used to support single chrome extension usage on any HTTPs domain.
npm instll webrtc-screen-capturing
Hacking to use single chrome-extension on any domain!
<!--
* This script is a hack used to support single chrome extension usage on any domain.
* This script has issues, though.
* It uses "postMessage" mechanism which fails to work if someone is using it from inside an <iframe>.
* The only solution for such cases is, use WebSockets or external servers to pass "source-ids".
-->
You don't need to PUBLISH/deploy your own chrome-extension when using this script!
node server.js
Nope open: https://localhost:9001/
<script src="https://cdn.WebRTC-Experiment.com/getScreenId.js"></script>
<script src="https://webrtc.github.io/adapter/adapter-latest.js"></script>
<video controls autoplay playsinline></video>
getScreenId
This method allows you get chrome-media-source-id; which can be used to capture screens.
getScreenId(function (error, sourceId, screen_constraints) {
// error == null || 'permission-denied' || 'not-installed' || 'installed-disabled' || 'not-chrome'
// sourceId == null || 'string' || 'firefox'
if(navigator.userAgent.indexOf('Edge') !== -1 && (!!navigator.msSaveOrOpenBlob || !!navigator.msSaveBlob)) {
navigator.getDisplayMedia(screen_constraints).then(stream => {
document.querySelector('video').srcObject = stream;
}, error => {
alert('Please make sure to use Edge 17 or higher.');
});
return;
}
if(error == 'not-installed') {
alert('Please install Chrome extension.');
return;
}
navigator.mediaDevices.getUserMedia(screen_constraints).then(function (stream) {
document.querySelector('video').srcObject = stream;
// share this "MediaStream" object using RTCPeerConnection API
}).catch(function (error) {
console.error('getScreenId error', error);
alert('Failed to capture your screen. Please check Chrome console logs for further information.');
});
});
Or...
getScreenId(function (error, sourceId, screen_constraints) {
// error == null || 'permission-denied' || 'not-installed' || 'installed-disabled' || 'not-chrome'
// sourceId == null || 'string' || 'firefox'
if(sourceId && sourceId != 'firefox') {
screen_constraints = {
video: {
mandatory: {
chromeMediaSource: 'screen',
maxWidth: 1920,
maxHeight: 1080,
minAspectRatio: 1.77
}
}
};
if (error === 'permission-denied') return alert('Permission is denied.');
if (error === 'not-chrome') return alert('Please use chrome.');
if (!error && sourceId) {
screen_constraints.video.mandatory.chromeMediaSource = 'desktop';
screen_constraints.video.mandatory.chromeMediaSourceId = sourceId;
}
}
navigator.getUserMedia = navigator.mozGetUserMedia || navigator.webkitGetUserMedia;
navigator.getUserMedia(screen_constraints, function (stream) {
document.querySelector('video').src = URL.createObjectURL(stream);
// share this "MediaStream" object using RTCPeerConnection API
}, function (error) {
console.error('getScreenId error', error);
alert('Failed to capture your screen. Please check Chrome console logs for further information.');
});
});
getChromeExtensionStatus
This method allows you detect whether chrome extension is installed or not:
getChromeExtensionStatus(function(status) {
if (status === 'installed-enabled') alert('installed');
if (status === 'installed-disabled') alert('installed but disabled');
// etc.
});
postMessage
request to getScreenId.js
getScreenId.js
will connect with chrome-extension using an internal <iframe>
.<iframe>
is loaded from domain: https://www.webrtc-experiment.com/
<iframe>
can connect with chrome-extension. It can send/receive postMessage
data.postMessage
API are used to pass screen-id
back to your script.Pass second argument to getScrenId
method:
true
means that capture system audio i.e. speakers[]
array means that capture custom array itemsgetScreenId(successCallback, true); // capture speakers
getScreenId(successCallback, ['tab']); // capature only tab
getScreenId(successCallback, ['window']); // capature only app's windows
getScreenId(successCallback, ['screen', 'audio']); // capature only screen with speakers
getScreenId.js is released under MIT licence . Copyright (c) Muaz Khan.
FAQs
Capture Screen on Any Domain! This script is a hack used to support single chrome extension usage on any HTTPs domain.
The npm package webrtc-screen-capturing receives a total of 45 weekly downloads. As such, webrtc-screen-capturing popularity was classified as not popular.
We found that webrtc-screen-capturing demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
The MCP community is launching an official registry to standardize AI tool discovery and let agents dynamically find and install MCP servers.
Research
Security News
Socket uncovers an npm Trojan stealing crypto wallets and BullX credentials via obfuscated code and Telegram exfiltration.
Research
Security News
Malicious npm packages posing as developer tools target macOS Cursor IDE users, stealing credentials and modifying files to gain persistent backdoor access.