@e10in/videojs-record
Version:
A video.js plugin for recording audio/video/image files.
8 lines • 66.9 kB
JavaScript
/*!
* @e10in/videojs-record
* @version 4.4.4
* @see https://github.com/collab-project/videojs-record
* @copyright 2014-2021 Collab
* @license MIT
*/
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("recordrtc"),require("video.js")):"function"==typeof define&&define.amd?define("VideojsRecord",["recordrtc","video.js"],t):"object"==typeof exports?exports.VideojsRecord=t(require("recordrtc"),require("video.js")):e.VideojsRecord=t(e.RecordRTC,e.videojs)}(self,(function(e,t){return(()=>{var r={506:e=>{e.exports=function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}},926:e=>{function t(e,t,r,i,o,a,n){try{var s=e[a](n),u=s.value}catch(e){return void r(e)}s.done?t(u):Promise.resolve(u).then(i,o)}e.exports=function(e){return function(){var r=this,i=arguments;return new Promise((function(o,a){var n=e.apply(r,i);function s(e){t(n,o,a,s,u,"next",e)}function u(e){t(n,o,a,s,u,"throw",e)}s(void 0)}))}}},575:e=>{e.exports=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}},913:e=>{function t(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}e.exports=function(e,r,i){return r&&t(e.prototype,r),i&&t(e,i),e}},525:(e,t,r)=>{var i=r(331);function o(t,r,a){return"undefined"!=typeof Reflect&&Reflect.get?e.exports=o=Reflect.get:e.exports=o=function(e,t,r){var o=i(e,t);if(o){var a=Object.getOwnPropertyDescriptor(o,t);return a.get?a.get.call(r):a.value}},o(t,r,a||t)}e.exports=o},754:e=>{function t(r){return e.exports=t=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},t(r)}e.exports=t},205:(e,t,r)=>{var i=r(489);e.exports=function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&i(e,t)}},318:e=>{e.exports=function(e){return e&&e.__esModule?e:{default:e}}},585:(e,t,r)=>{var i=r(8),o=r(506);e.exports=function(e,t){return!t||"object"!==i(t)&&"function"!=typeof t?o(e):t}},489:e=>{function t(r,i){return e.exports=t=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},t(r,i)}e.exports=t},331:(e,t,r)=>{var i=r(754);e.exports=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=i(e)););return e}},8:e=>{function t(r){return"function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?e.exports=t=function(e){return typeof e}:e.exports=t=function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},t(r)}e.exports=t},757:(e,t,r)=>{e.exports=r(666)},21:function(e,t,r){var i;!function(t){"use strict";function o(e,t){t=t||2;var r,i=Number(e)<0,o=e.toString();return i&&(o=o.slice(1)),r=t-o.length+1,(i?"-":"")+(o=new Array(r).join("0").concat(o))}void 0===(i=function(){return o}.call(t,r,t,e))||(e.exports=i)}(this)},593:(e,t,r)=>{"use strict";var i=r(318);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var o=i(r(575)),a=i(r(913)),n=i(r(525)),s=i(r(205)),u=i(r(585)),c=i(r(754)),l=i(r(390));function d(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,i=(0,c.default)(e);if(t){var o=(0,c.default)(this).constructor;r=Reflect.construct(i,arguments,o)}else r=i.apply(this,arguments);return(0,u.default)(this,r)}}var h=l.default.getComponent("Component"),f=function(e){(0,s.default)(r,e);var t=d(r);function r(){return(0,o.default)(this,r),t.apply(this,arguments)}return(0,a.default)(r,[{key:"createEl",value:function(){var e=l.default.dom.createEl("img"),t=(0,n.default)((0,c.default)(r.prototype),"createEl",this).call(this,"div",{className:"vjs-animation-display",dir:"ltr"});return t.appendChild(e),t}}]),r}(h);h.registerComponent("AnimationDisplay",f);var p=f;t.default=p,e.exports=t.default},468:(e,t,r)=>{"use strict";var i=r(318);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var o=i(r(575)),a=i(r(913)),n=i(r(525)),s=i(r(205)),u=i(r(585)),c=i(r(754)),l=i(r(390)),d=i(r(537));function h(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,i=(0,c.default)(e);if(t){var o=(0,c.default)(this).constructor;r=Reflect.construct(i,arguments,o)}else r=i.apply(this,arguments);return(0,u.default)(this,r)}}var f=l.default.getComponent("Button"),p=l.default.getComponent("Component"),v=function(e){(0,s.default)(r,e);var t=h(r);function r(){return(0,o.default)(this,r),t.apply(this,arguments)}return(0,a.default)(r,[{key:"buildCSSClass",value:function(){return"vjs-camera-button vjs-control vjs-button vjs-icon-photo-camera"}},{key:"enable",value:function(){(0,n.default)((0,c.default)(r.prototype),"enable",this).call(this),this.on(this.player_,d.default.START_RECORD,this.onStart),this.on(this.player_,d.default.STOP_RECORD,this.onStop)}},{key:"disable",value:function(){(0,n.default)((0,c.default)(r.prototype),"disable",this).call(this),this.off(this.player_,d.default.START_RECORD,this.onStart),this.off(this.player_,d.default.STOP_RECORD,this.onStop)}},{key:"show",value:function(){this.layoutExclude&&!0===this.layoutExclude||(0,n.default)((0,c.default)(r.prototype),"show",this).call(this)}},{key:"handleClick",value:function(e){var t=this.player_.record();t.isProcessing()?(t.retrySnapshot(),this.onStop(),this.player_.trigger(d.default.RETRY)):t.start()}},{key:"onStart",value:function(e){this.removeClass("vjs-icon-photo-camera"),this.addClass("vjs-icon-replay"),this.controlText("Retry")}},{key:"onStop",value:function(e){this.removeClass("vjs-icon-replay"),this.addClass("vjs-icon-photo-camera"),this.controlText("Image")}}]),r}(f);v.prototype.controlText_="Image",p.registerComponent("CameraButton",v);var y=v;t.default=y,e.exports=t.default},853:(e,t,r)=>{"use strict";var i=r(318);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var o=i(r(575)),a=i(r(913)),n=i(r(525)),s=i(r(205)),u=i(r(585)),c=i(r(754)),l=i(r(390));function d(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,i=(0,c.default)(e);if(t){var o=(0,c.default)(this).constructor;r=Reflect.construct(i,arguments,o)}else r=i.apply(this,arguments);return(0,u.default)(this,r)}}var h=l.default.getComponent("Button"),f=l.default.getComponent("Component"),p=function(e){(0,s.default)(r,e);var t=d(r);function r(){return(0,o.default)(this,r),t.apply(this,arguments)}return(0,a.default)(r,[{key:"handleClick",value:function(e){this.player_.record().getDevice()}},{key:"show",value:function(){this.layoutExclude&&!0===this.layoutExclude||(0,n.default)((0,c.default)(r.prototype),"show",this).call(this)}}]),r}(h);p.prototype.controlText_="Device",f.registerComponent("DeviceButton",p);var v=p;t.default=v,e.exports=t.default},110:(e,t,r)=>{"use strict";var i=r(318);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var o=i(r(757)),a=i(r(926)),n=i(r(575)),s=i(r(913)),u=i(r(525)),c=i(r(205)),l=i(r(585)),d=i(r(754)),h=i(r(390)),f=i(r(537));function p(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,i=(0,d.default)(e);if(t){var o=(0,d.default)(this).constructor;r=Reflect.construct(i,arguments,o)}else r=i.apply(this,arguments);return(0,l.default)(this,r)}}var v=h.default.getComponent("Button"),y=h.default.getComponent("Component"),g=function(e){(0,c.default)(i,e);var t,r=p(i);function i(e,t){var o;return(0,n.default)(this,i),(o=r.call(this,e,t)).on(o.player_,f.default.ENTER_PIP,o.onStart),o.on(o.player_,f.default.LEAVE_PIP,o.onStop),o}return(0,s.default)(i,[{key:"buildCSSClass",value:function(){return"vjs-pip-button vjs-control vjs-button vjs-icon-picture-in-picture-start"}},{key:"show",value:function(){this.layoutExclude&&!0===this.layoutExclude||(0,u.default)((0,d.default)(i.prototype),"show",this).call(this)}},{key:"handleClick",value:(t=(0,a.default)(o.default.mark((function e(t){var r;return o.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=this.player_.record(),this.disable(),e.prev=2,r.mediaElement===document.pictureInPictureElement){e.next=8;break}return e.next=6,r.mediaElement.requestPictureInPicture();case 6:e.next=10;break;case 8:return e.next=10,document.exitPictureInPicture();case 10:e.next=15;break;case 12:e.prev=12,e.t0=e.catch(2),this.player_.trigger(f.default.ERROR,e.t0);case 15:return e.prev=15,this.enable(),e.finish(15);case 18:case"end":return e.stop()}}),e,this,[[2,12,15,18]])}))),function(e){return t.apply(this,arguments)})},{key:"onStart",value:function(e){this.removeClass("vjs-icon-picture-in-picture-start"),this.addClass("vjs-icon-picture-in-picture-stop")}},{key:"onStop",value:function(e){this.removeClass("vjs-icon-picture-in-picture-stop"),this.addClass("vjs-icon-picture-in-picture-start")}}]),i}(v);g.prototype.controlText_="Picture in Picture",y.registerComponent("PictureInPictureToggle",g);var m=g;t.default=m,e.exports=t.default},836:(e,t,r)=>{"use strict";var i=r(318);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var o=i(r(575)),a=i(r(913)),n=i(r(525)),s=i(r(205)),u=i(r(585)),c=i(r(754)),l=i(r(390));function d(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,i=(0,c.default)(e);if(t){var o=(0,c.default)(this).constructor;r=Reflect.construct(i,arguments,o)}else r=i.apply(this,arguments);return(0,u.default)(this,r)}}var h=l.default.getComponent("Component"),f=function(e){(0,s.default)(r,e);var t=d(r);function r(){return(0,o.default)(this,r),t.apply(this,arguments)}return(0,a.default)(r,[{key:"createEl",value:function(){var e=l.default.dom.createEl("canvas"),t=(0,n.default)((0,c.default)(r.prototype),"createEl",this).call(this,"div",{className:"vjs-record-canvas",dir:"ltr"});return t.appendChild(e),t}}]),r}(h);h.registerComponent("RecordCanvas",f);var p=f;t.default=p,e.exports=t.default},115:(e,t,r)=>{"use strict";var i=r(318);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var o=i(r(575)),a=i(r(913)),n=i(r(525)),s=i(r(205)),u=i(r(585)),c=i(r(754)),l=i(r(390)),d=i(r(537));function h(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,i=(0,c.default)(e);if(t){var o=(0,c.default)(this).constructor;r=Reflect.construct(i,arguments,o)}else r=i.apply(this,arguments);return(0,u.default)(this,r)}}var f=l.default.getComponent("Component"),p=function(e){(0,s.default)(r,e);var t=h(r);function r(e,i){var a;return(0,o.default)(this,r),(a=t.call(this,e,i)).enable(),a}return(0,a.default)(r,[{key:"createEl",value:function(){var e={"data-label":this.localize("REC")};return(0,n.default)((0,c.default)(r.prototype),"createEl",this).call(this,"div",{className:"vjs-record-indicator vjs-control",dir:"ltr"},e)}},{key:"enable",value:function(){this.on(this.player_,d.default.START_RECORD,this.show),this.on(this.player_,d.default.STOP_RECORD,this.hide)}},{key:"disable",value:function(){this.off(this.player_,d.default.START_RECORD,this.show),this.off(this.player_,d.default.STOP_RECORD,this.hide)}},{key:"show",value:function(){this.layoutExclude&&!0===this.layoutExclude||(0,n.default)((0,c.default)(r.prototype),"show",this).call(this)}}]),r}(f);f.registerComponent("RecordIndicator",p);var v=p;t.default=v,e.exports=t.default},241:(e,t,r)=>{"use strict";var i=r(318);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var o=i(r(575)),a=i(r(913)),n=i(r(525)),s=i(r(205)),u=i(r(585)),c=i(r(754)),l=i(r(390)),d=i(r(537));function h(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,i=(0,c.default)(e);if(t){var o=(0,c.default)(this).constructor;r=Reflect.construct(i,arguments,o)}else r=i.apply(this,arguments);return(0,u.default)(this,r)}}var f=l.default.getComponent("Button"),p=l.default.getComponent("Component"),v=function(e){(0,s.default)(r,e);var t=h(r);function r(){return(0,o.default)(this,r),t.apply(this,arguments)}return(0,a.default)(r,[{key:"buildCSSClass",value:function(){return"vjs-record-button vjs-control vjs-button vjs-icon-record-start"}},{key:"enable",value:function(){(0,n.default)((0,c.default)(r.prototype),"enable",this).call(this),this.on(this.player_,d.default.START_RECORD,this.onStart),this.on(this.player_,d.default.STOP_RECORD,this.onStop)}},{key:"disable",value:function(){(0,n.default)((0,c.default)(r.prototype),"disable",this).call(this),this.off(this.player_,d.default.START_RECORD,this.onStart),this.off(this.player_,d.default.STOP_RECORD,this.onStop)}},{key:"show",value:function(){this.layoutExclude&&!0===this.layoutExclude||(0,n.default)((0,c.default)(r.prototype),"show",this).call(this)}},{key:"handleClick",value:function(e){var t=this.player_.record();t.isRecording()?t.stop():t.start()}},{key:"onStart",value:function(e){this.removeClass("vjs-icon-record-start"),this.addClass("vjs-icon-record-stop"),this.controlText("Stop")}},{key:"onStop",value:function(e){this.removeClass("vjs-icon-record-stop"),this.addClass("vjs-icon-record-start"),this.controlText("Record")}}]),r}(f);v.prototype.controlText_="Record",p.registerComponent("RecordToggle",v);var y=v;t.default=y,e.exports=t.default},997:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r={image:!1,audio:!1,video:!1,animation:!1,screen:!1,maxLength:10,maxFileSize:0,displayMilliseconds:!1,formatTime:void 0,frameWidth:320,frameHeight:240,debug:!1,pip:!1,autoMuteDevice:!1,videoBitRate:1200,videoEngine:"recordrtc",videoFrameRate:30,videoMimeType:"video/webm",videoRecorderType:"auto",videoWorkerURL:"",videoWebAssemblyURL:"",audioEngine:"recordrtc",audioRecorderType:"auto",audioMimeType:"auto",audioBufferSize:4096,audioSampleRate:44100,audioBitRate:128,audioChannels:2,audioWorkerURL:"",audioWebAssemblyURL:"",audioBufferUpdate:!1,animationFrameRate:200,animationQuality:10,imageOutputType:"dataURL",imageOutputFormat:"image/png",imageOutputQuality:.92,timeSlice:0,convertEngine:"",convertWorkerURL:"",convertOptions:[],hotKeys:!1,pluginLibraryOptions:{}};t.default=r,e.exports=t.default},393:(e,t,r)=>{"use strict";var i=r(318);Object.defineProperty(t,"__esModule",{value:!0}),t.FFMPEGWASM=t.FFMPEGJS=t.TSEBML=t.CONVERT_PLUGINS=t.ConvertEngine=void 0;var o=i(r(575)),a=i(r(913)),n=i(r(205)),s=i(r(585)),u=i(r(754)),c=i(r(390)),l=r(885);function d(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,i=(0,u.default)(e);if(t){var o=(0,u.default)(this).constructor;r=Reflect.construct(i,arguments,o)}else r=i.apply(this,arguments);return(0,s.default)(this,r)}}var h=c.default.getComponent("Component"),f="ts-ebml";t.TSEBML=f;var p="ffmpeg.js";t.FFMPEGJS=p;var v="ffmpeg.wasm";t.FFMPEGWASM=v;var y=[f,p,v];t.CONVERT_PLUGINS=y;var g=function(e){(0,n.default)(r,e);var t=d(r);function r(e,i){return(0,o.default)(this,r),i.evented=!0,t.call(this,e,i)}return(0,a.default)(r,[{key:"setup",value:function(e,t){this.mediaType=e,this.debug=t}},{key:"loadBlob",value:function(e){return(0,l.blobToArrayBuffer)(e)}},{key:"addFileInfo",value:function(e,t){(0,l.addFileInfo)(e,t)}},{key:"saveAs",value:function(e){var t=e[Object.keys(e)[0]];(0,l.downloadBlob)(t,this.player().convertedData)}}]),r}(h);t.ConvertEngine=g,c.default.ConvertEngine=g,h.registerComponent("ConvertEngine",g)},218:(e,t,r)=>{"use strict";var i=r(318);Object.defineProperty(t,"__esModule",{value:!0}),t.getConvertEngine=t.getVideoEngine=t.isAudioPluginActive=t.getAudioEngine=void 0;var o=i(r(390)),a=i(r(253)),n=r(393),s=r(86);t.getAudioEngine=function(e){var t;switch(e){case s.RECORDRTC:t=a.default;break;case s.LIBVORBISJS:t=o.default.LibVorbisEngine;break;case s.RECORDERJS:t=o.default.RecorderjsEngine;break;case s.LAMEJS:t=o.default.LamejsEngine;break;case s.OPUSRECORDER:t=o.default.OpusRecorderEngine;break;case s.OPUSMEDIARECORDER:t=o.default.OpusMediaRecorderEngine;break;case s.VMSG:t=o.default.VmsgEngine;break;default:throw new Error("Unknown audioEngine: "+e)}return t};t.getVideoEngine=function(e){var t;switch(e){case s.RECORDRTC:t=a.default;break;case s.WEBMWASM:t=o.default.WebmWasmEngine;break;default:throw new Error("Unknown videoEngine: "+e)}return t};t.isAudioPluginActive=function(e){return s.AUDIO_PLUGINS.indexOf(e)>-1};t.getConvertEngine=function(e){var t;switch(e){case"":break;case n.TSEBML:t=o.default.TsEBMLEngine;break;case n.FFMPEGJS:t=o.default.FFmpegjsEngine;break;case n.FFMPEGWASM:t=o.default.FFmpegWasmEngine;break;default:throw new Error("Unknown convertEngine: "+e)}return t}},86:(e,t,r)=>{"use strict";var i=r(318);Object.defineProperty(t,"__esModule",{value:!0}),t.WEBMWASM=t.VMSG=t.OPUSMEDIARECORDER=t.OPUSRECORDER=t.LAMEJS=t.RECORDERJS=t.LIBVORBISJS=t.RECORDRTC=t.VIDEO_PLUGINS=t.AUDIO_PLUGINS=t.RECORD_PLUGINS=t.RecordEngine=void 0;var o=i(r(575)),a=i(r(913)),n=i(r(205)),s=i(r(585)),u=i(r(754)),c=i(r(390)),l=i(r(537)),d=r(885);function h(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,i=(0,u.default)(e);if(t){var o=(0,u.default)(this).constructor;r=Reflect.construct(i,arguments,o)}else r=i.apply(this,arguments);return(0,s.default)(this,r)}}var f=c.default.getComponent("Component");t.RECORDRTC="recordrtc";var p="libvorbis.js";t.LIBVORBISJS=p;var v="recorder.js";t.RECORDERJS=v;var y="lamejs";t.LAMEJS=y;var g="opus-recorder";t.OPUSRECORDER=g;var m="opus-media-recorder";t.OPUSMEDIARECORDER=m;var E="vmsg";t.VMSG=E;var R="webm-wasm";t.WEBMWASM=R;var O=[p,v,y,g,m,E];t.AUDIO_PLUGINS=O;var T=[R];t.VIDEO_PLUGINS=T;var b=O.concat(T);t.RECORD_PLUGINS=b;var D=function(e){(0,n.default)(r,e);var t=h(r);function r(e,i){return(0,o.default)(this,r),i.evented=!0,t.call(this,e,i)}return(0,a.default)(r,[{key:"dispose",value:function(){void 0!==this.recordedData&&URL.revokeObjectURL(this.recordedData)}},{key:"destroy",value:function(){}},{key:"addFileInfo",value:function(e){(0,d.addFileInfo)(e)}},{key:"onStopRecording",value:function(e){this.recordedData=e,this.addFileInfo(this.recordedData),this.dispose(),this.trigger(l.default.RECORD_COMPLETE)}},{key:"saveAs",value:function(e){var t=e[Object.keys(e)[0]];(0,d.downloadBlob)(t,this.recordedData)}}]),r}(f);t.RecordEngine=D,c.default.RecordEngine=D,f.registerComponent("RecordEngine",D)},713:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AUDIO_SCREEN=t.SCREEN_ONLY=t.ANIMATION=t.AUDIO_VIDEO=t.VIDEO_ONLY=t.AUDIO_ONLY=t.IMAGE_ONLY=t.getRecorderMode=void 0;var r="image_only";t.IMAGE_ONLY=r;var i="audio_only";t.AUDIO_ONLY=i;var o="video_only";t.VIDEO_ONLY=o;var a="audio_video";t.AUDIO_VIDEO=a;var n="audio_screen";t.AUDIO_SCREEN=n;var s="animation";t.ANIMATION=s;var u="screen_only";t.SCREEN_ONLY=u;t.getRecorderMode=function(e,t,l,d,h){return c(e)?r:c(d)?s:c(t)&&c(l)?a:c(t)&&c(h)?n:!c(t)&&c(h)?u:c(t)&&!c(l)?i:!c(t)&&c(l)?o:void 0};var c=function(e){return e===Object(e)||!0===e}},253:(e,t,r)=>{"use strict";var i=r(318);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var o=i(r(575)),a=i(r(913)),n=i(r(525)),s=i(r(205)),u=i(r(585)),c=i(r(754)),l=i(r(390)),d=i(r(5)),h=i(r(537)),f=r(86),p=(r(596),r(713));function v(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,i=(0,c.default)(e);if(t){var o=(0,c.default)(this).constructor;r=Reflect.construct(i,arguments,o)}else r=i.apply(this,arguments);return(0,u.default)(this,r)}}var y=l.default.getComponent("Component"),g=function(e){(0,s.default)(r,e);var t=v(r);function r(){return(0,o.default)(this,r),t.apply(this,arguments)}return(0,a.default)(r,[{key:"setup",value:function(e,t,r){this.inputStream=e,this.mediaType=t,this.debug=r,"screen"in this.mediaType&&(this.mediaType.video=!0),void 0!==this.recorderType&&(this.mediaType.video=this.recorderType),this.engine=new d.default.MRecordRTC,this.engine.mediaType=this.mediaType,this.engine.disableLogs=!this.debug,this.engine.mimeType=this.mimeType,this.engine.bufferSize=this.bufferSize,this.engine.sampleRate=this.sampleRate,this.engine.numberOfAudioChannels=this.audioChannels,this.engine.video=this.video,this.engine.canvas=this.canvas,this.engine.bitrate=this.bitRate,this.engine.quality=this.quality,this.engine.frameRate=this.frameRate,void 0!==this.timeSlice&&(this.engine.timeSlice=this.timeSlice,this.engine.onTimeStamp=this.onTimeStamp.bind(this)),this.engine.workerPath=this.workerPath,this.engine.webAssemblyPath=this.videoWebAssemblyURL,this.engine.addStream(this.inputStream)}},{key:"dispose",value:function(){(0,n.default)((0,c.default)(r.prototype),"dispose",this).call(this),this.destroy()}},{key:"destroy",value:function(){this.engine&&"function"==typeof this.engine.destroy&&this.engine.destroy()}},{key:"start",value:function(){this.engine.startRecording()}},{key:"stop",value:function(){this.engine.stopRecording(this.onStopRecording.bind(this))}},{key:"pause",value:function(){this.engine.pauseRecording()}},{key:"resume",value:function(){this.engine.resumeRecording()}},{key:"saveAs",value:function(e){this.engine&&void 0!==e&&this.engine.save(e)}},{key:"onStopRecording",value:function(e,t){var r=this;URL.revokeObjectURL(e);var i=this.player().record().getRecordType(),o=this.player().record().pluginLibraryOptions,a=this;this.engine.getBlob((function(e){switch(i){case p.AUDIO_ONLY:void 0!==e.audio&&(r.recordedData=e.audio);break;case p.VIDEO_ONLY:case p.AUDIO_VIDEO:case p.AUDIO_SCREEN:case p.SCREEN_ONLY:void 0!==e.video&&(r.recordedData=e.video);break;case p.ANIMATION:void 0!==e.gif&&(r.recordedData=e.gif)}r.addFileInfo(r.recordedData),o&&o.seekable&&window.getSeekableBlob?getSeekableBlob(r.recordedData,(function(e){a.recordedData=e,a.trigger(h.default.RECORD_COMPLETE)})):r.trigger(h.default.RECORD_COMPLETE)}))}},{key:"onTimeStamp",value:function(e,t){var r;switch(this.player().currentTimestamp=e,this.player().allTimestamps=t,this.player().record().getRecordType()){case p.AUDIO_ONLY:r=this.engine.audioRecorder;break;case p.ANIMATION:r=this.engine.gifRecorder;break;default:r=this.engine.videoRecorder}var i=!1;(r&&(r=r.getInternalRecorder()),r instanceof d.default.MediaStreamRecorder==!0)&&(this.player().recordedData=r.getArrayOfBlobs(),this.addFileInfo(this.player().recordedData[this.player_.recordedData.length-1]),this.maxFileSize>0&&new Blob(this.player().recordedData).size>=this.maxFileSize&&(i=!0));this.player().trigger(h.default.TIMESTAMP),i&&this.player().record().stop()}}]),r}(f.RecordEngine);l.default.RecordRTCEngine=g,y.registerComponent("RecordRTCEngine",g);var m=g;t.default=m,e.exports=t.default},537:(e,t,r)=>{"use strict";var i=r(318);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var o=i(r(575)),a=function e(){(0,o.default)(this,e)};a.READY="ready",a.ERROR="error",a.PLAYING="playing",a.LOADEDMETADATA="loadedmetadata",a.LOADSTART="loadstart",a.USERINACTIVE="userinactive",a.TIMEUPDATE="timeupdate",a.DURATIONCHANGE="durationchange",a.ENDED="ended",a.PAUSE="pause",a.PLAY="play",a.DEVICE_READY="deviceReady",a.DEVICE_ERROR="deviceError",a.START_RECORD="startRecord",a.STOP_RECORD="stopRecord",a.FINISH_RECORD="finishRecord",a.RECORD_COMPLETE="recordComplete",a.PROGRESS_RECORD="progressRecord",a.TIMESTAMP="timestamp",a.ENUMERATE_READY="enumerateReady",a.ENUMERATE_ERROR="enumerateError",a.AUDIO_BUFFER_UPDATE="audioBufferUpdate",a.AUDIO_OUTPUT_READY="audioOutputReady",a.START_CONVERT="startConvert",a.FINISH_CONVERT="finishConvert",a.ENTER_PIP="enterPIP",a.LEAVE_PIP="leavePIP",a.RETRY="retry",a.ENTERPICTUREINPICTURE="enterpictureinpicture",a.LEAVEPICTUREINPICTURE="leavepictureinpicture",Object.freeze(a);var n=a;t.default=n,e.exports=t.default},250:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var i=r(713),o=function(e){switch(e.which){case 88:switch(this.player_.record().getRecordType()){case i.IMAGE_ONLY:this.player_.cameraButton.trigger("click");break;default:this.player_.recordToggle.trigger("click")}break;case 80:!0===this.player_.record().pictureInPicture&&this.player_.pipToggle.trigger("click");break;case 67:this.player_.controlBar.playToggle&&this.player_.controlBar.playToggle.contentEl()&&player.controlBar.playToggle.trigger("click")}};t.default=o,e.exports=t.default},161:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=function(e,t){"srcObject"in t?t.srcObject=e:"mozSrcObject"in t?t.mozSrcObject=e:t.srcObject=e};t.default=r,e.exports=t.default},706:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=function(e,t){if("string"!=typeof e)return!1;if("string"!=typeof t)return!1;e=e.split("."),t=t.split(".");for(var r=Math.min(e.length,t.length),i=0;i<r;++i){if(e[i]=parseInt(e[i],10),t[i]=parseInt(t[i],10),e[i]>t[i])return 1;if(e[i]<t[i])return-1}return e.length===t.length?0:e.length<t.length?-1:1};t.default=r,e.exports=t.default},596:(e,t,r)=>{"use strict";var i=r(318);Object.defineProperty(t,"__esModule",{value:!0}),t.isFirefox=t.isSafari=t.isChrome=t.isOpera=t.isEdge=t.detectBrowser=void 0;var o=i(r(908)),a=function(){var e={browser:null,version:null,minVersion:null};if(void 0===o.default||!o.default.navigator)return e.browser="Not a supported browser.",e;if(navigator.mozGetUserMedia)e.browser="firefox",e.version=n(navigator.userAgent,/Firefox\/(\d+)\./,1),e.minVersion=31;else if(navigator.webkitGetUserMedia)e.browser="chrome",e.version=n(navigator.userAgent,/Chrom(e|ium)\/(\d+)\./,2),e.minVersion=38;else if(navigator.mediaDevices&&navigator.userAgent.match(/Edge\/(\d+).(\d+)$/))e.browser="edge",e.version=n(navigator.userAgent,/Edge\/(\d+).(\d+)$/,2),e.minVersion=10547;else{if(!o.default.RTCPeerConnection||!navigator.userAgent.match(/AppleWebKit\/(\d+)\./))return e.browser="Not a supported browser.",e;e.browser="safari",e.version=n(navigator.userAgent,/AppleWebKit\/(\d+)\./,1)}return e};t.detectBrowser=a;var n=function(e,t,r){var i=e.match(t);return i&&i.length>=r&&parseInt(i[r],10)};t.isEdge=function(){return"edge"===a().browser};t.isSafari=function(){return"safari"===a().browser};t.isOpera=function(){return!!o.default.opera||-1!==navigator.userAgent.indexOf("OPR/")};t.isChrome=function(){return"chrome"===a().browser};t.isFirefox=function(){return"firefox"===a().browser}},885:(e,t,r)=>{"use strict";var i=r(318);Object.defineProperty(t,"__esModule",{value:!0}),t.addFileInfo=t.blobToArrayBuffer=t.downloadBlob=void 0;var o=i(r(238));t.downloadBlob=function(e,t){if(void 0!==navigator.msSaveOrOpenBlob)return navigator.msSaveOrOpenBlob(t,e);if(void 0!==navigator.msSaveBlob)return navigator.msSaveBlob(t,e);var r=document.createElement("a");r.href=URL.createObjectURL(t),r.download=e,r.style="display:none;opacity:0;color:transparent;",(document.body||document.documentElement).appendChild(r),"function"==typeof r.click?r.click():(r.target="_blank",r.dispatchEvent(new MouseEvent("click",{view:window,bubbles:!0,cancelable:!0}))),URL.revokeObjectURL(r.href)};t.blobToArrayBuffer=function(e){return new Promise((function(t,r){var i=new FileReader;i.onloadend=function(){t(i.result)},i.onerror=function(e){r(e.error)},i.readAsArrayBuffer(e)}))};t.addFileInfo=function(e,t,r){if(e instanceof Blob||e instanceof File){void 0===t&&(t=new Date);try{e.lastModified=t.getTime(),e.lastModifiedDate=t}catch(e){if(!(e instanceof TypeError))throw e}void 0===r&&(r="."+(0,o.default)(e.type));try{e.name=t.getTime()+r}catch(e){if(!(e instanceof TypeError))throw e}}}},518:(e,t,r)=>{"use strict";var i=r(318);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var o=i(r(455)),a=i(r(21)),n=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];e=e<0?0:e,(isNaN(e)||e===1/0)&&(e=0);var i=(0,o.default)(1e3*e),n=i;void 0!==t&&(n=(0,o.default)(1e3*t));var s=(0,a.default)(i.hours),u=(0,a.default)(i.minutes),c=(0,a.default)(i.seconds),l=(0,a.default)(i.milliseconds,3);if(i.days>0||n.days>0){var d=(0,a.default)(i.days);return"".concat(d,":").concat(s,":").concat(u,":").concat(c)}return i.hours>0||n.hours>0?"".concat(s,":").concat(u,":").concat(c):r?"".concat(u,":").concat(c,":").concat(l):"".concat(u,":").concat(c)};t.default=n,e.exports=t.default},238:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=/^\s*([^;\s]*)(?:;|\s|$)/,i={"video/ogg":"ogv","video/mp4":"mp4","video/x-matroska":"mkv","video/webm":"webm","audio/mp4":"m4a","audio/mpeg":"mp3","audio/aac":"aac","audio/flac":"flac","audio/ogg":"oga","audio/wav":"wav","audio/webm":"webm","application/x-mpegURL":"m3u8","image/jpeg":"jpg","image/gif":"gif","image/png":"png","image/svg+xml":"svg","image/webp":"webp"},o=function(e){var t=r.exec(e),o=t&&t[1].toLowerCase();return i[o]};t.default=o,e.exports=t.default},908:(e,t,r)=>{var i;i="undefined"!=typeof window?window:void 0!==r.g?r.g:"undefined"!=typeof self?self:{},e.exports=i},455:(e,t,r)=>{"use strict";function i(e){if("number"!=typeof e)throw new TypeError("Expected a number");const t=e>0?Math.floor:Math.ceil;return{days:t(e/864e5),hours:t(e/36e5)%24,minutes:t(e/6e4)%60,seconds:t(e/1e3)%60,milliseconds:t(e)%1e3,microseconds:t(1e3*e)%1e3,nanoseconds:t(1e6*e)%1e3}}r.r(t),r.d(t,{default:()=>i})},666:e=>{var t=function(e){"use strict";var t,r=Object.prototype,i=r.hasOwnProperty,o="function"==typeof Symbol?Symbol:{},a=o.iterator||"@@iterator",n=o.asyncIterator||"@@asyncIterator",s=o.toStringTag||"@@toStringTag";function u(e,t,r,i){var o=t&&t.prototype instanceof v?t:v,a=Object.create(o.prototype),n=new A(i||[]);return a._invoke=function(e,t,r){var i=l;return function(o,a){if(i===h)throw new Error("Generator is already running");if(i===f){if("throw"===o)throw a;return k()}for(r.method=o,r.arg=a;;){var n=r.delegate;if(n){var s=D(n,r);if(s){if(s===p)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(i===l)throw i=f,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);i=h;var u=c(e,t,r);if("normal"===u.type){if(i=r.done?f:d,u.arg===p)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(i=f,r.method="throw",r.arg=u.arg)}}}(e,r,n),a}function c(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}e.wrap=u;var l="suspendedStart",d="suspendedYield",h="executing",f="completed",p={};function v(){}function y(){}function g(){}var m={};m[a]=function(){return this};var E=Object.getPrototypeOf,R=E&&E(E(I([])));R&&R!==r&&i.call(R,a)&&(m=R);var O=g.prototype=v.prototype=Object.create(m);function T(e){["next","throw","return"].forEach((function(t){e[t]=function(e){return this._invoke(t,e)}}))}function b(e,t){function r(o,a,n,s){var u=c(e[o],e,a);if("throw"!==u.type){var l=u.arg,d=l.value;return d&&"object"==typeof d&&i.call(d,"__await")?t.resolve(d.__await).then((function(e){r("next",e,n,s)}),(function(e){r("throw",e,n,s)})):t.resolve(d).then((function(e){l.value=e,n(l)}),(function(e){return r("throw",e,n,s)}))}s(u.arg)}var o;this._invoke=function(e,i){function a(){return new t((function(t,o){r(e,i,t,o)}))}return o=o?o.then(a,a):a()}}function D(e,r){var i=e.iterator[r.method];if(i===t){if(r.delegate=null,"throw"===r.method){if(e.iterator.return&&(r.method="return",r.arg=t,D(e,r),"throw"===r.method))return p;r.method="throw",r.arg=new TypeError("The iterator does not provide a 'throw' method")}return p}var o=c(i,e.iterator,r.arg);if("throw"===o.type)return r.method="throw",r.arg=o.arg,r.delegate=null,p;var a=o.arg;return a?a.done?(r[e.resultName]=a.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,p):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,p)}function _(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function C(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function A(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(_,this),this.reset(!0)}function I(e){if(e){var r=e[a];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,n=function r(){for(;++o<e.length;)if(i.call(e,o))return r.value=e[o],r.done=!1,r;return r.value=t,r.done=!0,r};return n.next=n}}return{next:k}}function k(){return{value:t,done:!0}}return y.prototype=O.constructor=g,g.constructor=y,g[s]=y.displayName="GeneratorFunction",e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===y||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,g):(e.__proto__=g,s in e||(e[s]="GeneratorFunction")),e.prototype=Object.create(O),e},e.awrap=function(e){return{__await:e}},T(b.prototype),b.prototype[n]=function(){return this},e.AsyncIterator=b,e.async=function(t,r,i,o,a){void 0===a&&(a=Promise);var n=new b(u(t,r,i,o),a);return e.isGeneratorFunction(r)?n:n.next().then((function(e){return e.done?e.value:n.next()}))},T(O),O[s]="Generator",O[a]=function(){return this},O.toString=function(){return"[object Generator]"},e.keys=function(e){var t=[];for(var r in e)t.push(r);return t.reverse(),function r(){for(;t.length;){var i=t.pop();if(i in e)return r.value=i,r.done=!1,r}return r.done=!0,r}},e.values=I,A.prototype={constructor:A,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(C),!e)for(var r in this)"t"===r.charAt(0)&&i.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function o(i,o){return s.type="throw",s.arg=e,r.next=i,o&&(r.method="next",r.arg=t),!!o}for(var a=this.tryEntries.length-1;a>=0;--a){var n=this.tryEntries[a],s=n.completion;if("root"===n.tryLoc)return o("end");if(n.tryLoc<=this.prev){var u=i.call(n,"catchLoc"),c=i.call(n,"finallyLoc");if(u&&c){if(this.prev<n.catchLoc)return o(n.catchLoc,!0);if(this.prev<n.finallyLoc)return o(n.finallyLoc)}else if(u){if(this.prev<n.catchLoc)return o(n.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<n.finallyLoc)return o(n.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&i.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var a=o;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var n=a?a.completion:{};return n.type=e,n.arg=t,a?(this.method="next",this.next=a.finallyLoc,p):this.complete(n)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),p},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),C(r),p}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var i=r.completion;if("throw"===i.type){var o=i.arg;C(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,r,i){return this.delegate={iterator:I(e),resultName:r,nextLoc:i},"next"===this.method&&(this.arg=t),p}},e}(e.exports);try{regeneratorRuntime=t}catch(e){Function("r","regeneratorRuntime = r")(t)}},5:t=>{"use strict";t.exports=e},390:e=>{"use strict";e.exports=t}},i={};function o(e){var t=i[e];if(void 0!==t)return t.exports;var a=i[e]={exports:{}};return r[e].call(a.exports,a,a.exports,o),a.exports}o.d=(e,t)=>{for(var r in t)o.o(t,r)&&!o.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},o.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),o.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var a={};return(()=>{"use strict";var e=a,t=o(318);Object.defineProperty(e,"__esModule",{value:!0}),e.Record=void 0;var r=t(o(8)),i=t(o(575)),n=t(o(913)),s=t(o(506)),u=t(o(525)),c=t(o(205)),l=t(o(585)),d=t(o(754)),h=t(o(390)),f=t(o(593)),p=t(o(836)),v=t(o(853)),y=t(o(468)),g=t(o(241)),m=t(o(115)),E=t(o(110)),R=t(o(537)),O=t(o(250)),T=t(o(997)),b=t(o(518)),D=t(o(161)),_=t(o(706)),C=o(596),A=o(218),I=o(713);function k(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,i=(0,d.default)(e);if(t){var o=(0,d.default)(this).constructor;r=Reflect.construct(i,arguments,o)}else r=i.apply(this,arguments);return(0,l.default)(this,r)}}var S=h.default.getPlugin("plugin"),w=h.default.getComponent("Player"),L="auto",P=function(e){(0,c.default)(o,e);var t=k(o);function o(e,r){var a;(0,i.default)(this,o),a=t.call(this,e,r),w.prototype.play=function(){var e=this.techGet_("play");return void 0!==e&&"function"==typeof e.then&&e.then(null,(function(e){})),e},e.addClass("vjs-record"),a.loadOptions(),a.resetState(),r.formatTime&&"function"==typeof r.formatTime?a.setFormatTime(r.formatTime):a.setFormatTime((function(e,t){return(0,b.default)(e,t,a.displayMilliseconds)}));var n="av-perm";switch(a.getRecordType()){case I.IMAGE_ONLY:case I.VIDEO_ONLY:case I.ANIMATION:n="video-perm";break;case I.AUDIO_ONLY:n="audio-perm";break;case I.SCREEN_ONLY:n="screen-perm";break;case I.AUDIO_SCREEN:n="sv-perm"}v.default.prototype.buildCSSClass=function(){return"vjs-record vjs-device-button vjs-control vjs-icon-"+n},e.deviceButton=new v.default(e,r),e.addChild(e.deviceButton),e.recordIndicator=new m.default(e,r),e.recordIndicator.hide(),e.addChild(e.recordIndicator),e.recordCanvas=new p.default(e,r),e.recordCanvas.hide(),e.addChild(e.recordCanvas),e.animationDisplay=new f.default(e,r),e.animationDisplay.hide(),e.addChild(e.animationDisplay),e.cameraButton=new y.default(e,r),e.cameraButton.hide(),e.recordToggle=new g.default(e,r),e.recordToggle.hide();var u=void 0===h.default.VERSION||-1===(0,_.default)(h.default.VERSION,"7.6.0");if("pictureInPictureEnabled"in document||(a.pictureInPicture=!1),!0===a.pictureInPicture&&(u&&(e.pipToggle=new E.default(e,r),e.pipToggle.hide()),a.onEnterPiPHandler=a.onEnterPiP.bind((0,s.default)(a)),a.onLeavePiPHandler=a.onLeavePiP.bind((0,s.default)(a))),a.player.options_.controlBar){var c=["deviceButton","recordIndicator","cameraButton","recordToggle"];e.pipToggle&&c.push("pipToggle"),c.forEach((function(e){void 0!==a.player.options_.controlBar[e]&&(a.player[e].layoutExclude=!0,a.player[e].hide())}))}return a.player.one(R.default.READY,a.setupUI.bind((0,s.default)(a))),a}return(0,n.default)(o,[{key:"loadOptions",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=h.default.mergeOptions(T.default,this.player.options_.plugins.record,e);this.recordImage=t.image,this.recordAudio=t.audio,this.recordVideo=t.video,this.recordAnimation=t.animation,this.recordScreen=t.screen,this.maxLength=t.maxLength,this.maxFileSize=t.maxFileSize,this.displayMilliseconds=t.displayMilliseconds,this.debug=t.debug,this.pictureInPicture=t.pip,this.recordTimeSlice=t.timeSlice,this.autoMuteDevice=t.autoMuteDevice,this.pluginLibraryOptions=t.pluginLibraryOptions,this.videoFrameWidth=t.frameWidth,this.videoFrameHeight=t.frameHeight,this.videoFrameRate=t.videoFrameRate,this.videoBitRate=t.videoBitRate,this.videoEngine=t.videoEngine,this.videoRecorderType=t.videoRecorderType,this.videoMimeType=t.videoMimeType,this.videoWorkerURL=t.videoWorkerURL,this.videoWebAssemblyURL=t.videoWebAssemblyURL,this.convertEngine=t.convertEngine,this.convertWorkerURL=t.convertWorkerURL,this.convertOptions=t.convertOptions,this.audioEngine=t.audioEngine,this.audioRecorderType=t.audioRecorderType,this.audioWorkerURL=t.audioWorkerURL,this.audioWebAssemblyURL=t.audioWebAssemblyURL,this.audioBufferSize=t.audioBufferSize,this.audioSampleRate=t.audioSampleRate,this.audioBitRate=t.audioBitRate,this.audioChannels=t.audioChannels,this.audioMimeType=t.audioMimeType,this.audioBufferUpdate=t.audioBufferUpdate,this.imageOutputType=t.imageOutputType,this.imageOutputFormat=t.imageOutputFormat,this.imageOutputQuality=t.imageOutputQuality,this.animationFrameRate=t.animationFrameRate,this.animationQuality=t.animationQuality}},{key:"setupUI",value:function(){var e=this;switch(this.player.controlBar.addChild(this.player.cameraButton),this.player.controlBar.el().insertBefore(this.player.cameraButton.el(),this.player.controlBar.el().firstChild),this.player.controlBar.el().insertBefore(this.player.recordToggle.el(),this.player.controlBar.el().firstChild),!0===this.pictureInPicture?void 0===this.player.controlBar.pictureInPictureToggle&&void 0!==this.player.pipToggle?this.player.controlBar.addChild(this.player.pipToggle):void 0!==this.player.controlBar.pictureInPictureToggle&&(this.player.pipToggle=this.player.controlBar.pictureInPictureToggle,this.player.pipToggle.hide()):!1===this.pictureInPicture&&void 0!==this.player.controlBar.pictureInPictureToggle&&this.player.controlBar.pictureInPictureToggle.hide(),void 0!==this.player.controlBar.remainingTimeDisplay&&(this.player.controlBar.remainingTimeDisplay.el().style.display="none"),void 0!==this.player.controlBar.liveDisplay&&(this.player.controlBar.liveDisplay.el().style.display="none"),this.player.loop(!1),this.getRecordType()){case I.AUDIO_ONLY:this.surfer=this.player.wavesurfer(),this.surfer.setFormatTime(this._formatTime);break;case I.IMAGE_ONLY:case I.VIDEO_ONLY:case I.AUDIO_VIDEO:case I.ANIMATION:case I.SCREEN_ONLY:case I.AUDIO_SCREEN:void 0!==this.player.bigPlayButton&&this.player.bigPlayButton.hide(),this.player.one(R.default.LOADEDMETADATA,(function(){e.setDuration(e.maxLength)})),this.player.one(R.default.LOADSTART,(function(){e.setDuration(e.maxLength)})),!0===this.player.usingNativeControls_&&void 0!==this.player.tech_.el_&&(this.player.tech_.el_.controls=!1),this.player.removeTechControlsListeners_(),this.player.options_.controls&&(void 0!==this.player.controlBar.progressControl&&this.player.controlBar.progressControl.hide(),this.player.on(R.default.USERINACTIVE,(function(t){e.player.userActive(!0)})),this.player.controlBar.show(),this.player.controlBar.el().style.display="flex")}if(this.player.off(R.default.TIMEUPDATE),this.player.off(R.default.DURATIONCHANGE),this.player.off(R.default.LOADEDMETADATA),this.player.off(R.default.LOADSTART),this.player.off(R.default.ENDED),this.setDuration(this.maxLength),this.player.options_.plugins.record&&this.player.options_.plugins.record.hotKeys&&!1!==this.player.options_.plugins.record.hotKeys){var t=this.player.options_.plugins.record.hotKeys;!0===t&&(t=O.default),this.player.options_.userActions={hotkeys:t}}void 0!==this.player.controlBar.playToggle&&this.player.controlBar.playToggle.hide()}},{key:"isRecording",value:function(){return this._recording}},{key:"isProcessing",value:function(){return this._processing}},{key:"isDestroyed",value:function(){var e=null===this.player;return!1===e&&(e=null===this.player.children()),e}},{key:"getDevice",value:function(){var e=this;if(void 0===this.deviceReadyCallback&&(this.deviceReadyCallback=this.onDeviceReady.bind(this)),void 0===this.deviceErrorCallback&&(this.deviceErrorCallback=this.onDeviceError.bind(this)),void 0===this.engineStopCallback&&(this.engineStopCallback=this.onRecordComplete.bind(this)),void 0===this.streamVisibleCallback&&(this.streamVisibleCallback=this.onStreamVisible.bind(this)),this.getRecordType()===I.SCREEN_ONLY||this.getRecordType()===I.AUDIO_SCREEN){if(void 0===navigator.mediaDevices||void 0===navigator.mediaDevices.getDisplayMedia)return void this.player.trigger(R.default.ERROR,"This browser does not support navigator.mediaDevices.getDisplayMedia")}else if(void 0===navigator.mediaDevices||void 0===navigator.mediaDevices.getUserMedia)return void this.player.trigger(R.default.ERROR,"This browser does not support navigator.mediaDevices.getUserMedia");switch(this.getRecordType()){case I.AUDIO_ONLY:this.mediaType={audio:this.audioRecorderType===L||this.audioRecorderType,video:!1},this.surfer.surfer.microphone.un(R.default.DEVICE_READY,this.deviceReadyCallback),this.surfer.surfer.microphone.un(R.default.DEVICE_ERROR,this.deviceErrorCallback),this.surfer.surfer.microphone.on(R.default.DEVICE_READY,this.deviceReadyCallback),this.surfer.surfer.microphone.on(R.default.DEVICE_ERROR,this.deviceErrorCallback),this.surfer.setupPlaybackEvents(!1),this.surfer.liveMode=!0,this.surfer.surfer.microphone.paused=!1,"suspended"===this.surfer.surfer.backend.ac.state&&this.surfer.surfer.backend.ac.resume(),!0===this.audioBufferUpdate&&(this.surfer.surfer.microphone.reloadBufferFunction=function(t){e.surfer.surfer.microphone.paused||(e.surfer.surfer.empty(),e.surfer.surfer.loadDecodedBuffer(t.inputBuffer),e.player.recordedData=t.inputBuffer,e.player.trigger(R.default.AUDIO_BUFFER_UPDATE))}),this.surfer.surfer.microphone.start();break;case I.IMAGE_ONLY:case I.VIDEO_ONLY:this.getRecordType()===I.IMAGE_ONLY&&this.player.el().firstChild.addEventListener(R.default.PLAYING,this.streamVisibleCallback),this.mediaType={audio:!1,video:this.videoRecorderType===L||this.videoRecorderType},navigator.mediaDevices.getUserMedia({audio:!1,video:this.getRecordType()===I.IMAGE_ONLY?this.recordImage:this.recordVideo}).then(this.onDeviceReady.bind(this)).catch(this.onDeviceError.bind(this));break;case I.AUDIO_SCREEN:this.mediaType={audio:this.audioRecorderType===L||this.audioRecorderType,video:this.videoRecorderType===L||this.videoRecorderType};var t={};!0===this.recordScreen?t={video:!0}:"object"===(0,r.default)(this.recordScreen)&&this.recordScreen.constructor===Object&&(t=this.recordScreen),navigator.mediaDevices.getDisplayMedia(t).then((function(t){navigator.mediaDevices.getUserMedia({audio:e.recordAudio}).then((function(r){t.addTrack(r.getTracks()[0]),e.onDeviceReady.bind(e)(t)})).catch(e.onDeviceError.bind(e))})).catch(this.onDeviceError.bind(this));break;case I.AUDIO_VIDEO:this.mediaType={audio:this.audioRecorderType===L||this.audioRecorderType,video:this.videoRecorderType===L||this.videoRecorderType},navigator.mediaDevices.getUserMedia({audio:this.recordAudio,video:this.recordVideo}).then(this.onDeviceReady.bind(this)).catch(this.onDeviceError.bind(this));break;case I.ANIMATION:this.mediaType={audio:!1,video:!1,gif:!0},navigator.mediaDevices.getUserMedia({audio:!1,video:this.recordAnimation}).then(this.onDeviceReady.bind(this)).catch(this.onDeviceError.bind(this));break;case I.SCREEN_ONLY:this.mediaType={audio:!1,video:!1,screen:!0,gif:!1};var i={};!0===this.recordScreen?i={video:!0}:"object"===(0,r.default)(this.recordScreen)&&this.recordScreen.constructor===Object&&(i=this.recordScreen),navigator.mediaDevices.getDisplayMedia(i).then(this.onDeviceReady.bind(this)).catch(this.onDeviceError.bind(this))}}},{key:"onDeviceReady",value:function(e){var t=this;if(this._deviceActive=!0,void 0!==this.stream&&this.stream.active&&this.stream.stop(),this.stream=e,this.player.deviceButton.hide(),this.setDuration(this.maxLength),this.setCurrentTime(0),void 0!==this.player.controlBar.playToggle&&this.player.controlBar.playToggle.hide(),this.off(this.player,R.default.TIMEUPDATE,this.playbackTimeUpdate),this.off(this.player,R.default.ENDED,this.playbackTimeUpdate),this.getRecordType()!==I.IMAGE_ONLY){if(this.getRecordType()!==I.AUDIO_ONLY&&(0,A.isAudioPluginActive)(this.audioEngine))throw new Error("Currently "+this.audioEngine+" is only supported in audio-only mode.");var r,i;switch(this.getRecordType()){case I.AUDIO_ONLY:r=(0,A.getAudioEngine)(this.audioEngine),i=this.audioEngine;break;default:r=(0,A.getVideoEngine)(this.videoEngine),i=this.videoEngine}try{this.engine=new r(this.player,this.player.options_)}catch(e){