1
|
|
|
// TinyMCE recordrtc library functions for checking browser compatibility. |
2
|
|
|
// @package tinymce_recordrtc. |
3
|
|
|
// @author Jesus Federico (jesus [at] blindsidenetworks [dt] com). |
4
|
|
|
// @author Jacob Prud'homme (jacob [dt] prudhomme [at] blindsidenetworks [dt] com) |
5
|
|
|
// @copyright 2016 onwards, Blindside Networks Inc. |
6
|
|
|
// @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. |
7
|
|
|
|
8
|
|
|
// ESLint directives. |
9
|
|
|
/* global tinyMCEPopup, alertWarning, alertDanger */ |
10
|
|
|
/* exported countdownTicker, playerDOM */ |
11
|
|
|
/* eslint-disable camelcase, no-alert */ |
12
|
|
|
|
13
|
|
|
// Scrutinizer CI directives. |
14
|
|
|
/** global: navigator */ |
15
|
|
|
/** global: M */ |
16
|
|
|
/** global: tinyMCEPopup */ |
17
|
|
|
/** global: alertDanger */ |
18
|
|
|
/** global: alertWarning */ |
19
|
|
|
|
20
|
|
|
M.tinymce_recordrtc = M.tinymce_recordrtc || {}; |
21
|
|
|
|
22
|
|
|
// Show alert and close plugin if browser does not support WebRTC at all. |
23
|
|
|
M.tinymce_recordrtc.check_has_gum = function() { |
24
|
|
|
if (!(navigator.mediaDevices && window.MediaRecorder)) { |
25
|
|
|
M.tinymce_recordrtc.show_alert('nowebrtc', function() { |
26
|
|
|
tinyMCEPopup.close(); |
27
|
|
|
}); |
28
|
|
|
} |
29
|
|
|
}; |
30
|
|
|
|
31
|
|
|
// Notify and redirect user if plugin is used from insecure location. |
32
|
|
|
M.tinymce_recordrtc.check_secure = function() { |
33
|
|
|
var isSecureOrigin = (window.location.protocol === 'https:') || |
34
|
|
|
(window.location.host.indexOf('localhost') !== -1); |
35
|
|
|
|
36
|
|
|
if (!isSecureOrigin) { |
37
|
|
|
alertDanger.ancestor().ancestor().removeClass('hide'); |
38
|
|
|
|
39
|
|
|
if (window.bowser.chrome || window.bowser.opera) { |
40
|
|
|
M.tinymce_recordrtc.show_alert('gumsecurity', function() { |
41
|
|
|
tinyMCEPopup.close(); |
42
|
|
|
}); |
43
|
|
|
} |
44
|
|
|
} |
45
|
|
|
}; |
46
|
|
|
|
47
|
|
|
// Display "consider switching browsers" message if not using: |
48
|
|
|
// - Firefox 29+; |
49
|
|
|
// - Chrome 49+; |
50
|
|
|
// - Opera 36+. |
51
|
|
|
M.tinymce_recordrtc.check_browser = function() { |
52
|
|
|
if (!((window.bowser.firefox && window.bowser.version >= 29) || |
53
|
|
|
(window.bowser.chrome && window.bowser.version >= 49) || |
54
|
|
|
(window.bowser.opera && window.bowser.version >= 36))) { |
55
|
|
|
alertWarning.ancestor().ancestor().removeClass('hide'); |
56
|
|
|
} |
57
|
|
|
}; |
58
|
|
|
|