12 |
- (function(){"use strict";var e={118:function(e,t,o){var n=o(5471),r=function(){var e=this,t=e._self._c;return t("div",{staticClass:"ffmpeg"},[t("input",{attrs:{type:"file",accept:"video/mp4"},on:{change:e.onFileChange}}),t("button",{attrs:{disabled:!e.videoFile},on:{click:function(t){return e.extractAudio()}}},[e._v("提取音频")]),e.audioUrl?t("audio",{attrs:{src:e.audioUrl,controls:""}}):e._e()])},i=[],a=(o(4603),o(7566),o(8721),o(8375)),u=o.n(a);const{createFFmpeg:c,fetchFile:s}=u(),l=c({corePath:"./ffmpeg-core.js",log:!0});var p={data(){return{videoFile:null,audioUrl:null}},methods:{async onFileChange(e){this.videoFile=e.target.files[0]},async extractAudio(e){return new Promise((async t=>{try{if(e=e||this.videoFile,!e)return window.parent.postMessage({code:1,msg:"请选择视频文件"},"https://beta.pbl.cocorobo.cn/"),void t({code:1,msg:"请选择视频文件"});l.isLoaded()||await l.load(),l.FS("writeFile","input.mp4",await s(e)),await l.run("-i","input.mp4","-q:a","0","-map","a","output.mp3");const o=l.FS("readFile","output.mp3");let n=new Blob([o.buffer],{type:"audio/mp3"});n.name="output.mp3",this.videoFile&&(this.audioUrl=URL.createObjectURL(n));let r=new File([n],"output.mp3",{type:"audio/mp3"});window.parent.postMessage({code:0,msg:"提取音频成功",file:r},"https://beta.pbl.cocorobo.cn/"),t({file:n})}catch(o){console.log(o),window.parent.postMessage({code:1,msg:"提取音频失败",error:o},"https://beta.pbl.cocorobo.cn/"),t({code:1,msg:"提取音频失败",error:o})}}))}},mounted(){window.addEventListener("message",(e=>{console.log(e);let t=e.data;"extractAudio"===t.type&&this.extractAudio(t.file)}))}},f=p,d=o(1656),v=(0,d.A)(f,r,i,!1,null,"f4706aa4",null),h=v.exports;n.Ay.config.productionTip=!1,new n.Ay({render:e=>e(h)}).$mount("#app")}},t={};function o(n){var r=t[n];if(void 0!==r)return r.exports;var i=t[n]={exports:{}};return e[n].call(i.exports,i,i.exports,o),i.exports}o.m=e,function(){var e=[];o.O=function(t,n,r,i){if(!n){var a=1/0;for(l=0;l<e.length;l++){n=e[l][0],r=e[l][1],i=e[l][2];for(var u=!0,c=0;c<n.length;c++)(!1&i||a>=i)&&Object.keys(o.O).every((function(e){return o.O[e](n[c])}))?n.splice(c--,1):(u=!1,i<a&&(a=i));if(u){e.splice(l--,1);var s=r();void 0!==s&&(t=s)}}return t}i=i||0;for(var l=e.length;l>0&&e[l-1][2]>i;l--)e[l]=e[l-1];e[l]=[n,r,i]}}(),function(){o.n=function(e){var t=e&&e.__esModule?function(){return e["default"]}:function(){return e};return o.d(t,{a:t}),t}}(),function(){o.d=function(e,t){for(var n in t)o.o(t,n)&&!o.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})}}(),function(){o.g=function(){if("object"===typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"===typeof window)return window}}()}(),function(){o.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)}}(),function(){var e={524:0};o.O.j=function(t){return 0===e[t]};var t=function(t,n){var r,i,a=n[0],u=n[1],c=n[2],s=0;if(a.some((function(t){return 0!==e[t]}))){for(r in u)o.o(u,r)&&(o.m[r]=u[r]);if(c)var l=c(o)}for(t&&t(n);s<a.length;s++)i=a[s],o.o(e,i)&&e[i]&&e[i][0](),e[i]=0;return o.O(l)},n=self["webpackChunkvue2_project"]=self["webpackChunkvue2_project"]||[];n.forEach(t.bind(null,0)),n.push=t.bind(null,n.push.bind(n))}();var n=o.O(void 0,[504],(function(){return o(118)}));n=o.O(n)})();
- //# sourceMappingURL=app.5c23ccd0.js.map
|