8 lines
65 KiB
JavaScript
8 lines
65 KiB
JavaScript
/*!
|
|
* videojs-record
|
|
* @version 4.7.0
|
|
* @see https://github.com/collab-project/videojs-record
|
|
* @copyright 2014-2024 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,((e,t)=>(()=>{var r={96: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)},607:(e,t,r)=>{"use strict";var i=r(411);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var o=i(r(64)),a=i(r(24)),n=i(r(284)),s=i(r(312)),u=i(r(532)),l=i(r(836)),c=i(r(520));function d(e,t,r){return t=(0,u.default)(t),(0,n.default)(e,h()?Reflect.construct(t,r||[],(0,u.default)(e).constructor):t.apply(e,r))}function h(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(h=function(){return!!e})()}var p=c.default.getComponent("Component"),f=function(e){function t(){return(0,o.default)(this,t),d(this,t,arguments)}return(0,l.default)(t,e),(0,a.default)(t,[{key:"createEl",value:function(){var e=c.default.dom.createEl("img"),r=(0,s.default)((0,u.default)(t.prototype),"createEl",this).call(this,"div",{className:"vjs-animation-display",dir:"ltr"});return r.appendChild(e),r}}]),t}(p);p.registerComponent("AnimationDisplay",f);t.default=f;e.exports=t.default},336:(e,t,r)=>{"use strict";var i=r(411);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var o=i(r(64)),a=i(r(24)),n=i(r(284)),s=i(r(312)),u=i(r(532)),l=i(r(836)),c=i(r(520)),d=i(r(456));function h(e,t,r){return t=(0,u.default)(t),(0,n.default)(e,p()?Reflect.construct(t,r||[],(0,u.default)(e).constructor):t.apply(e,r))}function p(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(p=function(){return!!e})()}var f=c.default.getComponent("Button"),v=c.default.getComponent("Component"),y=function(e){function t(){return(0,o.default)(this,t),h(this,t,arguments)}return(0,l.default)(t,e),(0,a.default)(t,[{key:"buildCSSClass",value:function(){return"vjs-camera-button vjs-control vjs-button vjs-icon-photo-camera"}},{key:"enable",value:function(){(0,s.default)((0,u.default)(t.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,s.default)((0,u.default)(t.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,s.default)((0,u.default)(t.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")}}]),t}(f);y.prototype.controlText_="Image",v.registerComponent("CameraButton",y);t.default=y;e.exports=t.default},124:(e,t,r)=>{"use strict";var i=r(411);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var o=i(r(64)),a=i(r(24)),n=i(r(284)),s=i(r(312)),u=i(r(532)),l=i(r(836)),c=i(r(520));function d(e,t,r){return t=(0,u.default)(t),(0,n.default)(e,h()?Reflect.construct(t,r||[],(0,u.default)(e).constructor):t.apply(e,r))}function h(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(h=function(){return!!e})()}var p=c.default.getComponent("Button"),f=c.default.getComponent("Component"),v=function(e){function t(){return(0,o.default)(this,t),d(this,t,arguments)}return(0,l.default)(t,e),(0,a.default)(t,[{key:"handleClick",value:function(e){this.player_.record().getDevice()}},{key:"show",value:function(){this.layoutExclude&&!0===this.layoutExclude||(0,s.default)((0,u.default)(t.prototype),"show",this).call(this)}}]),t}(p);v.prototype.controlText_="Device",f.registerComponent("DeviceButton",v);t.default=v;e.exports=t.default},416:(e,t,r)=>{"use strict";var i=r(411);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var o=i(r(868)),a=i(r(196)),n=i(r(64)),s=i(r(24)),u=i(r(284)),l=i(r(312)),c=i(r(532)),d=i(r(836)),h=i(r(520)),p=i(r(456));function f(e,t,r){return t=(0,c.default)(t),(0,u.default)(e,v()?Reflect.construct(t,r||[],(0,c.default)(e).constructor):t.apply(e,r))}function v(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(v=function(){return!!e})()}var y=h.default.getComponent("Button"),g=h.default.getComponent("Component"),m=function(e){function t(e,r){var i;return(0,n.default)(this,t),(i=f(this,t,[e,r])).on(i.player_,p.default.ENTER_PIP,i.onStart),i.on(i.player_,p.default.LEAVE_PIP,i.onStop),i}var r;return(0,d.default)(t,e),(0,s.default)(t,[{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,l.default)((0,c.default)(t.prototype),"show",this).call(this)}},{key:"handleClick",value:(r=(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(p.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 r.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")}}]),t}(y);m.prototype.controlText_="Picture in Picture",g.registerComponent("PictureInPictureToggle",m);t.default=m;e.exports=t.default},852:(e,t,r)=>{"use strict";var i=r(411);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var o=i(r(64)),a=i(r(24)),n=i(r(284)),s=i(r(312)),u=i(r(532)),l=i(r(836)),c=i(r(520));function d(e,t,r){return t=(0,u.default)(t),(0,n.default)(e,h()?Reflect.construct(t,r||[],(0,u.default)(e).constructor):t.apply(e,r))}function h(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(h=function(){return!!e})()}var p=c.default.getComponent("Component"),f=function(e){function t(){return(0,o.default)(this,t),d(this,t,arguments)}return(0,l.default)(t,e),(0,a.default)(t,[{key:"createEl",value:function(){var e=c.default.dom.createEl("canvas"),r=(0,s.default)((0,u.default)(t.prototype),"createEl",this).call(this,"div",{className:"vjs-record-canvas",dir:"ltr"});return r.appendChild(e),r}}]),t}(p);p.registerComponent("RecordCanvas",f);t.default=f;e.exports=t.default},232:(e,t,r)=>{"use strict";var i=r(411);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var o=i(r(64)),a=i(r(24)),n=i(r(284)),s=i(r(312)),u=i(r(532)),l=i(r(836)),c=i(r(520)),d=i(r(456));function h(e,t,r){return t=(0,u.default)(t),(0,n.default)(e,p()?Reflect.construct(t,r||[],(0,u.default)(e).constructor):t.apply(e,r))}function p(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(p=function(){return!!e})()}var f=c.default.getComponent("Component"),v=function(e){function t(e,r){var i;return(0,o.default)(this,t),(i=h(this,t,[e,r])).enable(),i}return(0,l.default)(t,e),(0,a.default)(t,[{key:"createEl",value:function(){var e={"data-label":this.localize("REC")};return(0,s.default)((0,u.default)(t.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,s.default)((0,u.default)(t.prototype),"show",this).call(this)}}]),t}(f);f.registerComponent("RecordIndicator",v);t.default=v;e.exports=t.default},104:(e,t,r)=>{"use strict";var i=r(411);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var o=i(r(64)),a=i(r(24)),n=i(r(284)),s=i(r(312)),u=i(r(532)),l=i(r(836)),c=i(r(520)),d=i(r(456));function h(e,t,r){return t=(0,u.default)(t),(0,n.default)(e,p()?Reflect.construct(t,r||[],(0,u.default)(e).constructor):t.apply(e,r))}function p(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(p=function(){return!!e})()}var f=c.default.getComponent("Button"),v=c.default.getComponent("Component"),y=function(e){function t(){return(0,o.default)(this,t),h(this,t,arguments)}return(0,l.default)(t,e),(0,a.default)(t,[{key:"buildCSSClass",value:function(){return"vjs-record-button vjs-control vjs-button vjs-icon-record-start"}},{key:"enable",value:function(){(0,s.default)((0,u.default)(t.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,s.default)((0,u.default)(t.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,s.default)((0,u.default)(t.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")}}]),t}(f);y.prototype.controlText_="Record",v.registerComponent("RecordToggle",y);t.default=y;e.exports=t.default},920:(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:[],convertAuto:!0,hotKeys:!1,pluginLibraryOptions:{}};t.default=r;e.exports=t.default},152:(e,t,r)=>{"use strict";var i=r(411);Object.defineProperty(t,"__esModule",{value:!0}),t.TSEBML=t.FFMPEGWASM=t.FFMPEGJS=t.ConvertEngine=t.CONVERT_PLUGINS=void 0;var o=i(r(64)),a=i(r(24)),n=i(r(284)),s=i(r(532)),u=i(r(836)),l=i(r(520)),c=r(656);function d(e,t,r){return t=(0,s.default)(t),(0,n.default)(e,h()?Reflect.construct(t,r||[],(0,s.default)(e).constructor):t.apply(e,r))}function h(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(h=function(){return!!e})()}var p=l.default.getComponent("Component"),f=t.TSEBML="ts-ebml",v=t.FFMPEGJS="ffmpeg.js",y=t.FFMPEGWASM="ffmpeg.wasm",g=(t.CONVERT_PLUGINS=[f,v,y],t.ConvertEngine=function(e){function t(e,r){return(0,o.default)(this,t),r.evented=!0,d(this,t,[e,r])}return(0,u.default)(t,e),(0,a.default)(t,[{key:"setup",value:function(e,t){this.mediaType=e,this.debug=t}},{key:"loadBlob",value:function(e){return(0,c.blobToArrayBuffer)(e)}},{key:"addFileInfo",value:function(e,t){(0,c.addFileInfo)(e,t)}},{key:"saveAs",value:function(e){var t=e[Object.keys(e)[0]];(0,c.downloadBlob)(t,this.player().convertedData)}}]),t}(p));l.default.ConvertEngine=g,p.registerComponent("ConvertEngine",g)},840:(e,t,r)=>{"use strict";var i=r(411);Object.defineProperty(t,"__esModule",{value:!0}),t.isAudioPluginActive=t.getVideoEngine=t.getConvertEngine=t.getAudioEngine=void 0;var o=i(r(520)),a=i(r(36)),n=r(152),s=r(779);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}},779:(e,t,r)=>{"use strict";var i=r(411);Object.defineProperty(t,"__esModule",{value:!0}),t.WEBMWASM=t.VMSG=t.VIDEO_PLUGINS=t.RecordEngine=t.RECORD_PLUGINS=t.RECORDRTC=t.RECORDERJS=t.OPUSRECORDER=t.OPUSMEDIARECORDER=t.LIBVORBISJS=t.LAMEJS=t.AUDIO_PLUGINS=void 0;var o=i(r(64)),a=i(r(24)),n=i(r(284)),s=i(r(532)),u=i(r(836)),l=i(r(520)),c=i(r(456)),d=r(656);function h(e,t,r){return t=(0,s.default)(t),(0,n.default)(e,p()?Reflect.construct(t,r||[],(0,s.default)(e).constructor):t.apply(e,r))}function p(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(p=function(){return!!e})()}var f=l.default.getComponent("Component"),v=(t.RECORDRTC="recordrtc",t.LIBVORBISJS="libvorbis.js"),y=t.RECORDERJS="recorder.js",g=t.LAMEJS="lamejs",m=t.OPUSRECORDER="opus-recorder",E=t.OPUSMEDIARECORDER="opus-media-recorder",R=t.VMSG="vmsg",O=t.WEBMWASM="webm-wasm",b=t.AUDIO_PLUGINS=[v,y,g,m,E,R],T=t.VIDEO_PLUGINS=[O],_=(t.RECORD_PLUGINS=b.concat(T),t.RecordEngine=function(e){function t(e,r){return(0,o.default)(this,t),r.evented=!0,h(this,t,[e,r])}return(0,u.default)(t,e),(0,a.default)(t,[{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(c.default.RECORD_COMPLETE)}},{key:"saveAs",value:function(e){var t=e[Object.keys(e)[0]];(0,d.downloadBlob)(t,this.recordedData)}}]),t}(f));l.default.RecordEngine=_,f.registerComponent("RecordEngine",_)},184:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getRecorderMode=t.VIDEO_ONLY=t.SCREEN_ONLY=t.IMAGE_ONLY=t.AUDIO_VIDEO=t.AUDIO_SCREEN=t.AUDIO_ONLY=t.ANIMATION=void 0;var r=t.IMAGE_ONLY="image_only",i=t.AUDIO_ONLY="audio_only",o=t.VIDEO_ONLY="video_only",a=t.AUDIO_VIDEO="audio_video",n=t.AUDIO_SCREEN="audio_screen",s=t.ANIMATION="animation",u=t.SCREEN_ONLY="screen_only",l=(t.getRecorderMode=function(e,t,c,d,h){return l(e)?r:l(d)?s:l(t)&&l(c)?a:l(t)&&l(h)?n:!l(t)&&l(h)?u:l(t)&&!l(c)?i:!l(t)&&l(c)?o:void 0},function(e){return e===Object(e)||!0===e})},36:(e,t,r)=>{"use strict";var i=r(411);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var o=i(r(64)),a=i(r(24)),n=i(r(284)),s=i(r(312)),u=i(r(532)),l=i(r(836)),c=i(r(520)),d=i(r(820)),h=i(r(456)),p=r(779),f=(r(912),r(184));function v(e,t,r){return t=(0,u.default)(t),(0,n.default)(e,y()?Reflect.construct(t,r||[],(0,u.default)(e).constructor):t.apply(e,r))}function y(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(y=function(){return!!e})()}var g=c.default.getComponent("Component"),m=function(e){function t(){return(0,o.default)(this,t),v(this,t,arguments)}return(0,l.default)(t,e),(0,a.default)(t,[{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,s.default)((0,u.default)(t.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();this.engine.getBlob((function(e){switch(i){case f.AUDIO_ONLY:void 0!==e.audio&&(r.recordedData=e.audio);break;case f.VIDEO_ONLY:case f.AUDIO_VIDEO:case f.AUDIO_SCREEN:case f.SCREEN_ONLY:void 0!==e.video&&(r.recordedData=e.video);break;case f.ANIMATION:void 0!==e.gif&&(r.recordedData=e.gif)}r.addFileInfo(r.recordedData),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 f.AUDIO_ONLY:r=this.engine.audioRecorder;break;case f.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()}}]),t}(p.RecordEngine);c.default.RecordRTCEngine=m,g.registerComponent("RecordRTCEngine",m);t.default=m;e.exports=t.default},456:(e,t,r)=>{"use strict";var i=r(411);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var o=i(r(24)),a=i(r(64)),n=(0,o.default)((function e(){(0,a.default)(this,e)}));n.READY="ready",n.ERROR="error",n.PLAYING="playing",n.LOADEDMETADATA="loadedmetadata",n.LOADSTART="loadstart",n.USERINACTIVE="userinactive",n.TIMEUPDATE="timeupdate",n.DURATIONCHANGE="durationchange",n.ENDED="ended",n.PAUSE="pause",n.PLAY="play",n.DEVICE_READY="deviceReady",n.DEVICE_ERROR="deviceError",n.START_RECORD="startRecord",n.STOP_RECORD="stopRecord",n.FINISH_RECORD="finishRecord",n.RECORD_COMPLETE="recordComplete",n.PROGRESS_RECORD="progressRecord",n.TIMESTAMP="timestamp",n.ENUMERATE_READY="enumerateReady",n.ENUMERATE_ERROR="enumerateError",n.AUDIO_BUFFER_UPDATE="audioBufferUpdate",n.AUDIO_OUTPUT_READY="audioOutputReady",n.START_CONVERT="startConvert",n.FINISH_CONVERT="finishConvert",n.ENTER_PIP="enterPIP",n.LEAVE_PIP="leavePIP",n.RETRY="retry",n.ENTERPICTUREINPICTURE="enterpictureinpicture",n.LEAVEPICTUREINPICTURE="leavepictureinpicture",Object.freeze(n);t.default=n;e.exports=t.default},324:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var i=r(184);t.default=function(e){switch(e.which){case 88:if(this.player_.record().getRecordType()===i.IMAGE_ONLY)this.player_.cameraButton.trigger("click");else 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")}};e.exports=t.default},128:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;t.default=function(e,t){"srcObject"in t?t.srcObject=e:"mozSrcObject"in t?t.mozSrcObject=e:t.srcObject=e};e.exports=t.default},664:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;t.default=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};e.exports=t.default},912:(e,t,r)=>{"use strict";var i=r(411);Object.defineProperty(t,"__esModule",{value:!0}),t.isSafari=t.isOpera=t.isFirefox=t.isEdge=t.isChrome=t.detectBrowser=void 0;var o=i(r(796)),a=t.detectBrowser=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},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}},656:(e,t,r)=>{"use strict";var i=r(411);Object.defineProperty(t,"__esModule",{value:!0}),t.downloadBlob=t.blobToArrayBuffer=t.addFileInfo=void 0;var o=i(r(819));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}}}},280:(e,t,r)=>{"use strict";var i=r(411);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var o=i(r(44)),a=i(r(96));t.default=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),l=(0,a.default)(i.seconds),c=(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(l)}return i.hours>0||n.hours>0?"".concat(s,":").concat(u,":").concat(l):r?"".concat(u,":").concat(l,":").concat(c):"".concat(u,":").concat(l)};e.exports=t.default},819:(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"};t.default=function(e){var t=r.exec(e),o=t&&t[1].toLowerCase();return i[o]};e.exports=t.default},796:(e,t,r)=>{var i;i="undefined"!=typeof window?window:void 0!==r.g?r.g:"undefined"!=typeof self?self:{},e.exports=i},820:t=>{"use strict";t.exports=e},520:e=>{"use strict";e.exports=t},559:e=>{e.exports=function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e},e.exports.__esModule=!0,e.exports.default=e.exports},196: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)}))}},e.exports.__esModule=!0,e.exports.default=e.exports},64:e=>{e.exports=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},e.exports.__esModule=!0,e.exports.default=e.exports},24:(e,t,r)=>{var i=r(216);function o(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,i(o.key),o)}}e.exports=function(e,t,r){return t&&o(e.prototype,t),r&&o(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e},e.exports.__esModule=!0,e.exports.default=e.exports},312:(e,t,r)=>{var i=r(248);function o(){return"undefined"!=typeof Reflect&&Reflect.get?(e.exports=o=Reflect.get.bind(),e.exports.__esModule=!0,e.exports.default=e.exports):(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(arguments.length<3?e:r):a.value}},e.exports.__esModule=!0,e.exports.default=e.exports),o.apply(this,arguments)}e.exports=o,e.exports.__esModule=!0,e.exports.default=e.exports},532:e=>{function t(r){return e.exports=t=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},e.exports.__esModule=!0,e.exports.default=e.exports,t(r)}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports},836:(e,t,r)=>{var i=r(816);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}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&i(e,t)},e.exports.__esModule=!0,e.exports.default=e.exports},411:e=>{e.exports=function(e){return e&&e.__esModule?e:{default:e}},e.exports.__esModule=!0,e.exports.default=e.exports},284:(e,t,r)=>{var i=r(848).default,o=r(559);e.exports=function(e,t){if(t&&("object"===i(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return o(e)},e.exports.__esModule=!0,e.exports.default=e.exports},636:(e,t,r)=>{var i=r(848).default;function o(){"use strict";e.exports=o=function(){return r},e.exports.__esModule=!0,e.exports.default=e.exports;var t,r={},a=Object.prototype,n=a.hasOwnProperty,s=Object.defineProperty||function(e,t,r){e[t]=r.value},u="function"==typeof Symbol?Symbol:{},l=u.iterator||"@@iterator",c=u.asyncIterator||"@@asyncIterator",d=u.toStringTag||"@@toStringTag";function h(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{h({},"")}catch(t){h=function(e,t,r){return e[t]=r}}function p(e,t,r,i){var o=t&&t.prototype instanceof R?t:R,a=Object.create(o.prototype),n=new P(i||[]);return s(a,"_invoke",{value:S(e,r,n)}),a}function f(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}r.wrap=p;var v="suspendedStart",y="suspendedYield",g="executing",m="completed",E={};function R(){}function O(){}function b(){}var T={};h(T,l,(function(){return this}));var _=Object.getPrototypeOf,D=_&&_(_(x([])));D&&D!==a&&n.call(D,l)&&(T=D);var C=b.prototype=R.prototype=Object.create(T);function A(e){["next","throw","return"].forEach((function(t){h(e,t,(function(e){return this._invoke(t,e)}))}))}function I(e,t){function r(o,a,s,u){var l=f(e[o],e,a);if("throw"!==l.type){var c=l.arg,d=c.value;return d&&"object"==i(d)&&n.call(d,"__await")?t.resolve(d.__await).then((function(e){r("next",e,s,u)}),(function(e){r("throw",e,s,u)})):t.resolve(d).then((function(e){c.value=e,s(c)}),(function(e){return r("throw",e,s,u)}))}u(l.arg)}var o;s(this,"_invoke",{value: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 S(e,r,i){var o=v;return function(a,n){if(o===g)throw new Error("Generator is already running");if(o===m){if("throw"===a)throw n;return{value:t,done:!0}}for(i.method=a,i.arg=n;;){var s=i.delegate;if(s){var u=k(s,i);if(u){if(u===E)continue;return u}}if("next"===i.method)i.sent=i._sent=i.arg;else if("throw"===i.method){if(o===v)throw o=m,i.arg;i.dispatchException(i.arg)}else"return"===i.method&&i.abrupt("return",i.arg);o=g;var l=f(e,r,i);if("normal"===l.type){if(o=i.done?m:y,l.arg===E)continue;return{value:l.arg,done:i.done}}"throw"===l.type&&(o=m,i.method="throw",i.arg=l.arg)}}}function k(e,r){var i=r.method,o=e.iterator[i];if(o===t)return r.delegate=null,"throw"===i&&e.iterator.return&&(r.method="return",r.arg=t,k(e,r),"throw"===r.method)||"return"!==i&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+i+"' method")),E;var a=f(o,e.iterator,r.arg);if("throw"===a.type)return r.method="throw",r.arg=a.arg,r.delegate=null,E;var n=a.arg;return n?n.done?(r[e.resultName]=n.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,E):n:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,E)}function w(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 L(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function P(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(w,this),this.reset(!0)}function x(e){if(e||""===e){var r=e[l];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,a=function r(){for(;++o<e.length;)if(n.call(e,o))return r.value=e[o],r.done=!1,r;return r.value=t,r.done=!0,r};return a.next=a}}throw new TypeError(i(e)+" is not iterable")}return O.prototype=b,s(C,"constructor",{value:b,configurable:!0}),s(b,"constructor",{value:O,configurable:!0}),O.displayName=h(b,d,"GeneratorFunction"),r.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===O||"GeneratorFunction"===(t.displayName||t.name))},r.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,b):(e.__proto__=b,h(e,d,"GeneratorFunction")),e.prototype=Object.create(C),e},r.awrap=function(e){return{__await:e}},A(I.prototype),h(I.prototype,c,(function(){return this})),r.AsyncIterator=I,r.async=function(e,t,i,o,a){void 0===a&&(a=Promise);var n=new I(p(e,t,i,o),a);return r.isGeneratorFunction(t)?n:n.next().then((function(e){return e.done?e.value:n.next()}))},A(C),h(C,d,"Generator"),h(C,l,(function(){return this})),h(C,"toString",(function(){return"[object Generator]"})),r.keys=function(e){var t=Object(e),r=[];for(var i in t)r.push(i);return r.reverse(),function e(){for(;r.length;){var i=r.pop();if(i in t)return e.value=i,e.done=!1,e}return e.done=!0,e}},r.values=x,P.prototype={constructor:P,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(L),!e)for(var r in this)"t"===r.charAt(0)&&n.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 i(i,o){return s.type="throw",s.arg=e,r.next=i,o&&(r.method="next",r.arg=t),!!o}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],s=a.completion;if("root"===a.tryLoc)return i("end");if(a.tryLoc<=this.prev){var u=n.call(a,"catchLoc"),l=n.call(a,"finallyLoc");if(u&&l){if(this.prev<a.catchLoc)return i(a.catchLoc,!0);if(this.prev<a.finallyLoc)return i(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return i(a.catchLoc,!0)}else{if(!l)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return i(a.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var i=this.tryEntries[r];if(i.tryLoc<=this.prev&&n.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o.finallyLoc,E):this.complete(a)},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),E},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),L(r),E}},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;L(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,r,i){return this.delegate={iterator:x(e),resultName:r,nextLoc:i},"next"===this.method&&(this.arg=t),E}},r}e.exports=o,e.exports.__esModule=!0,e.exports.default=e.exports},816:e=>{function t(r,i){return e.exports=t=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},e.exports.__esModule=!0,e.exports.default=e.exports,t(r,i)}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports},248:(e,t,r)=>{var i=r(532);e.exports=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=i(e)););return e},e.exports.__esModule=!0,e.exports.default=e.exports},776:(e,t,r)=>{var i=r(848).default;e.exports=function(e,t){if("object"!=i(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var o=r.call(e,t||"default");if("object"!=i(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)},e.exports.__esModule=!0,e.exports.default=e.exports},216:(e,t,r)=>{var i=r(848).default,o=r(776);e.exports=function(e){var t=o(e,"string");return"symbol"==i(t)?t:String(t)},e.exports.__esModule=!0,e.exports.default=e.exports},848:e=>{function t(r){return e.exports=t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e.exports.__esModule=!0,e.exports.default=e.exports,t(r)}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports},868:(e,t,r)=>{var i=r(636)();e.exports=i;try{regeneratorRuntime=i}catch(e){"object"==typeof globalThis?globalThis.regeneratorRuntime=i:Function("r","regeneratorRuntime = r")(i)}},44:(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})}},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(411);Object.defineProperty(e,"__esModule",{value:!0}),e.Record=void 0;var r=t(o(848)),i=t(o(64)),n=t(o(24)),s=t(o(284)),u=t(o(559)),l=t(o(312)),c=t(o(532)),d=t(o(836)),h=t(o(520)),p=t(o(607)),f=t(o(852)),v=t(o(124)),y=t(o(336)),g=t(o(104)),m=t(o(232)),E=t(o(416)),R=t(o(456)),O=t(o(324)),b=t(o(920)),T=t(o(280)),_=t(o(128)),D=t(o(664)),C=o(912),A=o(840),I=o(184);function S(e,t,r){return t=(0,c.default)(t),(0,s.default)(e,k()?Reflect.construct(t,r||[],(0,c.default)(e).constructor):t.apply(e,r))}function k(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(k=function(){return!!e})()}var w=h.default.getPlugin("plugin"),L=h.default.getComponent("Player"),P="auto",x=e.Record=function(e){function t(e,r){var o;(0,i.default)(this,t),o=S(this,t,[e,r]),L.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"),o.loadOptions(),o.resetState(),r.formatTime&&"function"==typeof r.formatTime?o.setFormatTime(r.formatTime):o.setFormatTime((function(e,t){return(0,T.default)(e,t,o.displayMilliseconds)}));var a="av-perm";switch(o.getRecordType()){case I.IMAGE_ONLY:case I.VIDEO_ONLY:case I.ANIMATION:a="video-perm";break;case I.AUDIO_ONLY:a="audio-perm";break;case I.SCREEN_ONLY:a="screen-perm";break;case I.AUDIO_SCREEN:a="sv-perm"}v.default.prototype.buildCSSClass=function(){return"vjs-record vjs-device-button vjs-control vjs-icon-"+a},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 f.default(e,r),e.recordCanvas.hide(),e.addChild(e.recordCanvas),e.animationDisplay=new p.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 n=void 0===h.default.VERSION||-1===(0,D.default)(h.default.VERSION,"7.6.0");if("pictureInPictureEnabled"in document||(o.pictureInPicture=!1),!0===o.pictureInPicture&&(n&&(e.pipToggle=new E.default(e,r),e.pipToggle.hide()),o.onEnterPiPHandler=o.onEnterPiP.bind((0,u.default)(o)),o.onLeavePiPHandler=o.onLeavePiP.bind((0,u.default)(o))),o.player.options_.controlBar){var s=["deviceButton","recordIndicator","cameraButton","recordToggle"];e.pipToggle&&s.push("pipToggle"),s.forEach((function(e){void 0!==o.player.options_.controlBar[e]&&(o.player[e].layoutExclude=!0,o.player[e].hide())}))}return o.player.one(R.default.READY,o.setupUI.bind((0,u.default)(o))),o}return(0,d.default)(t,e),(0,n.default)(t,[{key:"loadOptions",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=(void 0!==h.default.obj?h.default.obj.merge:h.default.mergeOptions)(b.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.convertAuto=t.convertAuto,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===P||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===P||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===P||this.audioRecorderType,video:this.videoRecorderType===P||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((function(r){t.active&&t.stop(),e.onDeviceError(r)}))})).catch(this.onDeviceError.bind(this));break;case I.AUDIO_VIDEO:this.mediaType={audio:this.audioRecorderType===P||this.audioRecorderType,video:this.videoRecorderType===P||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;if(this.getRecordType()===I.AUDIO_ONLY)r=(0,A.getAudioEngine)(this.audioEngine),i=this.audioEngine;else r=(0,A.getVideoEngine)(this.videoEngine),i=this.videoEngine;try{this.engine=new r(this.player,this.player.options_)}catch(e){throw new Error("Could not load "+i+" plugin")}if(this.engine.on(R.default.RECORD_COMPLETE,this.engineStopCallback),this.engine.bufferSize=this.audioBufferSize,this.engine.sampleRate=this.audioSampleRate,this.engine.bitRate=this.audioBitRate,this.engine.audioChannels=this.audioChannels,this.engine.audioWorkerURL=this.audioWorkerURL,this.engine.audioWebAssemblyURL=this.audioWebAssemblyURL,this.engine.mimeType={video:this.videoMimeType,gif:"image/gif"},null!==this.audioMimeType&&this.audioMimeType!==P&&(this.engine.mimeType.audio=this.audioMimeType),this.engine.videoWorkerURL=this.videoWorkerURL,this.engine.videoWebAssemblyURL=this.videoWebAssemblyURL,this.engine.videoBitRate=this.videoBitRate,this.engine.videoFrameRate=this.videoFrameRate,this.engine.video={width:this.videoFrameWidth,height:this.videoFrameHeight},this.engine.canvas={width:this.videoFrameWidth,height:this.videoFrameHeight},this.engine.quality=this.animationQuality,this.engine.frameRate=this.animationFrameRate,this.recordTimeSlice&&this.recordTimeSlice>0&&(this.engine.timeSlice=this.recordTimeSlice,this.engine.maxFileSize=this.maxFileSize),this.engine.pluginLibraryOptions=this.pluginLibraryOptions,this.engine.setup(this.stream,this.mediaType,this.debug),""!==this.convertEngine){var o=(0,A.getConvertEngine)(this.convertEngine);try{this.converter=new o(this.player,this.player.options_)}catch(e){throw new Error("Could not load "+this.convertEngine+" plugin")}this.converter.convertAuto=this.convertAuto,this.converter.convertWorkerURL=this.convertWorkerURL,this.converter.convertOptions=this.convertOptions,this.converter.pluginLibraryOptions=this.pluginLibraryOptions,this.converter.setup(this.mediaType,this.debug)}["currentTimeDisplay","timeDivider","durationDisplay"].forEach((function(e){void 0!==(e=t.player.controlBar[e])&&(e.el().style.display="block",e.show())})),this.player.recordToggle.show()}else this.player.recordIndicator.disable(),this.retrySnapshot();this.getRecordType()!==I.AUDIO_ONLY?(this.mediaElement=this.player.el().firstChild,this.mediaElement.controls=!1,this.mediaElement.muted=!0,this.displayVolumeControl(!1),!0===this.pictureInPicture&&(this.player.pipToggle.show(),this.mediaElement.removeEventListener(R.default.ENTERPICTUREINPICTURE,this.onEnterPiPHandler),this.mediaElement.removeEventListener(R.default.LEAVEPICTUREINPICTURE,this.onLeavePiPHandler),this.mediaElement.addEventListener(R.default.ENTERPICTUREINPICTURE,this.onEnterPiPHandler),this.mediaElement.addEventListener(R.default.LEAVEPICTUREINPICTURE,this.onLeavePiPHandler)),this.load(this.stream),this.player.one(R.default.LOADEDMETADATA,(function(){t.mediaElement.play(),t.player.trigger(R.default.DEVICE_READY)}))):this.player.trigger(R.default.DEVICE_READY)}},{key:"onDeviceError",value:function(e){this._deviceActive=!1,this.isDestroyed()||(this.player.deviceErrorCode=e,this.player.trigger(R.default.DEVICE_ERROR))}},{key:"start",value:function(){var e=this;if(!this.isProcessing()){if(this.stream&&!1===this.stream.active)return void this.getDevice();switch(this._recording=!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()){case I.AUDIO_ONLY:this.surfer.setupPlaybackEvents(!1),this.surfer.surfer.microphone.paused=!1,this.surfer.liveMode=!0,this.surfer.surfer.microphone.play();break;case I.VIDEO_ONLY:case I.AUDIO_VIDEO:case I.AUDIO_SCREEN:case I.SCREEN_ONLY:this.startVideoPreview();break;case I.ANIMATION:this.player.recordCanvas.hide(),this.player.animationDisplay.hide(),this.mediaElement.style.display="block",this.captureFrame().then((function(t){e.startVideoPreview()}))}switch(this.autoMuteDevice&&this.muteTracks(!1),this.getRecordType()){case I.IMAGE_ONLY:this.createSnapshot(),this.player.trigger(R.default.START_RECORD);break;case I.VIDEO_ONLY:case I.AUDIO_VIDEO:case I.AUDIO_SCREEN:case I.ANIMATION:case I.SCREEN_ONLY:this.player.one(R.default.LOADEDMETADATA,(function(){e.startRecording()}));break;default:this.startRecording()}}}},{key:"startRecording",value:function(){this.paused=!1,this.pauseTime=this.pausedTime=0,this.startTime=performance.now();this.countDown=this.player.setInterval(this.onCountDown.bind(this),100),void 0!==this.engine&&this.engine.dispose(),this.engine.start(),this.player.trigger(R.default.START_RECORD)}},{key:"stop",value:function(){this.isProcessing()||(this._recording=!1,this._processing=!0,this.getRecordType()!==I.IMAGE_ONLY?(this.player.trigger(R.default.STOP_RECORD),this.player.clearInterval(this.countDown),this.engine&&this.engine.stop(),this.autoMuteDevice&&this.muteTracks(!0)):this.player.recordedData&&this.player.trigger(R.default.FINISH_RECORD))}},{key:"stopDevice",value:function(){this.isRecording()?(this.player.one(R.default.FINISH_RECORD,this.stopStream.bind(this)),this.stop()):this.stopStream()}},{key:"stopStream",value:function(){if(this.stream){if(this._deviceActive=!1,this.getRecordType()===I.AUDIO_ONLY)return void this.surfer.surfer.microphone.stopDevice();this.stream.getTracks().forEach((function(e){e.stop()}))}}},{key:"pause",value:function(){this.paused||(this.pauseTime=performance.now(),this.paused=!0,this.engine.pause())}},{key:"resume",value:function(){this.paused&&(this.pausedTime+=performance.now()-this.pauseTime,this.engine.resume(),this.paused=!1)}},{key:"onRecordComplete",value:function(){var e=this;if(this.player.recordedData=this.engine.recordedData,void 0!==this.player.controlBar.playToggle&&(this.player.controlBar.playToggle.removeClass("vjs-ended"),this.player.controlBar.playToggle.show()),!0===this.convertAuto&&this.convert(),this.player.trigger(R.default.FINISH_RECORD),!this.isDestroyed())switch(this.getRecordType()){case I.AUDIO_ONLY:this.surfer.pause(),this.surfer.setupPlaybackEvents(!0),this.player.loadingSpinner.show(),this.surfer.surfer.once(R.default.READY,(function(){e._processing=!1})),this.load(this.player.recordedData);break;case I.VIDEO_ONLY:case I.AUDIO_VIDEO:case I.AUDIO_SCREEN:case I.SCREEN_ONLY:this.player.one(R.default.PAUSE,(function(){e._processing=!1,e.player.loadingSpinner.hide(),e.setDuration(e.streamDuration),e.on(e.player,R.default.TIMEUPDATE,e.playbackTimeUpdate),e.on(e.player,R.default.ENDED,e.playbackTimeUpdate),e.getRecordType()!==I.AUDIO_VIDEO&&e.getRecordType()!==I.AUDIO_SCREEN||(e.mediaElement.muted=!1,e.displayVolumeControl(!0)),e.load(e.player.recordedData)})),this.player.pause();break;case I.ANIMATION:this._processing=!1,this.player.loadingSpinner.hide(),this.setDuration(this.streamDuration),this.mediaElement.style.display="none",this.player.recordCanvas.show(),this.player.pause(),this.on(this.player,R.default.PLAY,this.showAnimation),this.on(this.player,R.default.PAUSE,this.hideAnimation)}}},{key:"onCountDown",value:function(){if(!this.paused){var e=performance.now(),t=this.maxLength,r=(e-(this.startTime+this.pausedTime))/1e3;this.streamDuration=r,r>=t&&(r=t,this.stop()),this.setDuration(t),this.setCurrentTime(r,t),this.player.trigger(R.default.PROGRESS_RECORD)}}},{key:"getCurrentTime",value:function(){var e=isNaN(this.streamCurrentTime)?0:this.streamCurrentTime;return this.getRecordType()===I.AUDIO_ONLY&&(e=this.surfer.getCurrentTime()),e}},{key:"setCurrentTime",value:function(e,t){switch(e=isNaN(e)?0:e,t=isNaN(t)?0:t,this.getRecordType()){case I.AUDIO_ONLY:this.surfer.setCurrentTime(e,t);break;case I.VIDEO_ONLY:case I.AUDIO_VIDEO:case I.AUDIO_SCREEN:case I.ANIMATION:case I.SCREEN_ONLY:this.player.controlBar.currentTimeDisplay&&this.player.controlBar.currentTimeDisplay.contentEl()&&this.player.controlBar.currentTimeDisplay.contentEl().lastChild&&(this.streamCurrentTime=Math.min(e,t),this.player.controlBar.currentTimeDisplay.formattedTime_=this.player.controlBar.currentTimeDisplay.contentEl().lastChild.textContent=this._formatTime(this.streamCurrentTime,t,this.displayMilliseconds))}}},{key:"getDuration",value:function(){return isNaN(this.streamDuration)?0:this.streamDuration}},{key:"setDuration",value:function(e){switch(e=isNaN(e)?0:e,this.getRecordType()){case I.AUDIO_ONLY:this.surfer.setDuration(e);break;case I.VIDEO_ONLY:case I.AUDIO_VIDEO:case I.AUDIO_SCREEN:case I.ANIMATION:case I.SCREEN_ONLY:this.player.controlBar.durationDisplay&&this.player.controlBar.durationDisplay.contentEl()&&this.player.controlBar.durationDisplay.contentEl().lastChild&&(this.player.controlBar.durationDisplay.formattedTime_=this.player.controlBar.durationDisplay.contentEl().lastChild.textContent=this._formatTime(e,e,this.displayMilliseconds))}}},{key:"load",value:function(e){switch(this.getRecordType()){case I.AUDIO_ONLY:this.surfer.load(e);break;case I.IMAGE_ONLY:case I.VIDEO_ONLY:case I.AUDIO_VIDEO:case I.AUDIO_SCREEN:case I.ANIMATION:case I.SCREEN_ONLY:e instanceof Blob||e instanceof File?(this.mediaElement.srcObject=null,this.mediaElement.src=URL.createObjectURL(e)):(0,_.default)(e,this.mediaElement)}}},{key:"saveAs",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"record";"record"===t?this.engine&&void 0!==e&&this.engine.saveAs(e):"convert"===t&&this.converter&&void 0!==e&&this.converter.saveAs(e)}},{key:"dispose",value:function(){this.player.off(R.default.READY),this.player.off(R.default.USERINACTIVE),this.player.off(R.default.LOADEDMETADATA),this.engine&&(this.engine.dispose(),this.engine.destroy(),this.engine.off(R.default.RECORD_COMPLETE,this.engineStopCallback)),this.stop(),this.stopDevice(),this.removeRecording(),this.player.clearInterval(this.countDown),this.getRecordType()===I.AUDIO_ONLY?this.surfer&&this.surfer.destroy():this.getRecordType()===I.IMAGE_ONLY&&this.mediaElement&&this.streamVisibleCallback&&this.mediaElement.removeEventListener(R.default.PLAYING,this.streamVisibleCallback),this.resetState(),(0,l.default)((0,c.default)(t.prototype),"dispose",this).call(this)}},{key:"destroy",value:function(){this.player.dispose()}},{key:"reset",value:function(){var e=this;switch(this.engine&&(this.engine.dispose(),this.engine.off(R.default.RECORD_COMPLETE,this.engineStopCallback)),this.stop(),this.stopDevice(),this.player.clearInterval(this.countDown),this.removeRecording(),this.loadOptions(),this.resetState(),this.setDuration(this.maxLength),this.setCurrentTime(0),this.player.reset(),this.getRecordType()){case I.AUDIO_ONLY:this.surfer&&this.surfer.surfer&&this.surfer.surfer.empty();break;case I.IMAGE_ONLY:case I.ANIMATION:this.player.recordCanvas.hide(),this.player.cameraButton.hide()}void 0!==this.player.controlBar.playToggle&&this.player.controlBar.playToggle.hide(),this.player.deviceButton.show(),this.player.recordToggle.hide(),this.player.one(R.default.LOADEDMETADATA,(function(){e.setDuration(e.maxLength)}))}},{key:"resetState",value:function(){this._recording=!1,this._processing=!1,this._deviceActive=!1,this.devices=[]}},{key:"removeRecording",value:function(){this.mediaElement&&this.mediaElement.src&&!0===this.mediaElement.src.startsWith("blob:")&&(URL.revokeObjectURL(this.mediaElement.src),this.mediaElement.src="")}},{key:"exportImage",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"image/png",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;if(this.getRecordType()===I.AUDIO_ONLY)return this.surfer.surfer.exportImage(e,t,"blob");var r=this.player.recordCanvas.el().firstChild;return this.drawCanvas(r,this.mediaElement),new Promise((function(i){r.toBlob(i,e,t)}))}},{key:"muteTracks",value:function(e){(this.getRecordType()===I.AUDIO_ONLY||this.getRecordType()===I.AUDIO_SCREEN||this.getRecordType()===I.AUDIO_VIDEO)&&this.stream.getAudioTracks().length>0&&(this.stream.getAudioTracks()[0].enabled=!e),this.getRecordType()!==I.AUDIO_ONLY&&this.stream.getVideoTracks().length>0&&(this.stream.getVideoTracks()[0].enabled=!e)}},{key:"getRecordType",value:function(){return(0,I.getRecorderMode)(this.recordImage,this.recordAudio,this.recordVideo,this.recordAnimation,this.recordScreen)}},{key:"convert",value:function(){void 0!==this.converter&&this.converter.convert(this.player.recordedData)}},{key:"createSnapshot",value:function(){var e=this;this.captureFrame().then((function(t){"blob"===e.imageOutputType?t.toBlob((function(t){e.player.recordedData=t,e.displaySnapshot()})):"dataURL"===e.imageOutputType&&(e.player.recordedData=t.toDataURL(e.imageOutputFormat,e.imageOutputQuality),e.displaySnapshot())}),this.imageOutputFormat,this.imageOutputQuality)}},{key:"displaySnapshot",value:function(){this.mediaElement.style.display="none",this.player.recordCanvas.show(),this.stop()}},{key:"retrySnapshot",value:function(){this._processing=!1,this.player.recordCanvas.hide(),this.player.el().firstChild.style.display="block"}},{key:"captureFrame",value:function(){var e=this,t=(0,C.detectBrowser)(),i=this.player.recordCanvas.el().firstChild,o=this.stream.getVideoTracks()[0],a=o.getSettings();return i.width=a.width,i.height=a.height,new Promise((function(n,s){var u=a.width/a.height,l=e.player.width()/e.player.height(),c=0,d=0,h=0,p=0;if(u>=l?(c=a.height*(e.player.width()/a.width),d=e.player.width(),p=e.player.height()/2-c/2):(c=e.player.height(),d=a.width*(e.player.height()/a.height),h=e.player.width()/2-d/2),"chrome"===t.browser&&t.version>=60&&("undefined"==typeof ImageCapture?"undefined":(0,r.default)(ImageCapture))===("undefined"==typeof Function?"undefined":(0,r.default)(Function)))try{new ImageCapture(o).grabFrame().then((function(t){e.drawCanvas(i,t,d,c,h,p),n(i)})).catch((function(e){}))}catch(e){}e.drawCanvas(i,e.mediaElement,d,c,h,p),n(i)}))}},{key:"drawCanvas",value:function(e,t,r,i){var o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0;void 0===r&&(r=e.width),void 0===i&&(i=e.height),e.getContext("2d").drawImage(t,o,a,r,i)}},{key:"startVideoPreview",value:function(){this.off(R.default.TIMEUPDATE),this.off(R.default.DURATIONCHANGE),this.off(R.default.LOADEDMETADATA),this.off(R.default.PLAY),this.mediaElement.muted=!0,this.displayVolumeControl(!1),this.removeRecording(),this.load(this.stream),this.mediaElement.play()}},{key:"showAnimation",value:function(){var e=this.player.animationDisplay.el().firstChild;e.width=this.player.width(),e.height=this.player.height(),this.player.recordCanvas.hide(),(0,_.default)(this.player.recordedData,e),this.player.animationDisplay.show()}},{key:"hideAnimation",value:function(){this.player.recordCanvas.show(),this.player.animationDisplay.hide()}},{key:"playbackTimeUpdate",value:function(){this.setCurrentTime(this.player.currentTime(),this.streamDuration)}},{key:"enumerateDevices",value:function(){var e=this;if(!navigator.mediaDevices||!navigator.mediaDevices.enumerateDevices)return this.player.enumerateErrorCode="enumerateDevices() not supported.",void this.player.trigger(R.default.ENUMERATE_ERROR);navigator.mediaDevices.enumerateDevices(this).then((function(t){e.devices=[],t.forEach((function(t){e.devices.push(t)})),e.player.trigger(R.default.ENUMERATE_READY)})).catch((function(t){e.player.enumerateErrorCode=t,e.player.trigger(R.default.ENUMERATE_ERROR)}))}},{key:"setVideoInput",value:function(e){this.recordVideo===Object(this.recordVideo)?this.recordVideo.deviceId={exact:e}:!0===this.recordVideo&&(this.recordVideo={deviceId:{exact:e}}),this.stopDevice(),this.getDevice()}},{key:"setAudioInput",value:function(e){if(this.recordAudio===Object(this.recordAudio)?this.recordAudio.deviceId={exact:e}:!0===this.recordAudio&&(this.recordAudio={deviceId:{exact:e}}),this.getRecordType()===I.AUDIO_ONLY)this.surfer.surfer.microphone.constraints={video:!1,audio:this.recordAudio};this.stopDevice(),this.getDevice()}},{key:"setAudioOutput",value:function(e){var t,r=this;if(this.getRecordType()===I.AUDIO_ONLY)this.surfer.surfer.setSinkId(e).then((function(e){r.player.trigger(R.default.AUDIO_OUTPUT_READY)})).catch((function(e){t=e}));else{var i=player.tech_.el_;e?void 0!==i.sinkId?i.setSinkId(e).then((function(e){r.player.trigger(R.default.AUDIO_OUTPUT_READY)})).catch((function(e){t=e})):t="Browser does not support audio output device selection.":t="Invalid deviceId: ".concat(e)}this.player.trigger(R.default.ERROR,t)}},{key:"setFormatTime",value:function(e){this._formatTime=e,void 0!==h.default.time?h.default.time.setFormatTime(this._formatTime):h.default.setFormatTime(this._formatTime),this.surfer&&this.surfer.setFormatTime(this._formatTime)}},{key:"displayVolumeControl",value:function(e){void 0!==this.player.controlBar.volumePanel&&(e=!0===e?"flex":"none",this.player.controlBar.volumePanel.el().style.display=e)}},{key:"onStreamVisible",value:function(e){this.mediaElement.removeEventListener(R.default.PLAYING,this.streamVisibleCallback),this.player.cameraButton.onStop(),this.player.cameraButton.show()}},{key:"onEnterPiP",value:function(e){this.player.trigger(R.default.ENTER_PIP,e)}},{key:"onLeavePiP",value:function(e){this.player.trigger(R.default.LEAVE_PIP)}}]),t}(w);x.VERSION="4.7.0",h.default.Record=x,void 0===h.default.getPlugin("record")&&h.default.registerPlugin("record",x)})(),a})())); |