mirror of
https://github.com/moodle/moodle.git
synced 2025-04-22 08:55:15 +02:00
Merge branch 'MDL-78391-401' of https://github.com/andrewnicols/moodle into MOODLE_401_STABLE
This commit is contained in:
commit
6509d6d944
@ -189,9 +189,31 @@ M.atto_recordrtc.commonmodule = {
|
||||
}
|
||||
},
|
||||
|
||||
getFileExtension: function(type) {
|
||||
if (type === 'audio') {
|
||||
if (window.MediaRecorder.isTypeSupported('audio/webm')) {
|
||||
return 'webm';
|
||||
} else if (window.MediaRecorder.isTypeSupported('audio/ogg')) {
|
||||
return 'ogg';
|
||||
} else if (window.MediaRecorder.isTypeSupported('audio/mp4')) {
|
||||
return 'mp4';
|
||||
}
|
||||
} else {
|
||||
if (window.MediaRecorder.isTypeSupported('audio/webm')) {
|
||||
return 'webm';
|
||||
} else if (window.MediaRecorder.isTypeSupported('audio/mp4')) {
|
||||
return 'mp4';
|
||||
}
|
||||
}
|
||||
|
||||
window.console.warning('Unknown file type for MediaRecorder API');
|
||||
return '';
|
||||
},
|
||||
|
||||
// Upload recorded audio/video to server.
|
||||
upload_to_server: function(type, callback) {
|
||||
var xhr = new window.XMLHttpRequest();
|
||||
var fileExtension = this.getFileExtension(type);
|
||||
|
||||
// Get src media of audio/video tag.
|
||||
xhr.open('GET', cm.player.get('src'), true);
|
||||
@ -204,8 +226,8 @@ M.atto_recordrtc.commonmodule = {
|
||||
|
||||
// Generate filename with random ID and file extension.
|
||||
var fileName = (Math.random() * 1000).toString().replace('.', '');
|
||||
fileName += (type === 'audio') ? '-audio.ogg'
|
||||
: '-video.webm';
|
||||
fileName += (type === 'audio') ? '-audio.' + fileExtension
|
||||
: '-video.' + fileExtension;
|
||||
|
||||
// Create FormData to send to PHP filepicker-upload script.
|
||||
var formData = new window.FormData(),
|
||||
@ -471,17 +493,35 @@ M.atto_recordrtc.abstractmodule = {
|
||||
|
||||
if (recType === 'audio') {
|
||||
types = [
|
||||
// Firefox and Chrome both support webm and ogg.
|
||||
'audio/webm;codecs=opus',
|
||||
'audio/ogg;codecs=opus'
|
||||
'audio/ogg;codecs=opus',
|
||||
|
||||
// Safari supports mp4.
|
||||
'audio/mp4;codecs=opus',
|
||||
'audio/mp4;codecs=wav',
|
||||
'audio/mp4;codecs=mp3',
|
||||
];
|
||||
options = {
|
||||
audioBitsPerSecond: window.parseInt(cm.editorScope.get('audiobitrate'))
|
||||
};
|
||||
} else {
|
||||
types = [
|
||||
// Support webm as a preference.
|
||||
// This container supports both vp9, and vp8.
|
||||
// It does not support AVC1/h264 at all.
|
||||
// It is supported by Chromium, and Firefox browsers, but not Safari.
|
||||
'video/webm;codecs=vp9,opus',
|
||||
'video/webm;codecs=h264,opus',
|
||||
'video/webm;codecs=vp8,opus'
|
||||
'video/webm;codecs=vp8,opus',
|
||||
|
||||
// Fall back to mp4 if webm is not available.
|
||||
// The mp4 container supports v9, and h264 but neither of these are supported for recording on other
|
||||
// browsers.
|
||||
// In addition to this, we can record in v9, but VideoJS does not support an mp4 containern with v9 codec
|
||||
// for playback. We leave it as a final option as a just-in-case.
|
||||
'video/mp4;codecs=h264,opus',
|
||||
'video/mp4;codecs=h264,wav',
|
||||
'video/mp4;codecs=v9,opus',
|
||||
];
|
||||
options = {
|
||||
audioBitsPerSecond: window.parseInt(cm.editorScope.get('audiobitrate')),
|
||||
@ -489,7 +529,15 @@ M.atto_recordrtc.abstractmodule = {
|
||||
};
|
||||
}
|
||||
|
||||
var compatTypes = types.filter(function(type) {
|
||||
var possibleTypes = types.reduce(function(result, type) {
|
||||
result.push(type);
|
||||
// Safari seems to use codecs: instead of codecs=.
|
||||
// It is safe to add both, so we do, but we want them to remain in order.
|
||||
result.push(type.replace('=', ':'));
|
||||
return result;
|
||||
}, []);
|
||||
|
||||
var compatTypes = possibleTypes.filter(function(type) {
|
||||
return window.MediaRecorder.isTypeSupported(type);
|
||||
});
|
||||
|
||||
|
File diff suppressed because one or more lines are too long
@ -189,9 +189,31 @@ M.atto_recordrtc.commonmodule = {
|
||||
}
|
||||
},
|
||||
|
||||
getFileExtension: function(type) {
|
||||
if (type === 'audio') {
|
||||
if (window.MediaRecorder.isTypeSupported('audio/webm')) {
|
||||
return 'webm';
|
||||
} else if (window.MediaRecorder.isTypeSupported('audio/ogg')) {
|
||||
return 'ogg';
|
||||
} else if (window.MediaRecorder.isTypeSupported('audio/mp4')) {
|
||||
return 'mp4';
|
||||
}
|
||||
} else {
|
||||
if (window.MediaRecorder.isTypeSupported('audio/webm')) {
|
||||
return 'webm';
|
||||
} else if (window.MediaRecorder.isTypeSupported('audio/mp4')) {
|
||||
return 'mp4';
|
||||
}
|
||||
}
|
||||
|
||||
window.console.warning('Unknown file type for MediaRecorder API');
|
||||
return '';
|
||||
},
|
||||
|
||||
// Upload recorded audio/video to server.
|
||||
upload_to_server: function(type, callback) {
|
||||
var xhr = new window.XMLHttpRequest();
|
||||
var fileExtension = this.getFileExtension(type);
|
||||
|
||||
// Get src media of audio/video tag.
|
||||
xhr.open('GET', cm.player.get('src'), true);
|
||||
@ -204,8 +226,8 @@ M.atto_recordrtc.commonmodule = {
|
||||
|
||||
// Generate filename with random ID and file extension.
|
||||
var fileName = (Math.random() * 1000).toString().replace('.', '');
|
||||
fileName += (type === 'audio') ? '-audio.ogg'
|
||||
: '-video.webm';
|
||||
fileName += (type === 'audio') ? '-audio.' + fileExtension
|
||||
: '-video.' + fileExtension;
|
||||
|
||||
// Create FormData to send to PHP filepicker-upload script.
|
||||
var formData = new window.FormData(),
|
||||
@ -471,17 +493,35 @@ M.atto_recordrtc.abstractmodule = {
|
||||
|
||||
if (recType === 'audio') {
|
||||
types = [
|
||||
// Firefox and Chrome both support webm and ogg.
|
||||
'audio/webm;codecs=opus',
|
||||
'audio/ogg;codecs=opus'
|
||||
'audio/ogg;codecs=opus',
|
||||
|
||||
// Safari supports mp4.
|
||||
'audio/mp4;codecs=opus',
|
||||
'audio/mp4;codecs=wav',
|
||||
'audio/mp4;codecs=mp3',
|
||||
];
|
||||
options = {
|
||||
audioBitsPerSecond: window.parseInt(cm.editorScope.get('audiobitrate'))
|
||||
};
|
||||
} else {
|
||||
types = [
|
||||
// Support webm as a preference.
|
||||
// This container supports both vp9, and vp8.
|
||||
// It does not support AVC1/h264 at all.
|
||||
// It is supported by Chromium, and Firefox browsers, but not Safari.
|
||||
'video/webm;codecs=vp9,opus',
|
||||
'video/webm;codecs=h264,opus',
|
||||
'video/webm;codecs=vp8,opus'
|
||||
'video/webm;codecs=vp8,opus',
|
||||
|
||||
// Fall back to mp4 if webm is not available.
|
||||
// The mp4 container supports v9, and h264 but neither of these are supported for recording on other
|
||||
// browsers.
|
||||
// In addition to this, we can record in v9, but VideoJS does not support an mp4 containern with v9 codec
|
||||
// for playback. We leave it as a final option as a just-in-case.
|
||||
'video/mp4;codecs=h264,opus',
|
||||
'video/mp4;codecs=h264,wav',
|
||||
'video/mp4;codecs=v9,opus',
|
||||
];
|
||||
options = {
|
||||
audioBitsPerSecond: window.parseInt(cm.editorScope.get('audiobitrate')),
|
||||
@ -489,7 +529,15 @@ M.atto_recordrtc.abstractmodule = {
|
||||
};
|
||||
}
|
||||
|
||||
var compatTypes = types.filter(function(type) {
|
||||
var possibleTypes = types.reduce(function(result, type) {
|
||||
result.push(type);
|
||||
// Safari seems to use codecs: instead of codecs=.
|
||||
// It is safe to add both, so we do, but we want them to remain in order.
|
||||
result.push(type.replace('=', ':'));
|
||||
return result;
|
||||
}, []);
|
||||
|
||||
var compatTypes = possibleTypes.filter(function(type) {
|
||||
return window.MediaRecorder.isTypeSupported(type);
|
||||
});
|
||||
|
||||
|
@ -80,17 +80,35 @@ M.atto_recordrtc.abstractmodule = {
|
||||
|
||||
if (recType === 'audio') {
|
||||
types = [
|
||||
// Firefox and Chrome both support webm and ogg.
|
||||
'audio/webm;codecs=opus',
|
||||
'audio/ogg;codecs=opus'
|
||||
'audio/ogg;codecs=opus',
|
||||
|
||||
// Safari supports mp4.
|
||||
'audio/mp4;codecs=opus',
|
||||
'audio/mp4;codecs=wav',
|
||||
'audio/mp4;codecs=mp3',
|
||||
];
|
||||
options = {
|
||||
audioBitsPerSecond: window.parseInt(cm.editorScope.get('audiobitrate'))
|
||||
};
|
||||
} else {
|
||||
types = [
|
||||
// Support webm as a preference.
|
||||
// This container supports both vp9, and vp8.
|
||||
// It does not support AVC1/h264 at all.
|
||||
// It is supported by Chromium, and Firefox browsers, but not Safari.
|
||||
'video/webm;codecs=vp9,opus',
|
||||
'video/webm;codecs=h264,opus',
|
||||
'video/webm;codecs=vp8,opus'
|
||||
'video/webm;codecs=vp8,opus',
|
||||
|
||||
// Fall back to mp4 if webm is not available.
|
||||
// The mp4 container supports v9, and h264 but neither of these are supported for recording on other
|
||||
// browsers.
|
||||
// In addition to this, we can record in v9, but VideoJS does not support an mp4 containern with v9 codec
|
||||
// for playback. We leave it as a final option as a just-in-case.
|
||||
'video/mp4;codecs=h264,opus',
|
||||
'video/mp4;codecs=h264,wav',
|
||||
'video/mp4;codecs=v9,opus',
|
||||
];
|
||||
options = {
|
||||
audioBitsPerSecond: window.parseInt(cm.editorScope.get('audiobitrate')),
|
||||
@ -98,7 +116,15 @@ M.atto_recordrtc.abstractmodule = {
|
||||
};
|
||||
}
|
||||
|
||||
var compatTypes = types.filter(function(type) {
|
||||
var possibleTypes = types.reduce(function(result, type) {
|
||||
result.push(type);
|
||||
// Safari seems to use codecs: instead of codecs=.
|
||||
// It is safe to add both, so we do, but we want them to remain in order.
|
||||
result.push(type.replace('=', ':'));
|
||||
return result;
|
||||
}, []);
|
||||
|
||||
var compatTypes = possibleTypes.filter(function(type) {
|
||||
return window.MediaRecorder.isTypeSupported(type);
|
||||
});
|
||||
|
||||
|
@ -187,9 +187,31 @@ M.atto_recordrtc.commonmodule = {
|
||||
}
|
||||
},
|
||||
|
||||
getFileExtension: function(type) {
|
||||
if (type === 'audio') {
|
||||
if (window.MediaRecorder.isTypeSupported('audio/webm')) {
|
||||
return 'webm';
|
||||
} else if (window.MediaRecorder.isTypeSupported('audio/ogg')) {
|
||||
return 'ogg';
|
||||
} else if (window.MediaRecorder.isTypeSupported('audio/mp4')) {
|
||||
return 'mp4';
|
||||
}
|
||||
} else {
|
||||
if (window.MediaRecorder.isTypeSupported('audio/webm')) {
|
||||
return 'webm';
|
||||
} else if (window.MediaRecorder.isTypeSupported('audio/mp4')) {
|
||||
return 'mp4';
|
||||
}
|
||||
}
|
||||
|
||||
window.console.warning('Unknown file type for MediaRecorder API');
|
||||
return '';
|
||||
},
|
||||
|
||||
// Upload recorded audio/video to server.
|
||||
upload_to_server: function(type, callback) {
|
||||
var xhr = new window.XMLHttpRequest();
|
||||
var fileExtension = this.getFileExtension(type);
|
||||
|
||||
// Get src media of audio/video tag.
|
||||
xhr.open('GET', cm.player.get('src'), true);
|
||||
@ -202,8 +224,8 @@ M.atto_recordrtc.commonmodule = {
|
||||
|
||||
// Generate filename with random ID and file extension.
|
||||
var fileName = (Math.random() * 1000).toString().replace('.', '');
|
||||
fileName += (type === 'audio') ? '-audio.ogg'
|
||||
: '-video.webm';
|
||||
fileName += (type === 'audio') ? '-audio.' + fileExtension
|
||||
: '-video.' + fileExtension;
|
||||
|
||||
// Create FormData to send to PHP filepicker-upload script.
|
||||
var formData = new window.FormData(),
|
||||
|
@ -1,3 +1,3 @@
|
||||
define("tiny_recordrtc/audio_recorder",["exports","./base_recorder","./modal","core/modal_registry","tiny_recordrtc/common"],(function(_exports,_base_recorder,_modal,_modal_registry,_common){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),_modal_registry=_interopRequireDefault(_modal_registry);class Audio extends _base_recorder.default{configurePlayer(){return this.modalRoot.querySelector("audio")}getSupportedTypes(){return["audio/webm;codecs=opus","audio/ogg;codecs=opus"]}getParsedRecordingOptions(){return{audioBitsPerSecond:parseInt(this.config.audiobitrate)}}getMediaConstraints(){return{audio:!0}}getRecordingType(){return"audio"}getTimeLimit(){return this.config.audiotimelimit}getEmbedTemplateName(){return"tiny_recordrtc/embed_audio"}getFileName(prefix){return"".concat(prefix,"-audio.ogg")}static getModalClass(){var _class;const modalType="".concat(_common.component,"/audio_recorder"),registration=_modal_registry.default.get(modalType);if(registration)return registration.module;const AudioModal=(_defineProperty(_class=class extends _modal.default{},"TYPE",modalType),_defineProperty(_class,"TEMPLATE","".concat(_common.component,"/audio_recorder")),_class);return _modal_registry.default.register(AudioModal.TYPE,AudioModal,AudioModal.TEMPLATE),AudioModal}}return _exports.default=Audio,_exports.default}));
|
||||
define("tiny_recordrtc/audio_recorder",["exports","./base_recorder","./modal","core/modal_registry","tiny_recordrtc/common"],(function(_exports,_base_recorder,_modal,_modal_registry,_common){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),_modal_registry=_interopRequireDefault(_modal_registry);class Audio extends _base_recorder.default{configurePlayer(){return this.modalRoot.querySelector("audio")}getSupportedTypes(){return["audio/webm;codecs=opus","audio/ogg;codecs=opus","audio/mp4;codecs=opus","audio/mp4;codecs=wav","audio/mp4;codecs=mp3"]}getRecordingOptions(){return{audioBitsPerSecond:parseInt(this.config.audiobitrate)}}getMediaConstraints(){return{audio:!0}}getRecordingType(){return"audio"}getTimeLimit(){return this.config.audiotimelimit}getEmbedTemplateName(){return"tiny_recordrtc/embed_audio"}getFileName(prefix){return"".concat(prefix,"-audio.").concat(this.getFileExtension())}getFileExtension(){return window.MediaRecorder.isTypeSupported("audio/webm")?"webm":window.MediaRecorder.isTypeSupported("audio/ogg")?"ogg":window.MediaRecorder.isTypeSupported("audio/mp4")?"mp4":(window.console.warning("Unknown file type for MediaRecorder API"),"")}static getModalClass(){var _class;const modalType="".concat(_common.component,"/audio_recorder"),registration=_modal_registry.default.get(modalType);if(registration)return registration.module;const AudioModal=(_defineProperty(_class=class extends _modal.default{},"TYPE",modalType),_defineProperty(_class,"TEMPLATE","".concat(_common.component,"/audio_recorder")),_class);return _modal_registry.default.register(AudioModal.TYPE,AudioModal,AudioModal.TEMPLATE),AudioModal}}return _exports.default=Audio,_exports.default}));
|
||||
|
||||
//# sourceMappingURL=audio_recorder.min.js.map
|
@ -1 +1 @@
|
||||
{"version":3,"file":"audio_recorder.min.js","sources":["../src/audio_recorder.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 - audio recorder configuration.\n *\n * @module tiny_recordrtc/audio\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 BaseClass from './base_recorder';\nimport Modal from './modal';\nimport ModalRegistry from 'core/modal_registry';\nimport {component} from 'tiny_recordrtc/common';\n\nexport default class Audio extends BaseClass {\n configurePlayer() {\n return this.modalRoot.querySelector('audio');\n }\n\n getSupportedTypes() {\n return [\n 'audio/webm;codecs=opus',\n 'audio/ogg;codecs=opus',\n ];\n }\n\n getParsedRecordingOptions() {\n return {\n audioBitsPerSecond: parseInt(this.config.audiobitrate),\n };\n }\n\n getMediaConstraints() {\n return {\n audio: true,\n };\n }\n\n getRecordingType() {\n return 'audio';\n }\n\n getTimeLimit() {\n return this.config.audiotimelimit;\n }\n\n getEmbedTemplateName() {\n return 'tiny_recordrtc/embed_audio';\n }\n\n getFileName(prefix) {\n return `${prefix}-audio.ogg`;\n }\n\n static getModalClass() {\n const modalType = `${component}/audio_recorder`;\n const registration = ModalRegistry.get(modalType);\n if (registration) {\n return registration.module;\n }\n\n const AudioModal = class extends Modal {\n static TYPE = modalType;\n static TEMPLATE = `${component}/audio_recorder`;\n };\n\n ModalRegistry.register(AudioModal.TYPE, AudioModal, AudioModal.TEMPLATE);\n return AudioModal;\n }\n}\n"],"names":["Audio","BaseClass","configurePlayer","this","modalRoot","querySelector","getSupportedTypes","getParsedRecordingOptions","audioBitsPerSecond","parseInt","config","audiobitrate","getMediaConstraints","audio","getRecordingType","getTimeLimit","audiotimelimit","getEmbedTemplateName","getFileName","prefix","modalType","component","registration","ModalRegistry","get","module","AudioModal","Modal","register","TYPE","TEMPLATE"],"mappings":"+pBA4BqBA,cAAcC,uBAC/BC,yBACWC,KAAKC,UAAUC,cAAc,SAGxCC,0BACW,CACH,yBACA,yBAIRC,kCACW,CACHC,mBAAoBC,SAASN,KAAKO,OAAOC,eAIjDC,4BACW,CACHC,OAAO,GAIfC,yBACW,QAGXC,sBACWZ,KAAKO,OAAOM,eAGvBC,6BACW,6BAGXC,YAAYC,wBACEA,6DAIJC,oBAAeC,qCACfC,aAAeC,wBAAcC,IAAIJ,cACnCE,oBACOA,aAAaG,aAGlBC,mCAAa,cAAcC,wBACfP,uDACOC,6EAGXO,SAASF,WAAWG,KAAMH,WAAYA,WAAWI,UACxDJ"}
|
||||
{"version":3,"file":"audio_recorder.min.js","sources":["../src/audio_recorder.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 - audio recorder configuration.\n *\n * @module tiny_recordrtc/audio\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 BaseClass from './base_recorder';\nimport Modal from './modal';\nimport ModalRegistry from 'core/modal_registry';\nimport {component} from 'tiny_recordrtc/common';\n\nexport default class Audio extends BaseClass {\n configurePlayer() {\n return this.modalRoot.querySelector('audio');\n }\n\n getSupportedTypes() {\n return [\n // Firefox and Chrome both support webm and ogg.\n 'audio/webm;codecs=opus',\n 'audio/ogg;codecs=opus',\n\n // Safari supports mp4.\n 'audio/mp4;codecs=opus',\n 'audio/mp4;codecs=wav',\n 'audio/mp4;codecs=mp3',\n ];\n }\n\n getRecordingOptions() {\n return {\n audioBitsPerSecond: parseInt(this.config.audiobitrate),\n };\n }\n\n getMediaConstraints() {\n return {\n audio: true,\n };\n }\n\n getRecordingType() {\n return 'audio';\n }\n\n getTimeLimit() {\n return this.config.audiotimelimit;\n }\n\n getEmbedTemplateName() {\n return 'tiny_recordrtc/embed_audio';\n }\n\n getFileName(prefix) {\n return `${prefix}-audio.${this.getFileExtension()}`;\n }\n\n getFileExtension() {\n if (window.MediaRecorder.isTypeSupported('audio/webm')) {\n return 'webm';\n } else if (window.MediaRecorder.isTypeSupported('audio/ogg')) {\n return 'ogg';\n } else if (window.MediaRecorder.isTypeSupported('audio/mp4')) {\n return 'mp4';\n }\n\n window.console.warning(`Unknown file type for MediaRecorder API`);\n return '';\n }\n\n static getModalClass() {\n const modalType = `${component}/audio_recorder`;\n const registration = ModalRegistry.get(modalType);\n if (registration) {\n return registration.module;\n }\n\n const AudioModal = class extends Modal {\n static TYPE = modalType;\n static TEMPLATE = `${component}/audio_recorder`;\n };\n\n ModalRegistry.register(AudioModal.TYPE, AudioModal, AudioModal.TEMPLATE);\n return AudioModal;\n }\n}\n"],"names":["Audio","BaseClass","configurePlayer","this","modalRoot","querySelector","getSupportedTypes","getRecordingOptions","audioBitsPerSecond","parseInt","config","audiobitrate","getMediaConstraints","audio","getRecordingType","getTimeLimit","audiotimelimit","getEmbedTemplateName","getFileName","prefix","getFileExtension","window","MediaRecorder","isTypeSupported","console","warning","modalType","component","registration","ModalRegistry","get","module","AudioModal","Modal","register","TYPE","TEMPLATE"],"mappings":"+pBA4BqBA,cAAcC,uBAC/BC,yBACWC,KAAKC,UAAUC,cAAc,SAGxCC,0BACW,CAEH,yBACA,wBAGA,wBACA,uBACA,wBAIRC,4BACW,CACHC,mBAAoBC,SAASN,KAAKO,OAAOC,eAIjDC,4BACW,CACHC,OAAO,GAIfC,yBACW,QAGXC,sBACWZ,KAAKO,OAAOM,eAGvBC,6BACW,6BAGXC,YAAYC,wBACEA,yBAAgBhB,KAAKiB,oBAGnCA,0BACQC,OAAOC,cAAcC,gBAAgB,cAC9B,OACAF,OAAOC,cAAcC,gBAAgB,aACrC,MACAF,OAAOC,cAAcC,gBAAgB,aACrC,OAGXF,OAAOG,QAAQC,mDACR,4CAIDC,oBAAeC,qCACfC,aAAeC,wBAAcC,IAAIJ,cACnCE,oBACOA,aAAaG,aAGlBC,mCAAa,cAAcC,wBACfP,uDACOC,6EAGXO,SAASF,WAAWG,KAAMH,WAAYA,WAAWI,UACxDJ"}
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -1,3 +1,3 @@
|
||||
define("tiny_recordrtc/video_recorder",["exports","./base_recorder","tiny_recordrtc/modal","core/modal_registry","tiny_recordrtc/common"],(function(_exports,_base_recorder,_modal,_modal_registry,_common){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),_modal_registry=_interopRequireDefault(_modal_registry);class Video extends _base_recorder.default{configurePlayer(){return this.modalRoot.querySelector("video")}getSupportedTypes(){return["video/webm;codecs=vp9,opus","video/webm;codecs=h264,opus","video/webm;codecs=vp8,opus"]}getParsedRecordingOptions(){return{audioBitsPerSecond:parseInt(this.config.audiobitrate),videoBitsPerSecond:parseInt(this.config.videobitrate)}}getMediaConstraints(){return{audio:!0,video:{width:{ideal:640},height:{ideal:480}}}}playOnCapture(){return!0}getRecordingType(){return"video"}getTimeLimit(){return this.config.videotimelimit}getEmbedTemplateName(){return"tiny_recordrtc/embed_video"}getFileName(prefix){return"".concat(prefix,"-video.webm")}static getModalClass(){var _class;const modalType="".concat(_common.component,"/video_recorder"),registration=_modal_registry.default.get(modalType);if(registration)return registration.module;const VideoModal=(_defineProperty(_class=class extends _modal.default{},"TYPE",modalType),_defineProperty(_class,"TEMPLATE","".concat(_common.component,"/video_recorder")),_class);return _modal_registry.default.register(VideoModal.TYPE,VideoModal,VideoModal.TEMPLATE),VideoModal}}return _exports.default=Video,_exports.default}));
|
||||
define("tiny_recordrtc/video_recorder",["exports","./base_recorder","tiny_recordrtc/modal","core/modal_registry","tiny_recordrtc/common"],(function(_exports,_base_recorder,_modal,_modal_registry,_common){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),_modal_registry=_interopRequireDefault(_modal_registry);class Video 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{audioBitsPerSecond:parseInt(this.config.audiobitrate),videoBitsPerSecond:parseInt(this.config.videobitrate)}}getMediaConstraints(){return{audio:!0,video:{width:{ideal:640},height:{ideal:480}}}}playOnCapture(){return!0}getRecordingType(){return"video"}getTimeLimit(){return this.config.videotimelimit}getEmbedTemplateName(){return"tiny_recordrtc/embed_video"}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.warning("Unknown file type for MediaRecorder API"),"")}static getModalClass(){var _class;const modalType="".concat(_common.component,"/video_recorder"),registration=_modal_registry.default.get(modalType);if(registration)return registration.module;const VideoModal=(_defineProperty(_class=class extends _modal.default{},"TYPE",modalType),_defineProperty(_class,"TEMPLATE","".concat(_common.component,"/video_recorder")),_class);return _modal_registry.default.register(VideoModal.TYPE,VideoModal,VideoModal.TEMPLATE),VideoModal}}return _exports.default=Video,_exports.default}));
|
||||
|
||||
//# sourceMappingURL=video_recorder.min.js.map
|
File diff suppressed because one or more lines are too long
@ -33,12 +33,18 @@ export default class Audio extends BaseClass {
|
||||
|
||||
getSupportedTypes() {
|
||||
return [
|
||||
// Firefox and Chrome both support webm and ogg.
|
||||
'audio/webm;codecs=opus',
|
||||
'audio/ogg;codecs=opus',
|
||||
|
||||
// Safari supports mp4.
|
||||
'audio/mp4;codecs=opus',
|
||||
'audio/mp4;codecs=wav',
|
||||
'audio/mp4;codecs=mp3',
|
||||
];
|
||||
}
|
||||
|
||||
getParsedRecordingOptions() {
|
||||
getRecordingOptions() {
|
||||
return {
|
||||
audioBitsPerSecond: parseInt(this.config.audiobitrate),
|
||||
};
|
||||
@ -63,7 +69,20 @@ export default class Audio extends BaseClass {
|
||||
}
|
||||
|
||||
getFileName(prefix) {
|
||||
return `${prefix}-audio.ogg`;
|
||||
return `${prefix}-audio.${this.getFileExtension()}`;
|
||||
}
|
||||
|
||||
getFileExtension() {
|
||||
if (window.MediaRecorder.isTypeSupported('audio/webm')) {
|
||||
return 'webm';
|
||||
} else if (window.MediaRecorder.isTypeSupported('audio/ogg')) {
|
||||
return 'ogg';
|
||||
} else if (window.MediaRecorder.isTypeSupported('audio/mp4')) {
|
||||
return 'mp4';
|
||||
}
|
||||
|
||||
window.console.warning(`Unknown file type for MediaRecorder API`);
|
||||
return '';
|
||||
}
|
||||
|
||||
static getModalClass() {
|
||||
|
@ -180,13 +180,25 @@ export default class {
|
||||
* @returns {object} The options for the MediaRecorder instance.
|
||||
*/
|
||||
getParsedRecordingOptions() {
|
||||
const types = this.getSupportedTypes();
|
||||
const options = this.getParsedRecordingOptions();
|
||||
const compatTypes = types.filter((type) => window.MediaRecorder.isTypeSupported(type));
|
||||
const requestedTypes = this.getSupportedTypes();
|
||||
const possibleTypes = requestedTypes.reduce((result, type) => {
|
||||
result.push(type);
|
||||
// Safari seems to use codecs: instead of codecs=.
|
||||
// It is safe to add both, so we do, but we want them to remain in order.
|
||||
result.push(type.replace('=', ':'));
|
||||
return result;
|
||||
}, []);
|
||||
|
||||
const compatTypes = possibleTypes.filter((type) => window.MediaRecorder.isTypeSupported(type));
|
||||
|
||||
const options = this.getRecordingOptions();
|
||||
if (compatTypes.length !== 0) {
|
||||
options.mimeType = compatTypes[0];
|
||||
}
|
||||
window.console.info(
|
||||
`Selected codec ${options.mimeType} from ${compatTypes.length} options.`,
|
||||
compatTypes,
|
||||
);
|
||||
|
||||
return options;
|
||||
}
|
||||
|
@ -33,14 +33,26 @@ export default class Video extends BaseClass {
|
||||
|
||||
getSupportedTypes() {
|
||||
return [
|
||||
// Support webm as a preference.
|
||||
// This container supports both vp9, and vp8.
|
||||
// It does not support AVC1/h264 at all.
|
||||
// It is supported by Chromium, and Firefox browsers, but not Safari.
|
||||
'video/webm;codecs=vp9,opus',
|
||||
'video/webm;codecs=h264,opus',
|
||||
'video/webm;codecs=vp8,opus',
|
||||
|
||||
// Fall back to mp4 if webm is not available.
|
||||
// The mp4 container supports v9, and h264 but neither of these are supported for recording on other
|
||||
// browsers.
|
||||
// In addition to this, we can record in v9, but VideoJS does not support an mp4 containern with v9 codec
|
||||
// for playback. We leave it as a final option as a just-in-case.
|
||||
'video/mp4;codecs=h264,opus',
|
||||
'video/mp4;codecs=h264,wav',
|
||||
'video/mp4;codecs=v9,opus',
|
||||
];
|
||||
|
||||
}
|
||||
|
||||
getParsedRecordingOptions() {
|
||||
getRecordingOptions() {
|
||||
return {
|
||||
audioBitsPerSecond: parseInt(this.config.audiobitrate),
|
||||
videoBitsPerSecond: parseInt(this.config.videobitrate)
|
||||
@ -79,7 +91,18 @@ export default class Video extends BaseClass {
|
||||
}
|
||||
|
||||
getFileName(prefix) {
|
||||
return `${prefix}-video.webm`;
|
||||
return `${prefix}-video.${this.getFileExtension()}`;
|
||||
}
|
||||
|
||||
getFileExtension() {
|
||||
if (window.MediaRecorder.isTypeSupported('audio/webm')) {
|
||||
return 'webm';
|
||||
} else if (window.MediaRecorder.isTypeSupported('audio/mp4')) {
|
||||
return 'mp4';
|
||||
}
|
||||
|
||||
window.console.warning(`Unknown file type for MediaRecorder API`);
|
||||
return '';
|
||||
}
|
||||
|
||||
static getModalClass() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user