mirror of
https://github.com/moodle/moodle.git
synced 2025-04-13 04:22:07 +02:00
MDL-81212 tiny_recordrtc: Screen-recorder improvements and cleanups
This commit is contained in:
parent
89e78f75b3
commit
aa09138d75
10
lib/editor/tiny/plugins/recordrtc/amd/build/commands_video_context_menu.min.js
vendored
Normal file
10
lib/editor/tiny/plugins/recordrtc/amd/build/commands_video_context_menu.min.js
vendored
Normal file
@ -0,0 +1,10 @@
|
||||
define("tiny_recordrtc/commands_video_context_menu",["exports","core/str","editor_tiny/utils","./common","./options","./video_recorder","./screen_recorder"],(function(_exports,_str,_utils,_common,_options,_video_recorder,_screen_recorder){function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}
|
||||
/**
|
||||
* Tiny Record RTC - Video context menu command.
|
||||
*
|
||||
* @module tiny_recordrtc/commands_video_context_menu
|
||||
* @copyright 2024 The Open University
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.default=void 0,_video_recorder=_interopRequireDefault(_video_recorder),_screen_recorder=_interopRequireDefault(_screen_recorder);return _exports.default=async()=>{const[videoContextMenuTitle,videoButtonTitle,screenButtonTitle,buttonImageVideo,buttonImageScreen]=await Promise.all([(0,_str.getString)("videorecordmenutitle",_common.component),(0,_str.getString)("videobuttontitle",_common.component),(0,_str.getString)("screenbuttontitle",_common.component),(0,_utils.getButtonImage)("video",_common.component),(0,_utils.getButtonImage)("screen",_common.component)]);return editor=>{let recorder,useContextMenu=!0,singleButton="video",singleButtonTitle=videoButtonTitle,imageHtml=buttonImageVideo.html;((0,_options.isVideoAllowed)(editor)||(0,_options.isScreenAllowed)(editor))&&((0,_options.isVideoAllowed)(editor)&&!(0,_options.isScreenAllowed)(editor)?(useContextMenu=!1,recorder=_video_recorder.default):(0,_options.isScreenAllowed)(editor)&&!(0,_options.isVideoAllowed)(editor)&&(useContextMenu=!1,singleButton="screen",singleButtonTitle=screenButtonTitle,imageHtml=buttonImageScreen.html,recorder=_screen_recorder.default),editor.ui.registry.addIcon(singleButton,imageHtml),useContextMenu?editor.ui.registry.addMenuButton(_common.videoContextMenuName,{icon:singleButton,tooltip:videoContextMenuTitle,fetch:callback=>callback("".concat(_common.videoButtonName," ").concat(_common.screenButtonName))}):editor.ui.registry.addButton(_common.videoContextMenuName,{icon:singleButton,tooltip:singleButtonTitle,onAction:()=>recorder.display(editor)}))}},_exports.default}));
|
||||
|
||||
//# sourceMappingURL=commands_video_context_menu.min.js.map
|
@ -0,0 +1 @@
|
||||
{"version":3,"file":"commands_video_context_menu.min.js","sources":["../src/commands_video_context_menu.js"],"sourcesContent":["// This file is part of Moodle - http://moodle.org/\n//\n// Moodle is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// Moodle is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with Moodle. If not, see <http://www.gnu.org/licenses/>.\n\n/**\n * Tiny Record RTC - Video context menu command.\n *\n * @module tiny_recordrtc/commands_video_context_menu\n * @copyright 2024 The Open University\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\nimport {getString} from 'core/str';\nimport {getButtonImage} from 'editor_tiny/utils';\nimport {\n videoButtonName,\n screenButtonName,\n videoContextMenuName,\n component,\n} from './common';\nimport {isVideoAllowed, isScreenAllowed} from './options';\nimport videoRecorder from \"./video_recorder\";\nimport screenRecorder from \"./screen_recorder\";\n\nexport default async() => {\n const [\n videoContextMenuTitle,\n videoButtonTitle,\n screenButtonTitle,\n buttonImageVideo,\n buttonImageScreen,\n ] = await Promise.all([\n getString('videorecordmenutitle', component),\n getString('videobuttontitle', component),\n getString('screenbuttontitle', component),\n getButtonImage('video', component),\n getButtonImage('screen', component),\n ]);\n\n return (editor) => {\n let useContextMenu = true;\n let singleButton = 'video';\n let singleButtonTitle = videoButtonTitle;\n let imageHtml = buttonImageVideo.html;\n let recorder;\n if (!isVideoAllowed(editor) && !isScreenAllowed(editor)) {\n return;\n } else if (isVideoAllowed(editor) && !isScreenAllowed(editor)) {\n // Only video recording is allowed.\n useContextMenu = false;\n recorder = videoRecorder;\n } else if (isScreenAllowed(editor) && !isVideoAllowed(editor)) {\n // Only screen recording is allowed.\n useContextMenu = false;\n singleButton = 'screen';\n singleButtonTitle = screenButtonTitle;\n imageHtml = buttonImageScreen.html;\n recorder = screenRecorder;\n }\n editor.ui.registry.addIcon(singleButton, imageHtml);\n\n if (useContextMenu) {\n // Add the video and screen buttons to the context menu.\n editor.ui.registry.addMenuButton(videoContextMenuName, {\n icon: singleButton,\n tooltip: videoContextMenuTitle,\n fetch: callback => callback(`${videoButtonName} ${screenButtonName}`),\n });\n } else {\n // Add the video or screen button to the toolbar.\n editor.ui.registry.addButton(videoContextMenuName, {\n icon: singleButton,\n tooltip: singleButtonTitle,\n onAction: () => recorder.display(editor),\n });\n }\n };\n};\n"],"names":["async","videoContextMenuTitle","videoButtonTitle","screenButtonTitle","buttonImageVideo","buttonImageScreen","Promise","all","component","editor","recorder","useContextMenu","singleButton","singleButtonTitle","imageHtml","html","videoRecorder","screenRecorder","ui","registry","addIcon","addMenuButton","videoContextMenuName","icon","tooltip","fetch","callback","videoButtonName","screenButtonName","addButton","onAction","display"],"mappings":";;;;;;;+NAmCeA,gBAEPC,sBACAC,iBACAC,kBACAC,iBACAC,yBACMC,QAAQC,IAAI,EAClB,kBAAU,uBAAwBC,oBAClC,kBAAU,mBAAoBA,oBAC9B,kBAAU,oBAAqBA,oBAC/B,yBAAe,QAASA,oBACxB,yBAAe,SAAUA,4BAGrBC,aAKAC,SAJAC,gBAAiB,EACjBC,aAAe,QACfC,kBAAoBX,iBACpBY,UAAYV,iBAAiBW,OAE5B,2BAAeN,UAAY,4BAAgBA,YAErC,2BAAeA,WAAY,4BAAgBA,SAElDE,gBAAiB,EACjBD,SAAWM,0BACJ,4BAAgBP,WAAY,2BAAeA,UAElDE,gBAAiB,EACjBC,aAAe,SACfC,kBAAoBV,kBACpBW,UAAYT,kBAAkBU,KAC9BL,SAAWO,0BAEfR,OAAOS,GAAGC,SAASC,QAAQR,aAAcE,WAErCH,eAEAF,OAAOS,GAAGC,SAASE,cAAcC,6BAAsB,CACnDC,KAAMX,aACNY,QAASvB,sBACTwB,MAAOC,UAAYA,mBAAYC,oCAAmBC,6BAItDnB,OAAOS,GAAGC,SAASU,UAAUP,6BAAsB,CAC/CC,KAAMX,aACNY,QAASX,kBACTiB,SAAU,IAAMpB,SAASqB,QAAQtB"}
|
@ -1,3 +0,0 @@
|
||||
define("tiny_recordrtc/commands_video_menu",["exports","core/str","editor_tiny/utils","./common","./options"],(function(_exports,_str,_utils,_common,_options){Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.default=void 0;return _exports.default=async()=>{const[videorecordmenutitle,buttonImage]=await Promise.all([(0,_str.getString)("videorecordmenutitle",_common.component),(0,_utils.getButtonImage)("video",_common.component)]);return editor=>{if(!(0,_options.isVideoAllowed)(editor)&&!(0,_options.isScreenAllowed)(editor))return;editor.ui.registry.addIcon("video",buttonImage.html),editor.ui.registry.addMenuButton(_common.videoMenuButtonName,{icon:"video",tooltip:videorecordmenutitle,fetch:callback=>callback("".concat(_common.videoButtonName," ").concat(_common.screenButtonName))})}},_exports.default}));
|
||||
|
||||
//# sourceMappingURL=commands_video_menu.min.js.map
|
@ -1 +0,0 @@
|
||||
{"version":3,"file":"commands_video_menu.min.js","sources":["../src/commands_video_menu.js"],"sourcesContent":["// This file is part of Moodle - http://moodle.org/\n//\n// Moodle is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// Moodle is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with Moodle. If not, see <http://www.gnu.org/licenses/>.\n\n/**\n * Tiny Record RTC - record base command.\n *\n * @module tiny_recordrtc/commands\n * @copyright 2024 The Open University\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\nimport {getString} from 'core/str';\nimport {getButtonImage as getVideoIcon} from 'editor_tiny/utils';\nimport {\n videoButtonName,\n screenButtonName,\n videoMenuButtonName,\n component,\n} from './common';\nimport {isVideoAllowed, isScreenAllowed} from './options';\n\nexport default async() => {\n const [\n videorecordmenutitle,\n buttonImage,\n ] = await Promise.all([\n getString('videorecordmenutitle', component),\n getVideoIcon('video', component),\n ]);\n\n return (editor) => {\n if (!isVideoAllowed(editor) && !isScreenAllowed(editor)) {\n return;\n }\n\n const icon = 'video';\n editor.ui.registry.addIcon(icon, buttonImage.html);\n\n editor.ui.registry.addMenuButton(videoMenuButtonName, {\n icon,\n tooltip: videorecordmenutitle,\n fetch: callback => callback(`${videoButtonName} ${screenButtonName}`),\n });\n };\n};\n"],"names":["async","videorecordmenutitle","buttonImage","Promise","all","component","editor","ui","registry","addIcon","html","addMenuButton","videoMenuButtonName","icon","tooltip","fetch","callback","videoButtonName","screenButtonName"],"mappings":"uQAiCeA,gBAEPC,qBACAC,mBACMC,QAAQC,IAAI,EAClB,kBAAU,uBAAwBC,oBAClC,yBAAa,QAASA,4BAGlBC,cACC,2BAAeA,WAAY,4BAAgBA,eAKhDA,OAAOC,GAAGC,SAASC,QADN,QACoBP,YAAYQ,MAE7CJ,OAAOC,GAAGC,SAASG,cAAcC,4BAAqB,CAClDC,KAJS,QAKTC,QAASb,qBACTc,MAAOC,UAAYA,mBAAYC,oCAAmBC"}
|
@ -1,3 +1,3 @@
|
||||
define("tiny_recordrtc/common",["exports"],(function(_exports){Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.default=void 0;return _exports.default={pluginName:"tiny_recordrtc/plugin",component:"tiny_recordrtc",audioButtonName:"tiny_recordrtc_audio",videoButtonName:"tiny_recordrtc_video",screenButtonName:"tiny_recordrtc_screen",videoMenuButtonName:"tiny_recordrtc_video_menu"},_exports.default}));
|
||||
define("tiny_recordrtc/common",["exports"],(function(_exports){Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.default=void 0;return _exports.default={pluginName:"tiny_recordrtc/plugin",component:"tiny_recordrtc",audioButtonName:"tiny_recordrtc_audio",videoButtonName:"tiny_recordrtc_video",screenButtonName:"tiny_recordrtc_screen",videoContextMenuName:"tiny_recordrtc_video_context_menu"},_exports.default}));
|
||||
|
||||
//# sourceMappingURL=common.min.js.map
|
@ -1 +1 @@
|
||||
{"version":3,"file":"common.min.js","sources":["../src/common.js"],"sourcesContent":["// This file is part of Moodle - http://moodle.org/\n//\n// Moodle is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// Moodle is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with Moodle. If not, see <http://www.gnu.org/licenses/>.\n\n/**\n * Tiny Record RTC common values.\n *\n * @module tiny_recordrtc/common\n * @copyright 2022, Stevani Andolo <stevani@hotmail.com.au>\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\nexport default {\n pluginName: 'tiny_recordrtc/plugin',\n component: 'tiny_recordrtc',\n audioButtonName: 'tiny_recordrtc_audio',\n videoButtonName: 'tiny_recordrtc_video',\n screenButtonName: 'tiny_recordrtc_screen',\n videoMenuButtonName: 'tiny_recordrtc_video_menu',\n};\n"],"names":["pluginName","component","audioButtonName","videoButtonName","screenButtonName","videoMenuButtonName"],"mappings":"uKAuBe,CACXA,WAAY,wBACZC,UAAW,iBACXC,gBAAiB,uBACjBC,gBAAiB,uBACjBC,iBAAkB,wBAClBC,oBAAqB"}
|
||||
{"version":3,"file":"common.min.js","sources":["../src/common.js"],"sourcesContent":["// This file is part of Moodle - http://moodle.org/\n//\n// Moodle is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// Moodle is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with Moodle. If not, see <http://www.gnu.org/licenses/>.\n\n/**\n * Tiny Record RTC common values.\n *\n * @module tiny_recordrtc/common\n * @copyright 2022, Stevani Andolo <stevani@hotmail.com.au>\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\nexport default {\n pluginName: 'tiny_recordrtc/plugin',\n component: 'tiny_recordrtc',\n audioButtonName: 'tiny_recordrtc_audio',\n videoButtonName: 'tiny_recordrtc_video',\n screenButtonName: 'tiny_recordrtc_screen',\n videoContextMenuName: 'tiny_recordrtc_video_context_menu',\n};\n"],"names":["pluginName","component","audioButtonName","videoButtonName","screenButtonName","videoContextMenuName"],"mappings":"uKAuBe,CACXA,WAAY,wBACZC,UAAW,iBACXC,gBAAiB,uBACjBC,gBAAiB,uBACjBC,iBAAkB,wBAClBC,qBAAsB"}
|
@ -6,6 +6,6 @@ define("tiny_recordrtc/configuration",["exports","./common","editor_tiny/utils"]
|
||||
* @copyright 2022, Stevani Andolo <stevani@hotmail.com.au>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
const configureMenu=menu=>{const items=menu.insert.items.split(" ");return items.some(((item,index)=>!!item.match(/(media|video)\b/)&&(items.splice(index+1,0,_common.audioButtonName,_common.videoButtonName,_common.screenButtonName),!0)))?menu.insert.items=items.join(" "):(0,_utils.addMenubarItem)(menu,"insert","".concat(_common.audioButtonName," ").concat(_common.videoButtonName," ").concat(_common.screenButtonName)),menu};_exports.configure=instanceConfig=>{return{toolbar:(toolbar=instanceConfig.toolbar,toolbar.map((section=>("content"===section.name&&(section.items.some(((item,index)=>!!item.match(/(media|video)\b/)&&(section.items.splice(index+1,0,_common.audioButtonName,_common.videoMenuButtonName),!0)))||section.items.unshift(_common.audioButtonName,_common.videoMenuButtonName)),section)))),menu:configureMenu(instanceConfig.menu)};var toolbar}}));
|
||||
const configureMenu=menu=>{const items=menu.insert.items.split(" ");return items.some(((item,index)=>!!item.match(/(media|video)\b/)&&(items.splice(index+1,0,_common.audioButtonName,_common.videoButtonName,_common.screenButtonName),!0)))?menu.insert.items=items.join(" "):(0,_utils.addMenubarItem)(menu,"insert","".concat(_common.audioButtonName," ").concat(_common.videoButtonName," ").concat(_common.screenButtonName)),menu};_exports.configure=instanceConfig=>{return{toolbar:(toolbar=instanceConfig.toolbar,toolbar.map((section=>("content"===section.name&&(section.items.some(((item,index)=>!!item.match(/(media|video)\b/)&&(section.items.splice(index+1,0,_common.audioButtonName,_common.videoContextMenuName),!0)))||section.items.unshift(_common.audioButtonName,_common.videoContextMenuName)),section)))),menu:configureMenu(instanceConfig.menu)};var toolbar}}));
|
||||
|
||||
//# sourceMappingURL=configuration.min.js.map
|
@ -1 +1 @@
|
||||
{"version":3,"file":"configuration.min.js","sources":["../src/configuration.js"],"sourcesContent":["// This file is part of Moodle - http://moodle.org/\n//\n// Moodle is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// Moodle is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with Moodle. If not, see <http://www.gnu.org/licenses/>.\n\n/**\n * Tiny Record RTC configuration.\n *\n * @module tiny_recordrtc/configuration\n * @copyright 2022, Stevani Andolo <stevani@hotmail.com.au>\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\nimport {\n audioButtonName,\n videoButtonName,\n screenButtonName,\n videoMenuButtonName,\n} from './common';\nimport {\n addMenubarItem,\n} from 'editor_tiny/utils';\n\nconst configureMenu = (menu) => {\n const items = menu.insert.items.split(' ');\n const inserted = items.some((item, index) => {\n // Append after the media or video button.\n if (item.match(/(media|video)\\b/)) {\n items.splice(index + 1, 0, audioButtonName, videoButtonName, screenButtonName);\n return true;\n }\n\n return false;\n });\n\n if (inserted) {\n menu.insert.items = items.join(' ');\n } else {\n addMenubarItem(menu, 'insert', `${audioButtonName} ${videoButtonName} ${screenButtonName}`);\n }\n\n return menu;\n};\n\nconst configureToolbar = (toolbar) => {\n // The toolbar contains an array of named sections.\n // The Moodle integration ensures that there is a section called 'content'.\n\n\n return toolbar.map((section) => {\n if (section.name === 'content') {\n const inserted = section.items.some((item, index) => {\n // Append after the media or video button.\n if (item.match(/(media|video)\\b/)) {\n section.items.splice(index + 1, 0, audioButtonName, videoMenuButtonName);\n return true;\n }\n return false;\n });\n\n if (!inserted) {\n section.items.unshift(audioButtonName, videoMenuButtonName);\n }\n }\n\n return section;\n });\n};\n\nexport const configure = (instanceConfig) => {\n // Update the instance configuration to add the Media menu option to the menus and toolbars and upload_handler.\n return {\n toolbar: configureToolbar(instanceConfig.toolbar),\n menu: configureMenu(instanceConfig.menu),\n };\n};\n"],"names":["configureMenu","menu","items","insert","split","some","item","index","match","splice","audioButtonName","videoButtonName","screenButtonName","join","instanceConfig","toolbar","map","section","name","videoMenuButtonName","unshift"],"mappings":";;;;;;;;MAiCMA,cAAiBC,aACbC,MAAQD,KAAKE,OAAOD,MAAME,MAAM,YACrBF,MAAMG,MAAK,CAACC,KAAMC,UAE3BD,KAAKE,MAAM,qBACXN,MAAMO,OAAOF,MAAQ,EAAG,EAAGG,wBAAiBC,wBAAiBC,2BACtD,KAOXX,KAAKE,OAAOD,MAAQA,MAAMW,KAAK,+BAEhBZ,KAAM,mBAAaS,oCAAmBC,oCAAmBC,2BAGrEX,yBA4Bea,uBAEf,CACHC,SA5BkBA,QA4BQD,eAAeC,QAvBtCA,QAAQC,KAAKC,UACK,YAAjBA,QAAQC,OACSD,QAAQf,MAAMG,MAAK,CAACC,KAAMC,UAEnCD,KAAKE,MAAM,qBACXS,QAAQf,MAAMO,OAAOF,MAAQ,EAAG,EAAGG,wBAAiBS,8BAC7C,MAMXF,QAAQf,MAAMkB,QAAQV,wBAAiBS,8BAIxCF,YAQPhB,KAAMD,cAAcc,eAAeb,OA7BjBc,IAAAA"}
|
||||
{"version":3,"file":"configuration.min.js","sources":["../src/configuration.js"],"sourcesContent":["// This file is part of Moodle - http://moodle.org/\n//\n// Moodle is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// Moodle is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with Moodle. If not, see <http://www.gnu.org/licenses/>.\n\n/**\n * Tiny Record RTC configuration.\n *\n * @module tiny_recordrtc/configuration\n * @copyright 2022, Stevani Andolo <stevani@hotmail.com.au>\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\nimport {\n audioButtonName,\n videoButtonName,\n screenButtonName,\n videoContextMenuName,\n} from './common';\nimport {\n addMenubarItem,\n} from 'editor_tiny/utils';\n\nconst configureMenu = (menu) => {\n const items = menu.insert.items.split(' ');\n const inserted = items.some((item, index) => {\n // Append after the media or video button.\n if (item.match(/(media|video)\\b/)) {\n items.splice(index + 1, 0, audioButtonName, videoButtonName, screenButtonName);\n return true;\n }\n\n return false;\n });\n\n if (inserted) {\n menu.insert.items = items.join(' ');\n } else {\n addMenubarItem(menu, 'insert', `${audioButtonName} ${videoButtonName} ${screenButtonName}`);\n }\n\n return menu;\n};\n\nconst configureToolbar = (toolbar) => {\n // The toolbar contains an array of named sections.\n // The Moodle integration ensures that there is a section called 'content'.\n\n\n return toolbar.map((section) => {\n if (section.name === 'content') {\n const inserted = section.items.some((item, index) => {\n // Append after the media or video button.\n if (item.match(/(media|video)\\b/)) {\n section.items.splice(index + 1, 0, audioButtonName, videoContextMenuName);\n return true;\n }\n return false;\n });\n\n if (!inserted) {\n section.items.unshift(audioButtonName, videoContextMenuName);\n }\n }\n\n return section;\n });\n};\n\nexport const configure = (instanceConfig) => {\n // Update the instance configuration to add the Media menu option to the menus and toolbars and upload_handler.\n return {\n toolbar: configureToolbar(instanceConfig.toolbar),\n menu: configureMenu(instanceConfig.menu),\n };\n};\n"],"names":["configureMenu","menu","items","insert","split","some","item","index","match","splice","audioButtonName","videoButtonName","screenButtonName","join","instanceConfig","toolbar","map","section","name","videoContextMenuName","unshift"],"mappings":";;;;;;;;MAiCMA,cAAiBC,aACbC,MAAQD,KAAKE,OAAOD,MAAME,MAAM,YACrBF,MAAMG,MAAK,CAACC,KAAMC,UAE3BD,KAAKE,MAAM,qBACXN,MAAMO,OAAOF,MAAQ,EAAG,EAAGG,wBAAiBC,wBAAiBC,2BACtD,KAOXX,KAAKE,OAAOD,MAAQA,MAAMW,KAAK,+BAEhBZ,KAAM,mBAAaS,oCAAmBC,oCAAmBC,2BAGrEX,yBA4Bea,uBAEf,CACHC,SA5BkBA,QA4BQD,eAAeC,QAvBtCA,QAAQC,KAAKC,UACK,YAAjBA,QAAQC,OACSD,QAAQf,MAAMG,MAAK,CAACC,KAAMC,UAEnCD,KAAKE,MAAM,qBACXS,QAAQf,MAAMO,OAAOF,MAAQ,EAAG,EAAGG,wBAAiBS,+BAC7C,MAMXF,QAAQf,MAAMkB,QAAQV,wBAAiBS,+BAIxCF,YAQPhB,KAAMD,cAAcc,eAAeb,OA7BjBc,IAAAA"}
|
@ -1,10 +1,10 @@
|
||||
define("tiny_recordrtc/plugin",["exports","editor_tiny/loader","editor_tiny/utils","./commands_audio","./commands_video","./commands_screen","./commands_video_menu","./configuration","./options","./common"],(function(_exports,_loader,_utils,_commands_audio,_commands_video,_commands_screen,_commands_video_menu,Configuration,Options,_common){function _getRequireWildcardCache(nodeInterop){if("function"!=typeof WeakMap)return null;var cacheBabelInterop=new WeakMap,cacheNodeInterop=new WeakMap;return(_getRequireWildcardCache=function(nodeInterop){return nodeInterop?cacheNodeInterop:cacheBabelInterop})(nodeInterop)}function _interopRequireWildcard(obj,nodeInterop){if(!nodeInterop&&obj&&obj.__esModule)return obj;if(null===obj||"object"!=typeof obj&&"function"!=typeof obj)return{default:obj};var cache=_getRequireWildcardCache(nodeInterop);if(cache&&cache.has(obj))return cache.get(obj);var newObj={},hasPropertyDescriptor=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var key in obj)if("default"!==key&&Object.prototype.hasOwnProperty.call(obj,key)){var desc=hasPropertyDescriptor?Object.getOwnPropertyDescriptor(obj,key):null;desc&&(desc.get||desc.set)?Object.defineProperty(newObj,key,desc):newObj[key]=obj[key]}return newObj.default=obj,cache&&cache.set(obj,newObj),newObj}function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}
|
||||
define("tiny_recordrtc/plugin",["exports","editor_tiny/loader","editor_tiny/utils","./commands_audio","./commands_video","./commands_screen","./commands_video_context_menu","./configuration","./options","./common"],(function(_exports,_loader,_utils,_commands_audio,_commands_video,_commands_screen,_commands_video_context_menu,Configuration,Options,_common){function _getRequireWildcardCache(nodeInterop){if("function"!=typeof WeakMap)return null;var cacheBabelInterop=new WeakMap,cacheNodeInterop=new WeakMap;return(_getRequireWildcardCache=function(nodeInterop){return nodeInterop?cacheNodeInterop:cacheBabelInterop})(nodeInterop)}function _interopRequireWildcard(obj,nodeInterop){if(!nodeInterop&&obj&&obj.__esModule)return obj;if(null===obj||"object"!=typeof obj&&"function"!=typeof obj)return{default:obj};var cache=_getRequireWildcardCache(nodeInterop);if(cache&&cache.has(obj))return cache.get(obj);var newObj={},hasPropertyDescriptor=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var key in obj)if("default"!==key&&Object.prototype.hasOwnProperty.call(obj,key)){var desc=hasPropertyDescriptor?Object.getOwnPropertyDescriptor(obj,key):null;desc&&(desc.get||desc.set)?Object.defineProperty(newObj,key,desc):newObj[key]=obj[key]}return newObj.default=obj,cache&&cache.set(obj,newObj),newObj}function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}
|
||||
/**
|
||||
* Tiny Record RTC plugin for Moodle.
|
||||
*
|
||||
* @module tiny_recordrtc/plugin
|
||||
* @copyright 2022, Stevani Andolo <stevani@hotmail.com.au>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.default=void 0,_commands_audio=_interopRequireDefault(_commands_audio),_commands_video=_interopRequireDefault(_commands_video),_commands_screen=_interopRequireDefault(_commands_screen),_commands_video_menu=_interopRequireDefault(_commands_video_menu),Configuration=_interopRequireWildcard(Configuration),Options=_interopRequireWildcard(Options);var _default=new Promise((async resolve=>{const[tinyMCE,setupAudioCommands,setupVideoCommands,setupScreenCommands,setupVideoMenuCommands,pluginMetadata]=await Promise.all([(0,_loader.getTinyMCE)(),(0,_commands_audio.default)(),(0,_commands_video.default)(),(0,_commands_screen.default)(),(0,_commands_video_menu.default)(),(0,_utils.getPluginMetadata)(_common.component,_common.pluginName)]);tinyMCE.PluginManager.add("".concat(_common.component,"/plugin"),(editor=>(Options.register(editor),setupVideoCommands(editor),setupAudioCommands(editor),setupScreenCommands(editor),setupVideoMenuCommands(editor),pluginMetadata))),resolve(["".concat(_common.component,"/plugin"),Configuration])}));return _exports.default=_default,_exports.default}));
|
||||
*/Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.default=void 0,_commands_audio=_interopRequireDefault(_commands_audio),_commands_video=_interopRequireDefault(_commands_video),_commands_screen=_interopRequireDefault(_commands_screen),_commands_video_context_menu=_interopRequireDefault(_commands_video_context_menu),Configuration=_interopRequireWildcard(Configuration),Options=_interopRequireWildcard(Options);var _default=new Promise((async resolve=>{const[tinyMCE,setupAudioCommands,setupVideoCommands,setupScreenCommands,setupVideoContextMenuCommands,pluginMetadata]=await Promise.all([(0,_loader.getTinyMCE)(),(0,_commands_audio.default)(),(0,_commands_video.default)(),(0,_commands_screen.default)(),(0,_commands_video_context_menu.default)(),(0,_utils.getPluginMetadata)(_common.component,_common.pluginName)]);tinyMCE.PluginManager.add("".concat(_common.component,"/plugin"),(editor=>(Options.register(editor),setupVideoCommands(editor),setupAudioCommands(editor),setupScreenCommands(editor),setupVideoContextMenuCommands(editor),pluginMetadata))),resolve(["".concat(_common.component,"/plugin"),Configuration])}));return _exports.default=_default,_exports.default}));
|
||||
|
||||
//# sourceMappingURL=plugin.min.js.map
|
@ -1 +1 @@
|
||||
{"version":3,"file":"plugin.min.js","sources":["../src/plugin.js"],"sourcesContent":["// This file is part of Moodle - http://moodle.org/\n//\n// Moodle is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// Moodle is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with Moodle. If not, see <http://www.gnu.org/licenses/>.\n\n/**\n * Tiny Record RTC plugin for Moodle.\n *\n * @module tiny_recordrtc/plugin\n * @copyright 2022, Stevani Andolo <stevani@hotmail.com.au>\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\nimport {getTinyMCE} from 'editor_tiny/loader';\nimport {getPluginMetadata} from 'editor_tiny/utils';\nimport getSetupAudioCommands from './commands_audio';\nimport getSetupVideoCommands from './commands_video';\nimport getSetupScreenCommands from './commands_screen';\nimport getSetupVideoMenuCommands from './commands_video_menu';\nimport * as Configuration from './configuration';\nimport * as Options from './options';\nimport {\n component,\n pluginName\n} from './common';\n\n// eslint-disable-next-line no-async-promise-executor\nexport default new Promise(async(resolve) => {\n const [\n tinyMCE,\n setupAudioCommands,\n setupVideoCommands,\n setupScreenCommands,\n setupVideoMenuCommands,\n pluginMetadata,\n ] = await Promise.all([\n getTinyMCE(),\n getSetupAudioCommands(),\n getSetupVideoCommands(),\n getSetupScreenCommands(),\n getSetupVideoMenuCommands(),\n getPluginMetadata(component, pluginName),\n ]);\n\n tinyMCE.PluginManager.add(`${component}/plugin`, (editor) => {\n // Register options.\n Options.register(editor);\n\n // Setup the Commands (buttons, menu items, and so on) for video.\n setupVideoCommands(editor);\n\n // Setup the Commands (buttons, menu items, and so on) for audio.\n setupAudioCommands(editor);\n\n // Setup the Commands (buttons, menu items, and so on) for screen.\n setupScreenCommands(editor);\n\n // Setup the Commands (menu button) for video recording.\n setupVideoMenuCommands(editor);\n\n return pluginMetadata;\n });\n\n // Resolve the Media Plugin and include configuration.\n resolve([`${component}/plugin`, Configuration]);\n});\n"],"names":["Promise","async","tinyMCE","setupAudioCommands","setupVideoCommands","setupScreenCommands","setupVideoMenuCommands","pluginMetadata","all","component","pluginName","PluginManager","add","editor","Options","register","resolve","Configuration"],"mappings":";;;;;;;4aAoCe,IAAIA,SAAQC,MAAAA,gBAEnBC,QACAC,mBACAC,mBACAC,oBACAC,uBACAC,sBACMP,QAAQQ,IAAI,EAClB,yBACA,8BACA,8BACA,+BACA,mCACA,4BAAkBC,kBAAWC,sBAGjCR,QAAQS,cAAcC,cAAOH,8BAAqBI,SAE9CC,QAAQC,SAASF,QAGjBT,mBAAmBS,QAGnBV,mBAAmBU,QAGnBR,oBAAoBQ,QAGpBP,uBAAuBO,QAEhBN,kBAIXS,QAAQ,WAAIP,6BAAoBQ"}
|
||||
{"version":3,"file":"plugin.min.js","sources":["../src/plugin.js"],"sourcesContent":["// This file is part of Moodle - http://moodle.org/\n//\n// Moodle is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// Moodle is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with Moodle. If not, see <http://www.gnu.org/licenses/>.\n\n/**\n * Tiny Record RTC plugin for Moodle.\n *\n * @module tiny_recordrtc/plugin\n * @copyright 2022, Stevani Andolo <stevani@hotmail.com.au>\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\nimport {getTinyMCE} from 'editor_tiny/loader';\nimport {getPluginMetadata} from 'editor_tiny/utils';\nimport getSetupAudioCommands from './commands_audio';\nimport getSetupVideoCommands from './commands_video';\nimport getSetupScreenCommands from './commands_screen';\nimport getSetupVideoContextMenuCommands from './commands_video_context_menu';\nimport * as Configuration from './configuration';\nimport * as Options from './options';\nimport {\n component,\n pluginName\n} from './common';\n\n// eslint-disable-next-line no-async-promise-executor\nexport default new Promise(async(resolve) => {\n const [\n tinyMCE,\n setupAudioCommands,\n setupVideoCommands,\n setupScreenCommands,\n setupVideoContextMenuCommands,\n pluginMetadata,\n ] = await Promise.all([\n getTinyMCE(),\n getSetupAudioCommands(),\n getSetupVideoCommands(),\n getSetupScreenCommands(),\n getSetupVideoContextMenuCommands(),\n getPluginMetadata(component, pluginName),\n ]);\n\n tinyMCE.PluginManager.add(`${component}/plugin`, (editor) => {\n // Register options.\n Options.register(editor);\n\n // Setup the Commands (buttons, menu items, and so on) for video.\n setupVideoCommands(editor);\n\n // Setup the Commands (buttons, menu items, and so on) for audio.\n setupAudioCommands(editor);\n\n // Setup the Commands (buttons, menu items, and so on) for screen.\n setupScreenCommands(editor);\n\n // Setup the Commands (context menu) for video (recording and screen-sharing).\n setupVideoContextMenuCommands(editor);\n\n return pluginMetadata;\n });\n\n // Resolve the Media Plugin and include configuration.\n resolve([`${component}/plugin`, Configuration]);\n});\n"],"names":["Promise","async","tinyMCE","setupAudioCommands","setupVideoCommands","setupScreenCommands","setupVideoContextMenuCommands","pluginMetadata","all","component","pluginName","PluginManager","add","editor","Options","register","resolve","Configuration"],"mappings":";;;;;;;4bAoCe,IAAIA,SAAQC,MAAAA,gBAEnBC,QACAC,mBACAC,mBACAC,oBACAC,8BACAC,sBACMP,QAAQQ,IAAI,EAClB,yBACA,8BACA,8BACA,+BACA,2CACA,4BAAkBC,kBAAWC,sBAGjCR,QAAQS,cAAcC,cAAOH,8BAAqBI,SAE9CC,QAAQC,SAASF,QAGjBT,mBAAmBS,QAGnBV,mBAAmBU,QAGnBR,oBAAoBQ,QAGpBP,8BAA8BO,QAEvBN,kBAIXS,QAAQ,WAAIP,6BAAoBQ"}
|
@ -1,3 +1,3 @@
|
||||
define("tiny_recordrtc/screen_recorder",["exports","./base_recorder","tiny_recordrtc/modal","tiny_recordrtc/common","core/str"],(function(_exports,_base_recorder,_modal,_common,_str){function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _defineProperty(obj,key,value){return key in obj?Object.defineProperty(obj,key,{value:value,enumerable:!0,configurable:!0,writable:!0}):obj[key]=value,obj}Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.default=void 0,_base_recorder=_interopRequireDefault(_base_recorder),_modal=_interopRequireDefault(_modal);class Screen extends _base_recorder.default{configurePlayer(){return this.modalRoot.querySelector("video")}getSupportedTypes(){return["video/webm;codecs=vp9,opus","video/webm;codecs=vp8,opus","video/mp4;codecs=h264,opus","video/mp4;codecs=h264,wav","video/mp4;codecs=v9,opus"]}getRecordingOptions(){return{videoBitsPerSecond:parseInt(this.config.screenbitrate),videoWidth:parseInt(this.config.videoscreenwidth),videoHeight:parseInt(this.config.videoscreenheight)}}getMediaConstraints(){return{audio:!0,systemAudio:"exclude",video:{displaySurface:"monitor",frameRate:{ideal:24},width:{max:parseInt(this.config.videoscreenwidth)},height:{max:parseInt(this.config.videoscreenheight)}}}}playOnCapture(){return!0}getRecordingType(){return"screen"}getTimeLimit(){return this.config.screentimelimit}getEmbedTemplateName(){return"tiny_recordrtc/embed_screen"}getFileName(prefix){return"".concat(prefix,"-video.").concat(this.getFileExtension())}getFileExtension(){return window.MediaRecorder.isTypeSupported("audio/webm")?"webm":window.MediaRecorder.isTypeSupported("audio/mp4")?"mp4":(window.console.warn("Unknown file type for MediaRecorder API"),"")}async captureUserMedia(){const audioPromise=navigator.mediaDevices.getUserMedia({audio:!0}),screenPromise=navigator.mediaDevices.getDisplayMedia(this.getMediaConstraints());await Promise.allSettled([audioPromise,screenPromise]).then(this.combineAudioAndScreenRecording.bind(this))}combineAudioAndScreenRecording(results){const[audioData,screenData]=results;if("fulfilled"!==screenData.status)return void this.handleCaptureFailure(screenData.reason);const screenStream=screenData.value;if(screenStream.getVideoTracks()[0].addEventListener("ended",this.handleStopScreenSharing.bind(this)),"fulfilled"!==audioData.status)return void this.handleCaptureSuccess(screenStream);const audioStream=audioData.value,composedStream=new MediaStream;screenStream.getTracks().forEach((function(track){"video"===track.kind?composedStream.addTrack(track):track.stop()})),audioStream.getAudioTracks().forEach((function(micTrack){composedStream.addTrack(micTrack)})),this.handleCaptureSuccess(composedStream)}handleStopScreenSharing(){var _this$mediaRecorder;"recording"===(null===(_this$mediaRecorder=this.mediaRecorder)||void 0===_this$mediaRecorder?void 0:_this$mediaRecorder.state)?(this.requestRecordingStop(),this.cleanupStream()):(this.setRecordButtonState(!1),this.displayAlert((0,_str.getString)("screensharingstopped_title",_common.component),(0,_str.getString)("screensharingstopped",_common.component)))}handleRecordingStartStopRequested(){var _this$mediaRecorder2;"recording"===(null===(_this$mediaRecorder2=this.mediaRecorder)||void 0===_this$mediaRecorder2?void 0:_this$mediaRecorder2.state)?(this.requestRecordingStop(),this.cleanupStream()):this.startRecording()}static getModalClass(){var _class;return _defineProperty(_class=class extends _modal.default{},"TYPE","".concat(_common.component,"/screen_recorder")),_defineProperty(_class,"TEMPLATE","".concat(_common.component,"/screen_recorder")),_class}}return _exports.default=Screen,_exports.default}));
|
||||
define("tiny_recordrtc/screen_recorder",["exports","./base_recorder","tiny_recordrtc/modal","tiny_recordrtc/common","core/str"],(function(_exports,_base_recorder,_modal,_common,_str){function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _defineProperty(obj,key,value){return key in obj?Object.defineProperty(obj,key,{value:value,enumerable:!0,configurable:!0,writable:!0}):obj[key]=value,obj}Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.default=void 0,_base_recorder=_interopRequireDefault(_base_recorder),_modal=_interopRequireDefault(_modal);class Screen extends _base_recorder.default{configurePlayer(){return this.modalRoot.querySelector("video")}getSupportedTypes(){return["video/webm;codecs=vp9,opus","video/webm;codecs=vp8,opus","video/mp4;codecs=h264,opus","video/mp4;codecs=h264,wav","video/mp4;codecs=v9,opus"]}getRecordingOptions(){return{videoBitsPerSecond:parseInt(this.config.screenbitrate),videoWidth:parseInt(this.config.videoscreenwidth),videoHeight:parseInt(this.config.videoscreenheight)}}getMediaConstraints(){return{audio:!0,systemAudio:"exclude",video:{displaySurface:"monitor",frameRate:{ideal:24},width:{max:parseInt(this.config.videoscreenwidth)},height:{max:parseInt(this.config.videoscreenheight)}}}}playOnCapture(){return!0}getRecordingType(){return"screen"}getTimeLimit(){return this.config.screentimelimit}getEmbedTemplateName(){return"tiny_recordrtc/embed_screen"}getFileName(prefix){return"".concat(prefix,"-video.").concat(this.getFileExtension())}getFileExtension(){return window.MediaRecorder.isTypeSupported("audio/webm")?"webm":window.MediaRecorder.isTypeSupported("audio/mp4")?"mp4":(window.console.warn("Unknown file type for MediaRecorder API"),"")}async captureUserMedia(){const audioPromise=navigator.mediaDevices.getUserMedia({audio:!0}),screenPromise=navigator.mediaDevices.getDisplayMedia(this.getMediaConstraints());await Promise.allSettled([audioPromise,screenPromise]).then(this.combineAudioAndScreenRecording.bind(this))}combineAudioAndScreenRecording(results){const[audioData,screenData]=results;if("fulfilled"!==screenData.status)return void this.handleCaptureFailure(screenData.reason);const screenStream=screenData.value;if(screenStream.getVideoTracks()[0].addEventListener("ended",this.handleStopScreenSharing.bind(this)),"fulfilled"!==audioData.status)return void this.handleCaptureSuccess(screenStream);const audioStream=audioData.value,composedStream=new MediaStream;screenStream.getTracks().forEach((function(track){"video"===track.kind?composedStream.addTrack(track):track.stop()})),audioStream.getAudioTracks().forEach((function(micTrack){composedStream.addTrack(micTrack)})),this.handleCaptureSuccess(composedStream)}handleStopScreenSharing(){this.isRecording()?(this.requestRecordingStop(),this.cleanupStream()):(this.setRecordButtonState(!1),this.displayAlert((0,_str.getString)("screensharingstopped_title",_common.component),(0,_str.getString)("screensharingstopped",_common.component)))}handleRecordingStartStopRequested(){this.isRecording()?(this.requestRecordingStop(),this.cleanupStream()):this.startRecording()}static getModalClass(){var _class;return _defineProperty(_class=class extends _modal.default{},"TYPE","".concat(_common.component,"/screen_recorder")),_defineProperty(_class,"TEMPLATE","".concat(_common.component,"/screen_recorder")),_class}}return _exports.default=Screen,_exports.default}));
|
||||
|
||||
//# sourceMappingURL=screen_recorder.min.js.map
|
File diff suppressed because one or more lines are too long
@ -0,0 +1,89 @@
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Tiny Record RTC - Video context menu command.
|
||||
*
|
||||
* @module tiny_recordrtc/commands_video_context_menu
|
||||
* @copyright 2024 The Open University
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
import {getString} from 'core/str';
|
||||
import {getButtonImage} from 'editor_tiny/utils';
|
||||
import {
|
||||
videoButtonName,
|
||||
screenButtonName,
|
||||
videoContextMenuName,
|
||||
component,
|
||||
} from './common';
|
||||
import {isVideoAllowed, isScreenAllowed} from './options';
|
||||
import videoRecorder from "./video_recorder";
|
||||
import screenRecorder from "./screen_recorder";
|
||||
|
||||
export default async() => {
|
||||
const [
|
||||
videoContextMenuTitle,
|
||||
videoButtonTitle,
|
||||
screenButtonTitle,
|
||||
buttonImageVideo,
|
||||
buttonImageScreen,
|
||||
] = await Promise.all([
|
||||
getString('videorecordmenutitle', component),
|
||||
getString('videobuttontitle', component),
|
||||
getString('screenbuttontitle', component),
|
||||
getButtonImage('video', component),
|
||||
getButtonImage('screen', component),
|
||||
]);
|
||||
|
||||
return (editor) => {
|
||||
let useContextMenu = true;
|
||||
let singleButton = 'video';
|
||||
let singleButtonTitle = videoButtonTitle;
|
||||
let imageHtml = buttonImageVideo.html;
|
||||
let recorder;
|
||||
if (!isVideoAllowed(editor) && !isScreenAllowed(editor)) {
|
||||
return;
|
||||
} else if (isVideoAllowed(editor) && !isScreenAllowed(editor)) {
|
||||
// Only video recording is allowed.
|
||||
useContextMenu = false;
|
||||
recorder = videoRecorder;
|
||||
} else if (isScreenAllowed(editor) && !isVideoAllowed(editor)) {
|
||||
// Only screen recording is allowed.
|
||||
useContextMenu = false;
|
||||
singleButton = 'screen';
|
||||
singleButtonTitle = screenButtonTitle;
|
||||
imageHtml = buttonImageScreen.html;
|
||||
recorder = screenRecorder;
|
||||
}
|
||||
editor.ui.registry.addIcon(singleButton, imageHtml);
|
||||
|
||||
if (useContextMenu) {
|
||||
// Add the video and screen buttons to the context menu.
|
||||
editor.ui.registry.addMenuButton(videoContextMenuName, {
|
||||
icon: singleButton,
|
||||
tooltip: videoContextMenuTitle,
|
||||
fetch: callback => callback(`${videoButtonName} ${screenButtonName}`),
|
||||
});
|
||||
} else {
|
||||
// Add the video or screen button to the toolbar.
|
||||
editor.ui.registry.addButton(videoContextMenuName, {
|
||||
icon: singleButton,
|
||||
tooltip: singleButtonTitle,
|
||||
onAction: () => recorder.display(editor),
|
||||
});
|
||||
}
|
||||
};
|
||||
};
|
@ -1,57 +0,0 @@
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Tiny Record RTC - record base command.
|
||||
*
|
||||
* @module tiny_recordrtc/commands
|
||||
* @copyright 2024 The Open University
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
import {getString} from 'core/str';
|
||||
import {getButtonImage as getVideoIcon} from 'editor_tiny/utils';
|
||||
import {
|
||||
videoButtonName,
|
||||
screenButtonName,
|
||||
videoMenuButtonName,
|
||||
component,
|
||||
} from './common';
|
||||
import {isVideoAllowed, isScreenAllowed} from './options';
|
||||
|
||||
export default async() => {
|
||||
const [
|
||||
videorecordmenutitle,
|
||||
buttonImage,
|
||||
] = await Promise.all([
|
||||
getString('videorecordmenutitle', component),
|
||||
getVideoIcon('video', component),
|
||||
]);
|
||||
|
||||
return (editor) => {
|
||||
if (!isVideoAllowed(editor) && !isScreenAllowed(editor)) {
|
||||
return;
|
||||
}
|
||||
|
||||
const icon = 'video';
|
||||
editor.ui.registry.addIcon(icon, buttonImage.html);
|
||||
|
||||
editor.ui.registry.addMenuButton(videoMenuButtonName, {
|
||||
icon,
|
||||
tooltip: videorecordmenutitle,
|
||||
fetch: callback => callback(`${videoButtonName} ${screenButtonName}`),
|
||||
});
|
||||
};
|
||||
};
|
@ -27,5 +27,5 @@ export default {
|
||||
audioButtonName: 'tiny_recordrtc_audio',
|
||||
videoButtonName: 'tiny_recordrtc_video',
|
||||
screenButtonName: 'tiny_recordrtc_screen',
|
||||
videoMenuButtonName: 'tiny_recordrtc_video_menu',
|
||||
videoContextMenuName: 'tiny_recordrtc_video_context_menu',
|
||||
};
|
||||
|
@ -25,7 +25,7 @@ import {
|
||||
audioButtonName,
|
||||
videoButtonName,
|
||||
screenButtonName,
|
||||
videoMenuButtonName,
|
||||
videoContextMenuName,
|
||||
} from './common';
|
||||
import {
|
||||
addMenubarItem,
|
||||
@ -62,14 +62,14 @@ const configureToolbar = (toolbar) => {
|
||||
const inserted = section.items.some((item, index) => {
|
||||
// Append after the media or video button.
|
||||
if (item.match(/(media|video)\b/)) {
|
||||
section.items.splice(index + 1, 0, audioButtonName, videoMenuButtonName);
|
||||
section.items.splice(index + 1, 0, audioButtonName, videoContextMenuName);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
});
|
||||
|
||||
if (!inserted) {
|
||||
section.items.unshift(audioButtonName, videoMenuButtonName);
|
||||
section.items.unshift(audioButtonName, videoContextMenuName);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -25,7 +25,7 @@ import {getPluginMetadata} from 'editor_tiny/utils';
|
||||
import getSetupAudioCommands from './commands_audio';
|
||||
import getSetupVideoCommands from './commands_video';
|
||||
import getSetupScreenCommands from './commands_screen';
|
||||
import getSetupVideoMenuCommands from './commands_video_menu';
|
||||
import getSetupVideoContextMenuCommands from './commands_video_context_menu';
|
||||
import * as Configuration from './configuration';
|
||||
import * as Options from './options';
|
||||
import {
|
||||
@ -40,14 +40,14 @@ export default new Promise(async(resolve) => {
|
||||
setupAudioCommands,
|
||||
setupVideoCommands,
|
||||
setupScreenCommands,
|
||||
setupVideoMenuCommands,
|
||||
setupVideoContextMenuCommands,
|
||||
pluginMetadata,
|
||||
] = await Promise.all([
|
||||
getTinyMCE(),
|
||||
getSetupAudioCommands(),
|
||||
getSetupVideoCommands(),
|
||||
getSetupScreenCommands(),
|
||||
getSetupVideoMenuCommands(),
|
||||
getSetupVideoContextMenuCommands(),
|
||||
getPluginMetadata(component, pluginName),
|
||||
]);
|
||||
|
||||
@ -64,8 +64,8 @@ export default new Promise(async(resolve) => {
|
||||
// Setup the Commands (buttons, menu items, and so on) for screen.
|
||||
setupScreenCommands(editor);
|
||||
|
||||
// Setup the Commands (menu button) for video recording.
|
||||
setupVideoMenuCommands(editor);
|
||||
// Setup the Commands (context menu) for video (recording and screen-sharing).
|
||||
setupVideoContextMenuCommands(editor);
|
||||
|
||||
return pluginMetadata;
|
||||
});
|
||||
|
@ -109,7 +109,7 @@ export default class Screen extends BaseClass {
|
||||
return '';
|
||||
}
|
||||
|
||||
async captureUserMedia() {
|
||||
async captureUserMedia() {
|
||||
// Screen recording requires both audio and the screen, and we need to get them both together.
|
||||
const audioPromise = navigator.mediaDevices.getUserMedia({audio: true});
|
||||
const screenPromise = navigator.mediaDevices.getDisplayMedia(this.getMediaConstraints());
|
||||
@ -118,6 +118,7 @@ export default class Screen extends BaseClass {
|
||||
// Therefore, we will use Promise.allSettled instead of Promise.all.
|
||||
await Promise.allSettled([audioPromise, screenPromise]).then(this.combineAudioAndScreenRecording.bind(this));
|
||||
}
|
||||
|
||||
/**
|
||||
* For starting screen recording, once we have both audio and video, combine them.
|
||||
*
|
||||
@ -163,7 +164,7 @@ export default class Screen extends BaseClass {
|
||||
* Callback that is called by the user clicking Stop screen sharing on the browser.
|
||||
*/
|
||||
handleStopScreenSharing() {
|
||||
if (this.mediaRecorder?.state === 'recording') {
|
||||
if (this.isRecording()) {
|
||||
this.requestRecordingStop();
|
||||
this.cleanupStream();
|
||||
} else {
|
||||
@ -176,7 +177,7 @@ export default class Screen extends BaseClass {
|
||||
}
|
||||
|
||||
handleRecordingStartStopRequested() {
|
||||
if (this.mediaRecorder?.state === 'recording') {
|
||||
if (this.isRecording()) {
|
||||
this.requestRecordingStop();
|
||||
this.cleanupStream();
|
||||
} else {
|
||||
|
42
lib/editor/tiny/plugins/recordrtc/classes/constants.php
Normal file
42
lib/editor/tiny/plugins/recordrtc/classes/constants.php
Normal file
@ -0,0 +1,42 @@
|
||||
<?php
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
namespace tiny_recordrtc;
|
||||
|
||||
/**
|
||||
* Constants for Tiny RecordRTC plugin.
|
||||
*
|
||||
* @package tiny_recordrtc
|
||||
* @copyright 2024 Huong Nguyen <huongnv13@gmail.com>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class constants {
|
||||
|
||||
/** @var string TINYRECORDRTC_AUDIO_TYPE The audio recording type. */
|
||||
public const TINYRECORDRTC_AUDIO_TYPE = 'audio';
|
||||
|
||||
/** @var string TINYRECORDRTC_VIDEO_TYPE The video recording type. */
|
||||
public const TINYRECORDRTC_VIDEO_TYPE = 'video';
|
||||
|
||||
/** @var string TINYRECORDRTC_SCREEN_TYPE The screen-sharing recording type. */
|
||||
public const TINYRECORDRTC_SCREEN_TYPE = 'screen';
|
||||
|
||||
/** @var string TINYRECORDRTC_SCREEN_HD The HD screen-sharing resolution. */
|
||||
public const TINYRECORDRTC_SCREEN_HD = '1280,720';
|
||||
|
||||
/** @var string TINYRECORDRTC_SCREEN_FHD The Full-HD screen-sharing resolution. */
|
||||
public const TINYRECORDRTC_SCREEN_FHD = '1920,1080';
|
||||
}
|
@ -87,17 +87,17 @@ class plugininfo extends plugin implements plugin_with_buttons, plugin_with_menu
|
||||
$screenallowed = false;
|
||||
foreach ($allowedtypes as $value) {
|
||||
switch ($value) {
|
||||
case 'audio':
|
||||
case constants::TINYRECORDRTC_AUDIO_TYPE:
|
||||
if (has_capability('tiny/recordrtc:recordaudio', $context)) {
|
||||
$audioallowed = true;
|
||||
}
|
||||
break;
|
||||
case 'video':
|
||||
case constants::TINYRECORDRTC_VIDEO_TYPE:
|
||||
if (has_capability('tiny/recordrtc:recordvideo', $context)) {
|
||||
$videoallowed = true;
|
||||
}
|
||||
break;
|
||||
case 'screen':
|
||||
case constants::TINYRECORDRTC_SCREEN_TYPE:
|
||||
if (has_capability('tiny/recordrtc:recordscreen', $context)) {
|
||||
$screenallowed = true;
|
||||
}
|
||||
|
@ -29,9 +29,17 @@
|
||||
*/
|
||||
function xmldb_tiny_recordrtc_upgrade($oldversion) {
|
||||
if ($oldversion < 2024042400) {
|
||||
// Convert the old setting to the new one.
|
||||
$allowedtypes = get_config('tiny_recordrtc', 'allowedtypes');
|
||||
if ($allowedtypes === 'both') {
|
||||
set_config('allowedtypes', 'audio,video', 'tiny_recordrtc');
|
||||
set_config(
|
||||
'allowedtypes',
|
||||
implode(',', [
|
||||
tiny_recordrtc\constants::TINYRECORDRTC_AUDIO_TYPE,
|
||||
tiny_recordrtc\constants::TINYRECORDRTC_VIDEO_TYPE,
|
||||
]),
|
||||
'tiny_recordrtc'
|
||||
);
|
||||
}
|
||||
|
||||
upgrade_plugin_savepoint(true, 2024042400, 'tiny', 'recordrtc');
|
||||
|
@ -75,6 +75,8 @@ $string['recordrtc:recordvideo'] = 'Record video in the text editor';
|
||||
$string['screenbitrate'] = 'Screen bitrate';
|
||||
$string['screenbitrate_desc'] = 'Quality of Screen recording (larger number means higher quality).';
|
||||
$string['screenbuttontitle'] = 'Record screen';
|
||||
$string['screenresolution_hd'] = '1280 x 720 (16:9)';
|
||||
$string['screenresolution_fhd'] = '1920 x 1080 (16:9)';
|
||||
$string['screensharingstopped'] = 'You stopped sharing your screen before starting the recording. Please allow screen sharing in your browser settings and start the recording again.';
|
||||
$string['screensharingstopped_title'] = 'Sharing stopped';
|
||||
$string['screensize'] = 'Screen recording size';
|
||||
|
@ -1,3 +1,4 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="18" height="18" viewBox="0 0 18 18">
|
||||
<defs>
|
||||
<clipPath id="a">
|
||||
@ -19,4 +20,4 @@
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
@ -45,13 +45,16 @@ if ($ADMIN->fulltree) {
|
||||
|
||||
// Types allowed.
|
||||
$options = [
|
||||
'audio' => new lang_string('onlyaudio', 'tiny_recordrtc'),
|
||||
'video' => new lang_string('onlyvideo', 'tiny_recordrtc'),
|
||||
'screen' => new lang_string('onlyscreen', 'tiny_recordrtc'),
|
||||
\tiny_recordrtc\constants::TINYRECORDRTC_AUDIO_TYPE => new lang_string('onlyaudio', 'tiny_recordrtc'),
|
||||
\tiny_recordrtc\constants::TINYRECORDRTC_VIDEO_TYPE => new lang_string('onlyvideo', 'tiny_recordrtc'),
|
||||
\tiny_recordrtc\constants::TINYRECORDRTC_SCREEN_TYPE => new lang_string('onlyscreen', 'tiny_recordrtc'),
|
||||
];
|
||||
$name = get_string('allowedtypes', 'tiny_recordrtc');
|
||||
$desc = get_string('allowedtypes_desc', 'tiny_recordrtc');
|
||||
$default = ['audio' => 1, 'video' => 1];
|
||||
$default = [
|
||||
\tiny_recordrtc\constants::TINYRECORDRTC_AUDIO_TYPE => 1,
|
||||
\tiny_recordrtc\constants::TINYRECORDRTC_VIDEO_TYPE => 1,
|
||||
];
|
||||
$setting = new admin_setting_configmulticheckbox('tiny_recordrtc/allowedtypes', $name, $desc, $default, $options);
|
||||
$settings->add($setting);
|
||||
|
||||
@ -118,8 +121,8 @@ if ($ADMIN->fulltree) {
|
||||
// Screen output settings.
|
||||
// Number of items to display in a box.
|
||||
$options = [
|
||||
'1280,720' => '1280 x 720 (16:9)',
|
||||
'1920,1080' => '1920 x 1080 (16:9)',
|
||||
\tiny_recordrtc\constants::TINYRECORDRTC_SCREEN_HD => get_string('screenresolution_hd', 'tiny_recordrtc'),
|
||||
\tiny_recordrtc\constants::TINYRECORDRTC_SCREEN_FHD => get_string('screenresolution_fhd', 'tiny_recordrtc'),
|
||||
];
|
||||
$name = get_string('screensize', 'tiny_recordrtc');
|
||||
$desc = get_string('screensize_desc', 'tiny_recordrtc');
|
||||
|
Loading…
x
Reference in New Issue
Block a user