UNPKG

ld-videojs-record

Version:

A video.js plugin for recording audio/video/image files.

8 lines 58.5 kB
/*! * ld-videojs-record * @version 0.0.1 * @see https://github.com/collab-project/videojs-record * @copyright 2014-2020 Collab * @license MIT */ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("videojs"),require("RecordRTC")):"function"==typeof define&&define.amd?define("VideojsRecord",["videojs","RecordRTC"],t):"object"==typeof exports?exports.VideojsRecord=t(require("videojs"),require("RecordRTC")):e.VideojsRecord=t(e.videojs,e.RecordRTC)}(window,(function(e,t){return function(e){var t={};function i(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,i),o.l=!0,o.exports}return i.m=e,i.c=t,i.d=function(e,t,r){i.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},i.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.t=function(e,t){if(1&t&&(e=i(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(i.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)i.d(r,o,function(t){return e[t]}.bind(null,o));return r},i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,"a",t),t},i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},i.p="",i(i.s=15)}([function(e,t){e.exports=function(e){return e&&e.__esModule?e:{default:e}}},function(e,t){e.exports=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}},function(e,t){function i(t){return e.exports=i=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},i(t)}e.exports=i},function(t,i){t.exports=e},function(e,t){function i(e,t){for(var i=0;i<t.length;i++){var r=t[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}e.exports=function(e,t,r){return t&&i(e.prototype,t),r&&i(e,r),e}},function(e,t,i){var r=i(10),o=i(11);e.exports=function(e,t){return!t||"object"!==r(t)&&"function"!=typeof t?o(e):t}},function(e,t,i){var r=i(18);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&&r(e,t)}},function(e,t,i){var r=i(17);function o(t,i,a){return"undefined"!=typeof Reflect&&Reflect.get?e.exports=o=Reflect.get:e.exports=o=function(e,t,i){var o=r(e,t);if(o){var a=Object.getOwnPropertyDescriptor(o,t);return a.get?a.get.call(i):a.value}},o(t,i,a||t)}e.exports=o},function(e,t,i){"use strict";var r=i(0);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var o=r(i(1)),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},function(e,t,i){"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;t.IMAGE_ONLY="image_only";t.AUDIO_ONLY="audio_only";t.VIDEO_ONLY="video_only";t.AUDIO_VIDEO="audio_video";t.AUDIO_SCREEN="audio_screen";t.ANIMATION="animation";t.SCREEN_ONLY="screen_only";t.getRecorderMode=function(e,t,i,o,a){return r(e)?"image_only":r(o)?"animation":r(t)&&r(i)?"audio_video":r(t)&&r(a)?"audio_screen":!r(t)&&r(a)?"screen_only":r(t)&&!r(i)?"audio_only":!r(t)&&r(i)?"video_only":void 0};var r=function(e){return e===Object(e)||!0===e}},function(e,t){function i(t){return"function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?e.exports=i=function(e){return typeof e}:e.exports=i=function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i(t)}e.exports=i},function(e,t){e.exports=function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}},function(e,t,i){"use strict";var r=i(0);Object.defineProperty(t,"__esModule",{value:!0}),t.isFirefox=t.isSafari=t.isChrome=t.isOpera=t.isEdge=t.detectBrowser=void 0;var o=r(i(34)),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,i){var r=e.match(t);return r&&r.length>=i&&parseInt(r[i],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}},function(e,t,i){"use strict";var r=i(0);Object.defineProperty(t,"__esModule",{value:!0}),t.WEBMWASM=t.VMSG=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=r(i(1)),a=r(i(4)),n=r(i(5)),s=r(i(2)),u=r(i(6)),l=r(i(3)),d=r(i(8)),c=i(14),h=l.default.getComponent("Component");t.RECORDRTC="recordrtc";t.LIBVORBISJS="libvorbis.js";t.RECORDERJS="recorder.js";t.LAMEJS="lamejs";t.OPUSRECORDER="opus-recorder";t.VMSG="vmsg";t.WEBMWASM="webm-wasm";var p=["libvorbis.js","recorder.js","lamejs","opus-recorder","vmsg"];t.AUDIO_PLUGINS=p;var f=["webm-wasm"];t.VIDEO_PLUGINS=f;var y=p.concat(f);t.RECORD_PLUGINS=y;var v=function(e){function t(e,i){return(0,o.default)(this,t),i.evented=!0,(0,n.default)(this,(0,s.default)(t).call(this,e,i))}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,c.addFileInfo)(e)}},{key:"onStopRecording",value:function(e){this.recordedData=e,this.addFileInfo(this.recordedData),this.dispose(),this.trigger(d.default.RECORD_COMPLETE)}},{key:"saveAs",value:function(e){var t=e[Object.keys(e)[0]];(0,c.downloadBlob)(t,this.recordedData)}}]),t}(h);t.RecordEngine=v,l.default.RecordEngine=v,h.registerComponent("RecordEngine",v)},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.addFileInfo=t.blobToArrayBuffer=t.downloadBlob=void 0;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 i=document.createElement("a");i.href=URL.createObjectURL(t),i.download=e,i.style="display:none;opacity:0;color:transparent;",(document.body||document.documentElement).appendChild(i),"function"==typeof i.click?i.click():(i.target="_blank",i.dispatchEvent(new MouseEvent("click",{view:window,bubbles:!0,cancelable:!0}))),URL.revokeObjectURL(i.href)};t.blobToArrayBuffer=function(e){return new Promise((function(t,i){var r=new FileReader;r.onloadend=function(){t(r.result)},r.onerror=function(e){i(e.error)},r.readAsArrayBuffer(e)}))};t.addFileInfo=function(e,t){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}var i="."+e.type.split("/")[1];i.indexOf(";")>-1&&(i=i.split(";")[0]);try{e.name=t.getTime()+i}catch(e){if(!(e instanceof TypeError))throw e}}}},function(e,t,i){i(16),e.exports=i(40)},function(e,t,i){"use strict";var r=i(0);Object.defineProperty(t,"__esModule",{value:!0}),t.Record=void 0;var o=r(i(10)),a=r(i(1)),n=r(i(4)),s=r(i(5)),u=r(i(11)),l=r(i(2)),d=r(i(7)),c=r(i(6)),h=r(i(3)),p=r(i(19)),f=r(i(20)),y=r(i(21)),v=r(i(22)),g=r(i(23)),m=r(i(24)),E=r(i(25)),R=r(i(8)),O=r(i(29)),T=r(i(30)),b=r(i(31)),D=r(i(32)),_=r(i(33)),C=i(12),A=i(36),I=i(9),S=h.default.getPlugin("plugin"),k=h.default.getComponent("Player"),L="auto",w=function(e){function t(e,i){var r;(0,a.default)(this,t),r=(0,s.default)(this,(0,l.default)(t).call(this,e,i)),k.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"),r.loadOptions(),r.resetState();var o="av-perm";switch(r.getRecordType()){case I.IMAGE_ONLY:case I.VIDEO_ONLY:case I.ANIMATION:o="video-perm";break;case I.AUDIO_ONLY:o="audio-perm";break;case I.SCREEN_ONLY:o="screen-perm";break;case I.AUDIO_SCREEN:o="sv-perm"}y.default.prototype.buildCSSClass=function(){return"vjs-record vjs-device-button vjs-control vjs-icon-"+o},e.deviceButton=new y.default(e,i),e.addChild(e.deviceButton),e.recordIndicator=new m.default(e,i),e.recordIndicator.hide(),e.addChild(e.recordIndicator),e.recordCanvas=new f.default(e,i),e.recordCanvas.hide(),e.addChild(e.recordCanvas),e.animationDisplay=new p.default(e,i),e.animationDisplay.hide(),e.addChild(e.animationDisplay),e.cameraButton=new v.default(e,i),e.cameraButton.hide(),e.recordToggle=new g.default(e,i),e.recordToggle.hide();var n=void 0===h.default.VERSION||-1===(0,_.default)(h.default.VERSION,"7.6.0");if("exitPictureInPicture"in document?n&&(e.pipToggle=new E.default(e,i),e.pipToggle.hide()):r.pictureInPicture=!1,!0===r.pictureInPicture&&(r.onEnterPiPHandler=r.onEnterPiP.bind((0,u.default)(r)),r.onLeavePiPHandler=r.onLeavePiP.bind((0,u.default)(r))),r.player.options_.controlBar){var d=["deviceButton","recordIndicator","cameraButton","recordToggle"];e.pipToggle&&d.push("pipToggle"),d.forEach((function(e){void 0!==r.player.options_.controlBar[e]&&(r.player[e].layoutExclude=!0,r.player[e].hide())}))}return r.player.one(R.default.READY,r.setupUI.bind((0,u.default)(r))),r}return(0,c.default)(t,e),(0,n.default)(t,[{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.msDisplayMax=parseFloat(t.msDisplayMax),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())),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();break;case I.IMAGE_ONLY:case I.VIDEO_ONLY:case I.AUDIO_VIDEO:case I.ANIMATION:case I.SCREEN_ONLY:case I.AUDIO_SCREEN: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.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,o.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(i){t.addTrack(i.getTracks()[0]),e.onDeviceReady.bind(e)(t)}))})).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,o.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,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 i,r;switch(this.getRecordType()){case I.AUDIO_ONLY:i=(0,A.getAudioEngine)(this.audioEngine),r=this.audioEngine;break;default:i=(0,A.getVideoEngine)(this.videoEngine),r=this.videoEngine}try{this.engine=new i(this.player,this.player.options_)}catch(e){throw new Error("Could not load "+r+" 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!==L&&(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.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()){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()),void 0!==this.converter&&this.converter.convert(this.player.recordedData),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,i=(e-(this.startTime+this.pausedTime))/1e3;this.streamDuration=i,i>=t&&(i=t,this.stop()),this.setDuration(t),this.setCurrentTime(i,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.streamCurrentTime=Math.min(e,t),this.player.controlBar.currentTimeDisplay.formattedTime_=this.player.controlBar.currentTimeDisplay.contentEl().lastChild.textContent=(0,b.default)(this.streamCurrentTime,t,this.msDisplayMax))}}},{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.formattedTime_=this.player.controlBar.durationDisplay.contentEl().lastChild.textContent=(0,b.default)(e,e,this.msDisplayMax))}}},{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,D.default)(e,this.mediaElement)}}},{key:"saveAs",value:function(e){this.engine&&void 0!==e&&this.engine.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,d.default)((0,l.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&&!0===this.mediaElement.src.startsWith("blob:")&&(URL.revokeObjectURL(this.mediaElement.src),this.mediaElement.src="")}},{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:"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;return i.width=this.player.width(),i.height=this.player.height(),new Promise((function(r,a){if("chrome"===t.browser&&t.version>=60&&("undefined"==typeof ImageCapture?"undefined":(0,o.default)(ImageCapture))===("undefined"==typeof Function?"undefined":(0,o.default)(Function)))try{var n=e.stream.getVideoTracks()[0];new ImageCapture(n).grabFrame().then((function(t){e.drawCanvas(i,t),r(i)})).catch((function(e){}))}catch(e){}e.drawCanvas(i,e.mediaElement),r(i)}))}},{key:"drawCanvas",value:function(e,t){e.getContext("2d").drawImage(t,0,0,e.width,e.height)}},{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,D.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){switch(this.recordAudio===Object(this.recordAudio)?this.recordAudio.deviceId={exact:e}:!0===this.recordAudio&&(this.recordAudio={deviceId:{exact:e}}),this.getRecordType()){case I.AUDIO_ONLY:this.surfer.surfer.microphone.constraints={video:!1,audio:this.recordAudio}}this.stopDevice(),this.getDevice()}},{key:"setAudioOutput",value:function(e){var t,i=this;switch(this.getRecordType()){case I.AUDIO_ONLY:this.surfer.surfer.setSinkId(e).then((function(e){i.player.trigger(R.default.AUDIO_OUTPUT_READY)})).catch((function(e){t=e}));break;default:var r=player.tech_.el_;e?void 0!==r.sinkId?r.setSinkId(e).then((function(e){i.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:"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}(S);t.Record=w,w.VERSION="0.0.1",h.default.Record=w,void 0===h.default.getPlugin("record")&&h.default.registerPlugin("record",w)},function(e,t,i){var r=i(2);e.exports=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=r(e)););return e}},function(e,t){function i(t,r){return e.exports=i=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},i(t,r)}e.exports=i},function(e,t,i){"use strict";var r=i(0);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var o=r(i(1)),a=r(i(4)),n=r(i(5)),s=r(i(2)),u=r(i(7)),l=r(i(6)),d=r(i(3)).default.getComponent("Component"),c=function(e){function t(){return(0,o.default)(this,t),(0,n.default)(this,(0,s.default)(t).apply(this,arguments))}return(0,l.default)(t,e),(0,a.default)(t,[{key:"createEl",value:function(){return(0,u.default)((0,s.default)(t.prototype),"createEl",this).call(this,"div",{className:"vjs-animation-display",innerHTML:"<img />"})}}]),t}(d);d.registerComponent("AnimationDisplay",c);var h=c;t.default=h,e.exports=t.default},function(e,t,i){"use strict";var r=i(0);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var o=r(i(1)),a=r(i(4)),n=r(i(5)),s=r(i(2)),u=r(i(7)),l=r(i(6)),d=r(i(3)).default.getComponent("Component"),c=function(e){function t(){return(0,o.default)(this,t),(0,n.default)(this,(0,s.default)(t).apply(this,arguments))}return(0,l.default)(t,e),(0,a.default)(t,[{key:"createEl",value:function(){return(0,u.default)((0,s.default)(t.prototype),"createEl",this).call(this,"div",{className:"vjs-record-canvas",innerHTML:"<canvas></canvas>"})}}]),t}(d);d.registerComponent("RecordCanvas",c);var h=c;t.default=h,e.exports=t.default},function(e,t,i){"use strict";var r=i(0);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var o=r(i(1)),a=r(i(4)),n=r(i(5)),s=r(i(2)),u=r(i(7)),l=r(i(6)),d=r(i(3)),c=d.default.getComponent("Button"),h=d.default.getComponent("Component"),p=function(e){function t(){return(0,o.default)(this,t),(0,n.default)(this,(0,s.default)(t).apply(this,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,u.default)((0,s.default)(t.prototype),"show",this).call(this)}}]),t}(c);p.prototype.controlText_="Device",h.registerComponent("DeviceButton",p);var f=p;t.default=f,e.exports=t.default},function(e,t,i){"use strict";var r=i(0);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var o=r(i(1)),a=r(i(4)),n=r(i(5)),s=r(i(2)),u=r(i(7)),l=r(i(6)),d=r(i(3)),c=r(i(8)),h=d.default.getComponent("Button"),p=d.default.getComponent("Component"),f=function(e){function t(){return(0,o.default)(this,t),(0,n.default)(this,(0,s.default)(t).apply(this,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,u.default)((0,s.default)(t.prototype),"enable",this).call(this),this.on(this.player_,c.default.START_RECORD,this.onStart),this.on(this.player_,c.default.STOP_RECORD,this.onStop)}},{key:"disable",value:function(){(0,u.default)((0,s.default)(t.prototype),"disable",this).call(this),this.off(this.player_,c.default.START_RECORD,this.onStart),this.off(this.player_,c.default.STOP_RECORD,this.onStop)}},{key:"show",value:function(){this.layoutExclude&&!0===this.layoutExclude||(0,u.default)((0,s.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(c.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}(h);f.prototype.controlText_="Image",p.registerComponent("CameraButton",f);var y=f;t.default=y,e.exports=t.default},function(e,t,i){"use strict";var r=i(0);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var o=r(i(1)),a=r(i(4)),n=r(i(5)),s=r(i(2)),u=r(i(7)),l=r(i(6)),d=r(i(3)),c=r(i(8)),h=d.default.getComponent("Button"),p=d.default.getComponent("Component"),f=function(e){function t(){return(0,o.default)(this,t),(0,n.default)(this,(0,s.default)(t).apply(this,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,u.default)((0,s.default)(t.prototype),"enable",this).call(this),this.on(this.player_,c.default.START_RECORD,this.onStart),this.on(this.player_,c.default.STOP_RECORD,this.onStop)}},{key:"disable",value:function(){(0,u.default)((0,s.default)(t.prototype),"disable",this).call(this),this.off(this.player_,c.default.START_RECORD,this.onStart),this.off(this.player_,c.default.STOP_RECORD,this.onStop)}},{key:"show",value:function(){this.layoutExclude&&!0===this.layoutExclude||(0,u.default)((0,s.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}(h);f.prototype.controlText_="Record",p.registerComponent("RecordToggle",f);var y=f;t.default=y,e.exports=t.default},function(e,t,i){"use strict";var r=i(0);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var o=r(i(1)),a=r(i(4)),n=r(i(5)),s=r(i(2)),u=r(i(7)),l=r(i(6)),d=r(i(3)),c=r(i(8)),h=d.default.getComponent("Component"),p=function(e){function t(e,i){var r;return(0,o.default)(this,t),(r=(0,n.default)(this,(0,s.default)(t).call(this,e,i))).enable(),r}return(0,l.default)(t,e),(0,a.default)(t,[{key:"createEl",value:function(){var e={"data-label":this.localize("REC")};return(0,u.default)((0,s.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_,c.default.START_RECORD,this.show),this.on(this.player_,c.default.STOP_RECORD,this.hide)}},{key:"disable",value:function(){this.off(this.player_,c.default.START_RECORD,this.show),this.off(this.player_,c.default.STOP_RECORD,this.hide)}},{key:"show",value:function(){this.layoutExclude&&!0===this.layoutExclude||(0,u.default)((0,s.default)(t.prototype),"show",this).call(this)}}]),t}(h);h.registerComponent("RecordIndicator",p);var f=p;t.default=f,e.exports=t.default},function(e,t,i){"use strict";var r=i(0);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var o=r(i(26)),a=r(i(28)),n=r(i(1)),s=r(i(4)),u=r(i(5)),l=r(i(2)),d=r(i(7)),c=r(i(6)),h=r(i(3)),p=r(i(8)),f=h.default.getComponent("Button"),y=h.default.getComponent("Component"),v=function(e){function t(e,i){var r;return(0,n.default)(this,t),(r=(0,u.default)(this,(0,l.default)(t).call(this,e,i))).on(r.player_,p.default.ENTER_PIP,r.onStart),r.on(r.player_,p.default.LEAVE_PIP,r.onStop),r}var i;return(0,c.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,d.default)((0,l.default)(t.prototype),"show",this).call(this)}},{key:"handleClick",value:(i=(0,a.default)(o.default.mark((function e(t){var i;return o.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i=this.player_.record(),this.disable(),e.prev=2,i.mediaElement===document.pictureInPictureElement){e.next=8;break}return e.next=6,i.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 i.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}(f);v.prototype.controlText_="Picture in Picture",y.registerComponent("PictureInPictureToggle",v);var g=v;t.default=g,e.exports=t.default},function(e,t,i){e.exports=i(27)},function(e,t,i){var r=function(e){"use strict";var t,i=Object.prototype,r=i.hasOwnProperty,o="function"==typeof Symbol?Symbol:{},a=o.iterator||"@@iterator",n=o.asyncIterator||"@@asyncIterator",s=o.toStringTag||"@@toStringTag";function u(e,t,i,r){var o=t&&t.prototype instanceof y?t:y,a=Object.create(o.prototype),n=new A(r||[]);return a._invoke=function(e,t,i){var r=d;return function(o,a){if(r===h)throw new Error("Generator is already running");if(r===p){if("throw"===o)throw a;return S()}for(i.method=o,i.arg=a;;){var n=i.delegate;if(n){var s=D(n,i);if(s){if(s===f)continue;return s}}if("next"===i.method)i.sent=i._sent=i.arg;else if("throw"===i.method){if(r===d)throw r=p,i.arg;i.dispatchException(i.arg)}else"return"===i.method&&i.abrupt("return",i.arg);r=h;var u=l(e,t,i);if("normal"===u.type){if(r=i.done?p:c,u.arg===f)continue;return{value:u.arg,done:i.done}}"throw"===u.type&&(r=p,i.method="throw",i.arg=u.arg)}}}(e,i,n),a}function l(e,t,i){try{return{type:"normal",arg:e.call(t,i)}}catch(e){return{type:"throw",arg:e}}}e.wrap=u;var d="suspendedStart",c="suspendedYield",h="executing",p="completed",f={};function y(){}function v(){}function g(){}var m={};m[a]=function(){return this};var E=Object.getPrototypeOf,R=E&&E(E(I([])));R&&R!==i&&r.call(R,a)&&(m=R);var O=g.prototype=y.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){var t;this._invoke=function(i,o){function a(){return new Promise((function(t,a){!function t(i,o,a,n){var s=l(e[i],e,o);if("throw"!==s.type){var u=s.arg,d=u.value;return d&&"object"==typeof d&&r.call(d,"__await")?Promise.resolve(d.__await).then((function(e){t("next",e,a,n)}),(function(e){t("throw",e,a,n)})):Promise.resolve(d).then((function(e){u.value=e,a(u)}),(function(e){return t("throw",e,a,n)}))}n(s.arg)}(i,o,t,a)}))}return t=t?t.then(a,a):a()}}function D(e,i){var r=e.iterator[i.method];if(r===t){if(i.delegate=null,"throw"===i.method){if(e.iterator.return&&(i.method="return",i.arg=t,D(e,i),"throw"===i.method))return f;i.method="throw",i.arg=new TypeError("The iterator does not provide a 'throw' method")}return f}var o=l(r,e.iterator,i.arg);if("throw"===o.type)return i.method="throw",i.arg=o.arg,i.delegate=null,f;var a=o.arg;return a?a.done?(i[e.resultName]=a.value,i.next=e.nextLoc,"return"!==i.method&&(i.method="next",i.arg=t),i.delegate=null,f):a:(i.method="throw",i.arg=new TypeError("iterator result is not an object"),i.delegate=null,f)}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 i=e[a];if(i)return i.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,n=function i(){for(;++o<e.length;)if(r.call(e,o))return i.value=e[o],i.done=!1,i;return i.value=t,i.done=!0,i};return n.next=n}}return{next:S}}function S(){return{value:t,done:!0}}return v.prototype=O.constructor=g,g.constructor=v,g[s]=v.displayName="GeneratorFunction",e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===v||"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,i,r,o){var a=new b(u(t,i,r,o));return e.isGeneratorFunction(i)?a:a.next().then((function(e){return e.done?e.value:a.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 i in e)t.push(i);return t.reverse(),function i(){for(;t.length;){var r=t.pop();if(r in e)return i.value=r,i.done=!1,i}return i.done=!0,i}},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 i in this)"t"===i.charAt(0)&&r.call(this,i)&&!isNaN(+i.slice(1))&&(this[i]=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 i=this;function o(r,o){return s.type="throw",s.arg=e,i.next=r,o&&(i.method="next",i.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=r.call(n,"catchLoc"),l=r.call(n,"finallyLoc");if(u&&l){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(!l)throw new Error("try statement without catch or finally");if(this.prev<n.finallyLoc)return o(n.finallyLoc)}}}},abrupt:function(e,t){for(var i=this.tryEntries.length-1;i>=0;--i){var o=this.tryEntries[i];if(o.tryLoc<=this.prev&&r.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,f):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),f},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var i=this.tryEntries[t];if(i.finallyLoc===e)return this.complete(i.completion,i.afterLoc),C(i),f}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var i=this.tryEntries[t];if(i.tryLoc===e){var r=i.completion;if("throw"===r.type){var o=r.arg;C(i)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,i,r){return this.d