Passage à ASP.NET vNext
This commit is contained in:
parent
ea90fefc31
commit
388b004837
1929 changed files with 104611 additions and 235941 deletions
41
Yavsc/wwwroot/desktopCaptureExtension/background.js
Normal file
41
Yavsc/wwwroot/desktopCaptureExtension/background.js
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
'use strict';
|
||||
|
||||
var dataSources = ['screen', 'window'];
|
||||
var desktopMediaRequestId = '';
|
||||
|
||||
chrome.runtime.onConnect.addListener(function(port) {
|
||||
port.onMessage.addListener(function(msg) {
|
||||
if (msg.type === 'SS_UI_REQUEST') {
|
||||
requestScreenSharing(port, msg);
|
||||
}
|
||||
|
||||
if (msg.type === 'SS_UI_CANCEL') {
|
||||
cancelScreenSharing(msg);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
function requestScreenSharing(port, msg) {
|
||||
// https://developer.chrome.com/extensions/desktopCapture
|
||||
// params:
|
||||
// - 'dataSources' Set of sources that should be shown to the user.
|
||||
// - 'targetTab' Tab for which the stream is created.
|
||||
// - 'streamId' String that can be passed to getUserMedia() API
|
||||
desktopMediaRequestId =
|
||||
chrome.desktopCapture.chooseDesktopMedia(dataSources, port.sender.tab,
|
||||
function(streamId) {
|
||||
if (streamId) {
|
||||
msg.type = 'SS_DIALOG_SUCCESS';
|
||||
msg.streamId = streamId;
|
||||
} else {
|
||||
msg.type = 'SS_DIALOG_CANCEL';
|
||||
}
|
||||
port.postMessage(msg);
|
||||
});
|
||||
}
|
||||
|
||||
function cancelScreenSharing() {
|
||||
if (desktopMediaRequestId) {
|
||||
chrome.desktopCapture.cancelChooseDesktopMedia(desktopMediaRequestId);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue