aboutsummaryrefslogtreecommitdiffstats
path: root/vid/src/main/webapp/app/fusion/scripts/webrtc/getSourceId.html
diff options
context:
space:
mode:
authorjimmydot <jf2512@att.com>2017-05-07 14:58:24 -0400
committerjimmydot <jf2512@att.com>2017-05-07 14:58:24 -0400
commit3982f4f67314ec37fd9b22ae54049958af777c1b (patch)
tree72111b7c13ee7529cce1ea4c8d83c89fdd164450 /vid/src/main/webapp/app/fusion/scripts/webrtc/getSourceId.html
parent00e0d25933699f9e39c3f0b86c983165a1e3e330 (diff)
[VID-6] Initial rebase push
Change-Id: I9077be9663754d9b22f77c6a7b3109b361b39346 Signed-off-by: jimmydot <jf2512@att.com>
Diffstat (limited to 'vid/src/main/webapp/app/fusion/scripts/webrtc/getSourceId.html')
-rw-r--r--vid/src/main/webapp/app/fusion/scripts/webrtc/getSourceId.html78
1 files changed, 0 insertions, 78 deletions
diff --git a/vid/src/main/webapp/app/fusion/scripts/webrtc/getSourceId.html b/vid/src/main/webapp/app/fusion/scripts/webrtc/getSourceId.html
deleted file mode 100644
index 6f660025..00000000
--- a/vid/src/main/webapp/app/fusion/scripts/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>