UNPKG

@e10in/videojs-record

Version:

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

8 lines 3.79 kB
/*! * libvorbis plugin for @e10in/videojs-record * @version 4.4.4 * @see https://github.com/collab-project/videojs-record * @copyright 2014-2021 Collab * @license MIT */ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("video.js")):"function"==typeof define&&define.amd?define("VideojsRecord",["video.js"],t):"object"==typeof exports?exports.VideojsRecord=t(require("video.js")):(e.VideojsRecord=e.VideojsRecord||{},e.VideojsRecord.libvorbis=t(e.videojs))}(self,(function(e){return t={1506:e=>{e.exports=function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}},4575:e=>{e.exports=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}},3913:e=>{function t(e,t){for(var o=0;o<t.length;o++){var n=t[o];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}e.exports=function(e,o,n){return o&&t(e.prototype,o),n&&t(e,n),e}},9754:e=>{function t(o){return e.exports=t=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},t(o)}e.exports=t},2205:(e,t,o)=>{var n=o(9489);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&&n(e,t)}},5318:e=>{e.exports=function(e){return e&&e.__esModule?e:{default:e}}},8585:(e,t,o)=>{var n=o(8),r=o(1506);e.exports=function(e,t){return!t||"object"!==n(t)&&"function"!=typeof t?r(e):t}},9489:e=>{function t(o,n){return e.exports=t=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},t(o,n)}e.exports=t},8:e=>{function t(o){return"function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?e.exports=t=function(e){return typeof e}:e.exports=t=function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},t(o)}e.exports=t},3180:(e,t,o)=>{"use strict";var n=o(5318);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=n(o(4575)),i=n(o(3913)),u=n(o(2205)),s=n(o(8585)),c=n(o(9754)),a=n(o(4390));function f(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var o,n=(0,c.default)(e);if(t){var r=(0,c.default)(this).constructor;o=Reflect.construct(n,arguments,r)}else o=n.apply(this,arguments);return(0,s.default)(this,o)}}var p=function(e){(0,u.default)(o,e);var t=f(o);function o(e,n){var i;return(0,r.default)(this,o),(i=t.call(this,e,n)).debug=!1,i.sampleRate=32e3,i}return(0,i.default)(o,[{key:"setup",value:function(e,t,o){this.inputStream=e,this.mediaType=t,this.debug=o,this.options={audioBitsPerSecond:this.sampleRate}}},{key:"start",value:function(){this.chunks=[],this.engine=new VorbisMediaRecorder(this.inputStream,this.options),this.engine.ondataavailable=this.onData.bind(this),this.engine.onstop=this.onRecordingAvailable.bind(this),this.engine.start()}},{key:"stop",value:function(){try{this.engine.stop()}catch(e){}}},{key:"onData",value:function(e){this.chunks.push(e.data)}},{key:"onRecordingAvailable",value:function(){var e=new Blob(this.chunks,{type:this.chunks[0].type});this.chunks=[],this.onStopRecording(e)}}]),o}(a.default.getComponent("RecordEngine"));a.default.LibVorbisEngine=p;var l=p;t.default=l,e.exports=t.default},4390:t=>{"use strict";t.exports=e}},o={},function e(n){var r=o[n];if(void 0!==r)return r.exports;var i=o[n]={exports:{}};return t[n](i,i.exports,e),i.exports}(3180);var t,o}));