diff options
author | 2017-05-04 07:48:42 -0400 | |
---|---|---|
committer | 2017-05-04 12:28:17 -0400 | |
commit | b54df0ddd0c6a0372327c5aa3668e5a6458fcd64 (patch) | |
tree | e69cfa9b314a801bd187cf0145d1d4306436229c /ecomp-portal-BE/war/static/fusion/webrtc/getSourceId.html | |
parent | 39d1e62c84041831bfc52cca73b5ed5efaf57d27 (diff) |
[PORTAL-7] Rebase
This rebasing includes common libraries and common overlays projects
abstraction of components
Change-Id: I9a24a338665c7cd058978e8636bc412d9e2fdce8
Signed-off-by: st782s <statta@research.att.com>
Diffstat (limited to 'ecomp-portal-BE/war/static/fusion/webrtc/getSourceId.html')
-rw-r--r-- | ecomp-portal-BE/war/static/fusion/webrtc/getSourceId.html | 78 |
1 files changed, 0 insertions, 78 deletions
diff --git a/ecomp-portal-BE/war/static/fusion/webrtc/getSourceId.html b/ecomp-portal-BE/war/static/fusion/webrtc/getSourceId.html deleted file mode 100644 index 6f660025..00000000 --- a/ecomp-portal-BE/war/static/fusion/webrtc/getSourceId.html +++ /dev/null @@ -1,78 +0,0 @@ - -<script> - -var DetectRTC = {}; - -var screenCallback; - -DetectRTC.screen = { - chromeMediaSource: 'screen', - getSourceId: function (callback) { - screenCallback = callback; - window.postMessage('get-sourceId', '*'); - }, - onMessageCallback: function (data) { - // "cancel" button is clicked - if (data == 'PermissionDeniedError') { - DetectRTC.screen.chromeMediaSource = 'PermissionDeniedError'; - if (screenCallback) return screenCallback('PermissionDeniedError'); - else throw new Error('PermissionDeniedError'); - } - - // extension notified his presence - if (data == 'rtcmulticonnection-extension-loaded') { - DetectRTC.screen.chromeMediaSource = 'desktop'; - } - - // extension shared temp sourceId - if (data.sourceId) { - DetectRTC.screen.sourceId = data.sourceId; - if (screenCallback) screenCallback(DetectRTC.screen.sourceId); - } - }, - getChromeExtensionStatus: function (callback) { - // https://chrome.google.com/webstore/detail/screen-capturing-private/icgmlogfeajbfdffajhoebcfbibfhaen - var extensionid = 'icgmlogfeajbfdffajhoebcfbibfhaen'; - - var image = document.createElement('img'); - image.src = 'chrome-extension://' + extensionid + '/icon.png'; - image.onload = function () { - DetectRTC.screen.chromeMediaSource = 'screen'; - window.postMessage('are-you-there', '*'); - setTimeout(function () { - if (DetectRTC.screen.chromeMediaSource == 'screen') { - callback('installed-disabled'); - } else callback('installed-enabled'); - }, 2000); - }; - image.onerror = function () { - callback('not-installed'); - }; - } -}; - -window.addEventListener('message', function (event) { - if (!event.data || !(typeof event.data == 'string' || event.data.sourceId || event.data.captureSourceId)) return; - if (event.data.captureSourceId) captureSourceId(); - - DetectRTC.screen.onMessageCallback(event.data); -}); - -function captureSourceId() { - // check if desktop-capture extension installed. - DetectRTC.screen.getChromeExtensionStatus(function (status) { - if (status != 'installed-enabled') { - window.parent.postMessage({ - chromeExtensionStatus: status - }, '*'); - return; - } - - DetectRTC.screen.getSourceId(function (sourceId) { - window.parent.postMessage({ - chromeMediaSourceId: sourceId - }, '*'); - }); - }); -} -</script> |