Proyectos de Subversion Moodle

Rev

| Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1441 ariadna 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
 * Tiny Record RTC - record screen command.
18
 *
19
 * @module      tiny_recordrtc/commands_screen
20
 * @copyright   2024 The Open University
21
 * @license     http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
22
 */
23
 
24
import {getString} from 'core/str';
25
import {getButtonImage as getScreenIcon} from 'editor_tiny/utils';
26
import {
27
    screenButtonName,
28
    component,
29
} from './common';
30
import {isScreenAllowed} from './options';
31
import Recorder from './screen_recorder';
32
 
33
export default async() => {
34
    if (!Recorder.isBrowserCompatible()) {
35
        // The browser doesn't support the plugin, so just don't show it.
36
        return () => false;
37
    }
38
 
39
    const [
40
        screenButtonTitle,
41
        buttonImage,
42
    ] = await Promise.all([
43
        getString('screenbuttontitle', component),
44
        getScreenIcon('screen', component),
45
    ]);
46
 
47
    return (editor) => {
48
        // Screen recording is not currently supported on mobile devices.
49
        // Therefore, it will be disabled and should be considered for future implementation.
50
        if (!isScreenAllowed(editor) || !editor.editorManager.Env.deviceType.isDesktop()) {
51
            return;
52
        }
53
 
54
        const icon = 'screen';
55
        editor.ui.registry.addIcon(icon, buttonImage.html);
56
        editor.ui.registry.addButton(screenButtonName, {
57
            icon,
58
            tooltip: screenButtonTitle,
59
            onAction: () => Recorder.display(editor),
60
        });
61
 
62
        editor.ui.registry.addMenuItem(screenButtonName, {
63
            icon,
64
            text: screenButtonTitle,
65
            onAction: () => Recorder.display(editor),
66
        });
67
    };
68
};