mirror of
https://github.com/dani/vroom.git
synced 2024-07-06 01:58:38 +02:00
536143bdf0
Since Chrome 34, a new API for screen sharing is available (the previous one using the flag will probably be deprecated soon) This commit adds: - Source of a simple Chrome extension to use this new API (which is a perfect copy of the sample extension given by &yet here: https://github.com/HenrikJoreteg/getScreenMedia - Adapt help page - New modal dialog to prompt user to install the extension from Google Web Store - Better error messages if you can't share your screen Should fix #7
15 lines
507 B
JavaScript
15 lines
507 B
JavaScript
/* the chrome content script which can listen to the page dom events */
|
|
var channel = chrome.runtime.connect();
|
|
channel.onMessage.addListener(function (message) {
|
|
console.log('channel message', message);
|
|
window.postMessage(message, '*');
|
|
});
|
|
|
|
window.addEventListener('message', function (event) {
|
|
if (event.source != window)
|
|
return;
|
|
if (!event.data && (event.data.type == 'getScreen' || event.data.type == 'cancelGetScreen'))
|
|
return;
|
|
channel.postMessage(event.data);
|
|
});
|