getScreenId | Capture Screen on Any Domain!
- Live Demo: https://www.webrtc-experiment.com/getScreenId/
- YouTube video: https://www.youtube.com/watch?v=UHrsfe9RYAQ
- Install this: https://chrome.google.com/webstore/detail/screen-capturing/ajhifddimkapgcifgcodmmfdlknahffk
- Now use below codes on any HTTPs domain.
- Remember, HTTPs is required.
- getScreenId gives you "MediaStream" object; you can share that object with other users using AppRTC demo, SimpleWebRTC or EasyRTC or PeerJs libraries, or any standalone peer-to-peer demo.
- In simple words, you have to use RTCPeerConnection API along with getScreenId to share screen with other users.
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!
How to use?
This method allows you get chrome-media-source-id; which can be used to capture screens.
This method allows you detect whether chrome extension is installed or not:
How it works?
- Your script will make a
getScreenId.jswill connect with chrome-extension using an internal
<iframe>is loaded from domain:
<iframe>can connect with chrome-extension. It can send/receive
postMessageAPI are used to pass
screen-idback to your script.
Pass second argument to
truemeans that capture system audio i.e. speakers
array means that capture custom array items
; // capture speakers; // capature only tab; // capature only app's windows; // capature only screen with speakers