part-of-screen-sharing/README.md
Another realtime/p2p working demo:
Files:
<script src="//cdn.webrtc-experiment.com/screenshot.js"></script>
<!-- or Developers version -->
<script src="//cdn.webrtc-experiment.com/screenshot-dev.js"></script>
Remember, grabMouse is used by default. You need to make it false to make sure your resulting screenshot has no cursor icon.
var divToShare = document.querySelector('div');
html2canvas(divToShare, {
grabMouse: false, //---- if you don't want to take mouse icon
onrendered: function (canvas) {
var screenshot = canvas.toDataURL();
// image.src = screenshot;
// context.drawImage(screenshot, x, y, width, height);
// firebase.push(screenshot);
// pubnub.send(screenshot);
// socketio.send(screenshot);
// signaler.send(screenshot);
// window.open(screenshot);
}
});
/*
-----Note:
Put above code in a function; use "requestAnimationFrame" to loop the function
and post/transmit DataURL in realtime!
-----what above code will do?
Above code will take screenshot of the DIV or other HTML element and return you
and image. You can preview image to render in IMG element or draw to Canvas2D.
*/
The script allows you to take "screenshots" of webpages or parts of it, directly on the users browser. The screenshot is based on the DOM and as such may not be 100% accurate to the real representation as it does not make an actual screenshot, but builds the screenshot based on the information available on the page.
=
html2canvas library to take screenshot of the entire webpage or part of webpage.RTCDataChannel APIs (SCTP or RTP) or Firebase.To share your custom part of screen:
index.html filerenderMe object that is getting an element by id: render-me....and that's all you need to do!
=
via: https://github.com/niklasvh/html2canvas#browser-compatibility
=
These WebRTC Part of Screen Sharing experiments are released under MIT licence . Copyright (c) Muaz Khan.