Proyectos de Subversion Moodle

Rev

| Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1 efrain 1
// This file is part of Moodle - http://moodle.org/
2
//
3
// Moodle is free software: you can redistribute it and/or modify
4
// it under the terms of the GNU General Public License as published by
5
// the Free Software Foundation, either version 3 of the License, or
6
// (at your option) any later version.
7
//
8
// Moodle is distributed in the hope that it will be useful,
9
// but WITHOUT ANY WARRANTY; without even the implied warranty of
10
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11
// GNU General Public License for more details.
12
//
13
// You should have received a copy of the GNU General Public License
14
// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
15
//
16
 
17
/**
18
 * Atto recordrtc library functions for checking browser compatibility
19
 *
20
 * @package    atto_recordrtc
21
 * @author     Jesus Federico (jesus [at] blindsidenetworks [dt] com)
22
 * @author     Jacob Prud'homme (jacob [dt] prudhomme [at] blindsidenetworks [dt] com)
23
 * @copyright  2017 Blindside Networks Inc.
24
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
25
 */
26
 
27
// ESLint directives.
28
/* eslint-disable camelcase */
29
 
30
// Scrutinizer CI directives.
31
/** global: M */
32
 
33
M.atto_recordrtc = M.atto_recordrtc || {};
34
 
35
// Shorten access to module namespaces.
36
var cm = M.atto_recordrtc.commonmodule,
37
    am = M.atto_recordrtc.abstractmodule;
38
 
39
M.atto_recordrtc.compatcheckmodule = {
40
    // Show alert and close plugin if browser does not support WebRTC at all.
41
    check_has_gum: function() {
42
        if (!(navigator.mediaDevices && window.MediaRecorder)) {
43
            am.show_alert('nowebrtc', function() {
44
                cm.editorScope.closeDialogue(cm.editorScope);
45
            });
46
        }
47
    },
48
 
49
    // Notify and redirect user if plugin is used from insecure location.
50
    check_secure: function() {
51
        var isSecureOrigin = (window.location.protocol === 'https:') ||
52
                             (window.location.host.indexOf('localhost') !== -1);
53
 
54
        if (!isSecureOrigin) {
55
            cm.alertDanger.ancestor().ancestor().removeClass('hide');
56
        }
57
    },
58
};