part-of-screen-sharing/webrtc-data-channel/index.html
Open
Share DIV Number 1
Share DIV Number 2
Share DIV Number 3
Pause Sharing
Setup data connection.
Click a DIV to share.
Change DIV's content; all DIVs are edit-able.
Sharing part of the screen or region of screen (i.e. a DIV, SECTION, ARTICLE or ASIDE)... not the entire screen!
Everything inside that DIV is synchronized in realtime.
Works fine on all modern web browsers supporting WebRTC Data Channels.
<script src="https://www.webrtc-experiment.com/screenshot.js"></script>
<script>
var divToShare = document.querySelector('div');
html2canvas(divToShare, {
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.
*/
</script>
Send MessageEnter your email too; if you want "direct" reply!