Commit 4e11ae05 by xiaowenfeng

1、微课制课工具1.0

parent ce6a7c38
module.exports = { module.exports = {
presets: [ presets: [
'@vue/cli-plugin-babel/preset' '@vue/cli-plugin-babel/preset'
],
env: {
development: {
plugins: ['dynamic-import-node']
}
},
plugins: [
[
'component', {
libraryName: 'mint-ui',
style: true
}
], ['import', {
libraryName: 'view-design',
libraryDirectory: 'src/components'
}]
] ]
} }
...@@ -8,8 +8,24 @@ ...@@ -8,8 +8,24 @@
"lint": "vue-cli-service lint" "lint": "vue-cli-service lint"
}, },
"dependencies": { "dependencies": {
"ali-oss": "^6.11.2",
"axios": "^0.20.0",
"babel-plugin-import": "^1.13.0",
"core-js": "^3.6.5", "core-js": "^3.6.5",
"vue": "^2.6.11" "js-audio-recorder": "^1.0.6",
"kim-vue-touch": "^1.1.5",
"lamejs": "^1.2.0",
"mint-ui": "^2.2.13",
"reveal.js": "^4.0.2",
"spark-md5": "^3.0.1",
"swiper": "^6.2.0",
"vconsole": "^3.3.4",
"view-design": "^4.3.2",
"vue": "^2.6.11",
"vue-awesome-swiper": "^4.1.0",
"vue-cli": "^2.9.6",
"vue-progress-circle": "^1.1.0",
"vue-router": "^3.4.3"
}, },
"devDependencies": { "devDependencies": {
"@vue/cli-plugin-babel": "~4.5.0", "@vue/cli-plugin-babel": "~4.5.0",
...@@ -17,6 +33,8 @@ ...@@ -17,6 +33,8 @@
"@vue/cli-service": "~4.5.0", "@vue/cli-service": "~4.5.0",
"@vue/eslint-config-standard": "^5.1.2", "@vue/eslint-config-standard": "^5.1.2",
"babel-eslint": "^10.1.0", "babel-eslint": "^10.1.0",
"babel-plugin-component": "^1.1.1",
"babel-plugin-dynamic-import-node": "^2.3.3",
"eslint": "^6.7.2", "eslint": "^6.7.2",
"eslint-plugin-import": "^2.20.2", "eslint-plugin-import": "^2.20.2",
"eslint-plugin-node": "^11.1.0", "eslint-plugin-node": "^11.1.0",
......
No preview for this file type
...@@ -3,7 +3,8 @@ ...@@ -3,7 +3,8 @@
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0"> <meta name="viewport" content="width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0,user-scalable=0">
<!-- <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no, viewport-fit=cover"> -->
<link rel="icon" href="<%= BASE_URL %>favicon.ico"> <link rel="icon" href="<%= BASE_URL %>favicon.ico">
<title><%= htmlWebpackPlugin.options.title %></title> <title><%= htmlWebpackPlugin.options.title %></title>
</head> </head>
......
<template> <template>
<div id="app"> <div id="app">
<img alt="Vue logo" src="./assets/logo.png"> <router-view></router-view>
<HelloWorld msg="Welcome to Your Vue.js App"/>
</div> </div>
</template> </template>
<script> <script>
import HelloWorld from './components/HelloWorld.vue' // import VConsole from 'vconsole/dist/vconsole.min.js'
// const vConsole = new VConsole()
// console.log('vConsole:', vConsole)
export default { export default {
name: 'App',
components: {
HelloWorld
}
} }
</script> </script>
<style lang="scss"> <style lang="scss">
#app { @import url("./css/common.css");
font-family: Avenir, Helvetica, Arial, sans-serif; html {
-webkit-font-smoothing: antialiased; font-size: 100px;
-moz-osx-font-smoothing: grayscale;
text-align: center;
color: #2c3e50;
margin-top: 60px;
} }
</style> </style>
<template>
<div class="hello">
<h1>{{ msg }}</h1>
<p>
For a guide and recipes on how to configure / customize this project,<br>
check out the
<a href="https://cli.vuejs.org" target="_blank" rel="noopener">vue-cli documentation</a>.
</p>
<h3>Installed CLI Plugins</h3>
<ul>
<li><a href="https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-babel" target="_blank" rel="noopener">babel</a></li>
<li><a href="https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-eslint" target="_blank" rel="noopener">eslint</a></li>
</ul>
<h3>Essential Links</h3>
<ul>
<li><a href="https://vuejs.org" target="_blank" rel="noopener">Core Docs</a></li>
<li><a href="https://forum.vuejs.org" target="_blank" rel="noopener">Forum</a></li>
<li><a href="https://chat.vuejs.org" target="_blank" rel="noopener">Community Chat</a></li>
<li><a href="https://twitter.com/vuejs" target="_blank" rel="noopener">Twitter</a></li>
<li><a href="https://news.vuejs.org" target="_blank" rel="noopener">News</a></li>
</ul>
<h3>Ecosystem</h3>
<ul>
<li><a href="https://router.vuejs.org" target="_blank" rel="noopener">vue-router</a></li>
<li><a href="https://vuex.vuejs.org" target="_blank" rel="noopener">vuex</a></li>
<li><a href="https://github.com/vuejs/vue-devtools#vue-devtools" target="_blank" rel="noopener">vue-devtools</a></li>
<li><a href="https://vue-loader.vuejs.org" target="_blank" rel="noopener">vue-loader</a></li>
<li><a href="https://github.com/vuejs/awesome-vue" target="_blank" rel="noopener">awesome-vue</a></li>
</ul>
</div>
</template>
<script>
export default {
name: 'HelloWorld',
props: {
msg: String
}
}
</script>
<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped lang="scss">
h3 {
margin: 40px 0 0;
}
ul {
list-style-type: none;
padding: 0;
}
li {
display: inline-block;
margin: 0 10px;
}
a {
color: #42b983;
}
</style>
<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" >
<!--
2013-9-30: Created.
-->
<svg>
<metadata>
Created by iconfont
</metadata>
<defs>
<font id="iconfont" horiz-adv-x="1024" >
<font-face
font-family="iconfont"
font-weight="500"
font-stretch="normal"
units-per-em="1024"
ascent="896"
descent="-128"
/>
<missing-glyph />
<glyph glyph-name="fanhui" unicode="&#58961;" d="M771.988-51.44l-403.54 405.135c-15.95 15.95-15.95 43.065 0 60.61l406.73 406.73c17.545 15.95 19.14 43.065 3.19 60.61C770.393 891.215 759.228 896 746.468 896s-23.926-4.785-31.901-14.355l-9.57-9.57-457.77-459.365c-15.95-15.95-15.95-43.065 0-60.61l467.34-467.34c7.975-7.975 17.545-12.76 28.71-12.76 23.925 0 43.066 19.14 43.066 41.47 1.595 14.356-4.785 27.116-14.355 35.09z" horiz-adv-x="1024" />
</font>
</defs></svg>
@font-face {
font-family: 'iconfont';
src: url('./fonts/iconfont.eot');
src: url('./fonts/iconfont.eot?#iefix') format('embedded-opentype'),
url('./fonts/iconfont.woff2') format('woff2'),
url('./fonts/iconfont.woff') format('woff'),
url('./fonts/iconfont.ttf') format('truetype'),
url('./fonts/iconfont.svg#iconfont') format('svg');
}
@font-face {
font-family: 'iconfont';
src: url('./backfont/iconfont.eot');
src: url('./backfont/iconfont.eot?#iefix') format('embedded-opentype'),
url('./backfont/iconfont.woff2') format('woff2'),
url('./backfont/iconfont.woff') format('woff'),
url('./backfont/iconfont.ttf') format('truetype'),
url('./backfont/iconfont.svg#iconfont') format('svg');
}
.iconfont {
font-family: "iconfont" !important;
font-size: 16px;
font-style: normal;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
\ No newline at end of file
<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" >
<!--
2013-9-30: Created.
-->
<svg>
<metadata>
Created by iconfont
</metadata>
<defs>
<font id="iconfont" horiz-adv-x="1024" >
<font-face
font-family="iconfont"
font-weight="500"
font-stretch="normal"
units-per-em="1024"
ascent="896"
descent="-128"
/>
<missing-glyph />
<glyph glyph-name="htmal5icon13" unicode="&#58926;" d="M703.109596 407.222911c0-112.022353-93.352131-190.437284-197.905372-190.437284s-197.906395 78.414931-197.906395 190.437284l-63.478753 0c0-126.95853 100.82022-231.512794 224.044706-250.183016l0-123.224486 74.680886 0 0 123.224486c123.224486 18.670222 224.044706 123.224486 224.044706 250.183016L703.109596 407.222911zM505.204224 295.201581c63.478753 0 112.022353 48.543599 112.022353 112.022353l0 224.044706c0 63.479777-48.543599 112.022353-112.022353 112.022353-63.479777 0-112.022353-48.543599-112.022353-112.022353l0-224.044706C393.181871 343.744157 441.724447 295.201581 505.204224 295.201581z" horiz-adv-x="1024" />
<glyph glyph-name="htmal5icon15" unicode="&#58927;" d="M766.589372 407.222911l-63.479777 0c0-26.13831-7.468089-52.27662-14.936177-74.680886l44.809555-44.808532C755.386216 321.339892 766.589372 362.414379 766.589372 407.222911zM617.225553 399.755846c0 3.734044 0 3.734044 0 7.468089l0 224.044706c0 63.479777-48.543599 112.022353-112.022353 112.022353-63.479777 0-112.022353-48.543599-112.022353-112.022353l0-7.468089L617.225553 399.755846zM217.679741 705.949526l-48.542576-48.542576 224.043682-224.044706 0-26.13831c0-63.478753 48.543599-112.022353 112.022353-112.022353 7.468089 0 14.936177 0 26.13831 3.734044l63.479777-63.478753c-26.13831-11.202133-56.010665-18.670222-85.884043-18.670222-104.554264 0-197.905372 78.414931-197.905372 190.437284l-67.213821 0c0-126.95853 100.82022-231.512794 224.044706-250.183016l0-123.224486 74.680886 0 0 123.224486c33.606399 3.734044 67.213821 18.670222 93.352131 33.606399l156.830885-156.830885 48.543599 48.543599L217.679741 705.949526z" horiz-adv-x="1024" />
<glyph glyph-name="bofang" unicode="&#58963;" d="M852.727563 503.552893C956.997809 437.526365 956.941389 330.440483 852.727563 264.44968L281.888889-97.019655C177.618644-163.046186 93.090909-120.054114 93.090909-1.137364L93.090909 769.139937C93.090909 888.120794 177.675064 931.013033 281.888889 865.022231L852.727563 503.552893 852.727563 503.552893Z" horiz-adv-x="1024" />
<glyph glyph-name="bofang1" unicode="&#59262;" d="M222.521003 731.670328l0-694.317349 543.891338 347.158674L222.521003 731.670328M178.355107 831.752744c5.207605 0 10.549264-1.178849 15.644305-3.729951l681.693844-416.160211c23.359011-11.698436 23.359011-43.00956 0-54.707996L193.999412-59.006649c-5.096065-2.543939-10.437723-3.715625-15.644305-3.715625-17.382902 0-33.235962 13.025665-33.235962 31.079856L145.119145 800.664701C145.118122 818.711729 160.956855 831.752744 178.355107 831.752744L178.355107 831.752744z" horiz-adv-x="1024" />
<glyph glyph-name="zanting" unicode="&#59005;" d="M379.337561 777.651568 145.347343 777.651568c-8.113795 0-16.247033-3.097548-22.444175-9.295714-6.197142-6.1777-9.295714-14.309914-9.295714-22.424732l0-729.759559c0-8.094352 3.098571-16.22759 9.295714-22.424732 6.197142-6.176676 14.33038-9.276271 22.444175-9.276271l233.990219 0c8.113795 0 16.247033 3.098571 22.444175 9.276271 6.1777 6.197142 9.275247 14.33038 9.275247 22.424732l0 729.760582c0 8.112772-3.098571 16.247033-9.275247 22.424732C395.584594 774.552997 387.451356 777.651568 379.337561 777.651568L379.337561 777.651568zM897.531634 768.356878c-6.197142 6.197142-14.33038 9.295714-22.444175 9.295714L641.09724 777.652592c-8.113795 0-16.247033-3.098571-22.444175-9.295714-6.196119-6.1777-9.295714-14.31196-9.295714-22.424732l0-729.759559c0-8.094352 3.099594-16.22759 9.295714-22.424732 6.197142-6.176676 14.33038-9.275247 22.444175-9.275247l233.990219 0c8.113795 0 16.247033 3.098571 22.444175 9.275247 6.197142 6.197142 9.275247 14.33038 9.275247 22.424732L906.806881 745.932146C906.806881 754.045941 903.727753 762.178155 897.531634 768.356878L897.531634 768.356878z" horiz-adv-x="1024" />
<glyph glyph-name="ico_meiyoushuju" unicode="&#58882;" d="M409.073-4.723l-263.213-0.137c-11.371 0-23.996 1.375-32.172 11.783-4.158 5.273-6.94 22.192-6.94 33.838V794.9c0.276 2.644 2.37 20.25 12.625 30.506 14.565 14.565 25.524 16.92 27.45 17.194h406.894v-108.85c-0.153-5.685 0.275-42.717 21.489-66.987 19.563-22.314 50.482-33.976 53.951-35.23l4.432-1.65 144.094-0.153v-129.94l45.484-35.076c2.644-2.644 5.273-5.41 7.764-8.055V690.757L598.238 896H145.844c-5.257 0-32.997-1.528-64.19-32.86C56.13 837.617 53.637 801.12 53.485 797.115v-755.65c-0.153-7.642 0.55-44.522 18.156-67.126a80.667 80.667 0 0 1 43.406-28.58c13.45-3.73 25.11-3.73 30.796-3.73l359.042 0.138a315.606 315.606 0 0 0-63.518 28.275l-32.325 24.835zM606.965 817.228L758.823 683.13l-115.513 0.138c-7.642 3.316-20.817 10.255-28.168 18.585-5.808 6.648-8.314 22.467-8.314 31.193l0.153 84.182z m351.156-871.882a42.55 42.55 0 0 0 0.153-59.912 42.672 42.672 0 0 0-29.956-12.334 42.443 42.443 0 0 0-29.956 12.35L767.305 16.49a277.596 277.596 0 0 0-165.17-54.226c-153.936 0-279.17 125.234-279.17 279.17 0 153.936 125.234 279.307 279.17 279.307 153.937 0 279.155-125.233 279.155-279.17 0-61.715-20.113-118.845-54.226-165.17l131.057-131.04z m-355.985 85.71c116.078 0 210.516 94.453 210.516 210.516 0 116.08-94.453 210.516-210.516 210.516-116.08 0-210.516-94.452-210.516-210.516 0-116.079 94.437-210.516 210.516-210.516z" horiz-adv-x="1024" />
<glyph glyph-name="gengxin" unicode="&#58884;" d="M887.4 485.4l-61.8-16.6c30.3-112.7-2.1-233.9-84.5-316.3-127.5-127.5-334.8-127.5-462.3 0-61.7 61.7-95.7 143.8-95.7 231.1 0 87.3 34 169.4 95.7 231.1 82.4 82.4 203.5 114.8 316.2 84.5L580.4 645l147.4 52.6L626.5 816.8l-14.9-55.7c-65.1 17.5-134.1 17.8-199.4 1-67.4-17.4-129.1-52.7-178.6-102.1-37.3-37.3-66.2-80.8-85.9-129.3-19-46.8-28.6-96.3-28.6-147.1s9.6-100.2 28.6-147.1c19.7-48.5 48.6-92 85.9-129.3 37.3-37.3 80.8-66.2 129.3-85.9 46.8-19 96.3-28.6 147.1-28.6s100.2 9.6 147.1 28.6c48.5 19.7 92 48.6 129.3 85.9 49.4 49.4 84.8 111.2 102.1 178.6 16.8 65.4 16.4 134.4-1.1 199.6z" horiz-adv-x="1024" />
<glyph glyph-name="Error" unicode="&#59111;" d="M853.333333 810.666667c56.8832 0 85.333333-28.450133 85.333334-85.333334v-85.333333H85.333333v85.333333c0 56.8832 28.450133 85.333333 85.333334 85.333334h682.666666z m-512-85.333334c0 11.946667-4.266667 22.186667-12.8 30.72-7.970133 7.970133-17.92 11.946667-29.866666 11.946667s-22.186667-3.976533-30.72-11.946667c-7.970133-8.533333-11.946667-18.773333-11.946667-30.72s3.976533-21.896533 11.946667-29.866666c8.533333-8.533333 18.773333-12.8 30.72-12.8s21.896533 4.266667 29.866666 12.8c8.533333 7.970133 12.8 17.92 12.8 29.866666z m115.2-29.866666c8.533333 7.970133 12.8 17.92 12.8 29.866666s-4.266667 22.186667-12.8 30.72c-7.970133 7.970133-17.92 11.946667-29.866666 11.946667s-22.186667-3.976533-30.72-11.946667c-7.970133-8.533333-11.946667-18.773333-11.946667-30.72s3.976533-21.896533 11.946667-29.866666c8.533333-8.533333 18.773333-12.8 30.72-12.8s21.896533 4.266667 29.866666 12.8z m86.186667-597.333334c-7.970133-8.533333-17.92-12.8-29.866667-12.8s-22.186667 4.266667-30.72 12.8c-7.970133 7.970133-11.946667 17.92-11.946666 29.866667s3.976533 22.186667 11.946666 30.72c8.533333 7.9872 18.773333 11.946667 30.72 11.946667s21.896533-3.959467 29.866667-11.946667c8.533333-8.533333 12.8-18.773333 12.8-30.72s-4.266667-21.896533-12.8-29.866667zM170.666667 768c-11.946667 0-22.186667-3.976533-30.72-11.946667-7.970133-8.533333-11.946667-18.773333-11.946667-30.72s3.976533-21.896533 11.946667-29.866666c8.533333-8.533333 18.773333-12.8 30.72-12.8s21.896533 4.266667 29.866666 12.8c8.533333 7.970133 12.8 17.92 12.8 29.866666s-4.266667 22.186667-12.8 30.72c-7.970133 7.970133-17.92 11.946667-29.866666 11.946667zM853.333333-59.733333H170.666667c-66.030933 0-102.4 36.369067-102.4 102.4V725.333333c0 66.030933 36.369067 102.4 102.4 102.4h682.666666c66.030933 0 102.4-36.369067 102.4-102.4v-682.666666c0-66.030933-36.369067-102.4-102.4-102.4zM102.4 622.933333v-580.266666c0-47.223467 21.0432-68.266667 68.266667-68.266667h682.666666c47.223467 0 68.266667 21.0432 68.266667 68.266667V622.933333H102.4z m0 34.133334h819.2v68.266666c0 47.223467-21.0432 68.266667-68.266667 68.266667H170.666667c-47.223467 0-68.266667-21.0432-68.266667-68.266667v-68.266666zM512.853333 232.106667a34.133333 34.133333 0 0 0-34.133333 34.133333V503.466667a34.133333 34.133333 0 0 0 68.266667 0v-237.226667a34.133333 34.133333 0 0 0-34.133334-34.133333z" horiz-adv-x="1024" />
<glyph glyph-name="zanting1" unicode="&#58894;" d="M304 720h80v-672h-80z m408 0h-64c-4.4 0-8-3.6-8-8v-656c0-4.4 3.6-8 8-8h64c4.4 0 8 3.6 8 8V712c0 4.4-3.6 8-8 8z" horiz-adv-x="1024" />
<glyph glyph-name="tianjia" unicode="&#58964;" d="M992 416H544V864a32 32 0 0 1-64 0v-448H32a32 32 0 0 1 0-64h448v-448a32 32 0 0 1 64 0V352h448a32 32 0 0 1 0 64z" horiz-adv-x="1024" />
</font>
</defs></svg>
/* eslint-disable */
//notation: js file can only use this kind of comments
//since comments will cause error when use in webview.loadurl,
//comments will be remove by java use regexp
(function() {
if (window.WebViewJavascriptBridge) {
return;
}
var receiveMessageQueue = [];
var messageHandlers = {};
var responseCallbacks = {};
var uniqueId = 1;
//set default messageHandler 初始化默认的消息线程
function init(messageHandler) {
if (WebViewJavascriptBridge._messageHandler) {
throw new Error('WebViewJavascriptBridge.init called twice');
}
WebViewJavascriptBridge._messageHandler = messageHandler;
var receivedMessages = receiveMessageQueue;
receiveMessageQueue = null;
for (var i = 0; i < receivedMessages.length; i++) {
_dispatchMessageFromNative(receivedMessages[i]);
}
}
// 发送
function send(data, responseCallback) {
_doSend('send', data, responseCallback);
}
// 注册线程 往数组里面添加值
function registerHandler(handlerName, handler) {
messageHandlers[handlerName] = handler;
}
// 调用线程
function callHandler(handlerName, data, responseCallback) {
_doSend(handlerName, data, responseCallback);
}
//sendMessage add message, 触发native处理 sendMessage
function _doSend(handlerName, message, responseCallback) {
var callbackId;
if(typeof responseCallback === 'string'){
callbackId = responseCallback;
} else if (responseCallback) {
callbackId = 'cb_' + (uniqueId++) + '_' + new Date().getTime();
responseCallbacks[callbackId] = responseCallback;
}else{
callbackId = '';
}
try {
var fn = eval('window.android.' + handlerName);
} catch(e) {
console.log(e);
}
if (typeof fn === 'function'){
var responseData = fn.call(this, JSON.stringify(message), callbackId);
if(responseData){
console.log('response message: '+ responseData);
responseCallback = responseCallbacks[callbackId];
if (!responseCallback) {
return;
}
responseCallback(responseData);
delete responseCallbacks[callbackId];
}
}
}
//提供给native使用,
function _dispatchMessageFromNative(messageJSON) {
setTimeout(function() {
var message = JSON.parse(messageJSON);
var responseCallback;
//java call finished, now need to call js callback function
if (message.responseId) {
responseCallback = responseCallbacks[message.responseId];
if (!responseCallback) {
return;
}
responseCallback(message.responseData);
delete responseCallbacks[message.responseId];
} else {
//直接发送
if (message.callbackId) {
var callbackResponseId = message.callbackId;
responseCallback = function(responseData) {
_doSend('response', responseData, callbackResponseId);
};
}
var handler = WebViewJavascriptBridge._messageHandler;
if (message.handlerName) {
handler = messageHandlers[message.handlerName];
}
//查找指定handler
try {
handler(message.data, responseCallback);
} catch (exception) {
if (typeof console != 'undefined') {
console.log("WebViewJavascriptBridge: WARNING: javascript handler threw.", message, exception);
}
}
}
});
}
//提供给native调用,receiveMessageQueue 在会在页面加载完后赋值为null,所以
function _handleMessageFromNative(messageJSON) {
console.log('handle message: '+ messageJSON);
if (receiveMessageQueue) {
receiveMessageQueue.push(messageJSON);
}
_dispatchMessageFromNative(messageJSON);
}
var WebViewJavascriptBridge = window.WebViewJavascriptBridge = {
init: init,
send: send,
registerHandler: registerHandler,
callHandler: callHandler,
_handleMessageFromNative: _handleMessageFromNative
};
var doc = document;
var readyEvent = doc.createEvent('Events');
readyEvent.initEvent('WebViewJavascriptBridgeReady');
readyEvent.bridge = WebViewJavascriptBridge;
doc.dispatchEvent(readyEvent);
})();
\ No newline at end of file
import lamejs from 'lamejs'
function convertToMp3 (recorder, recorderConfig) {
// 获取wav头信息
const { numChannels: channels, sampleRate } = recorderConfig
const mp3enc = new lamejs.Mp3Encoder(channels, sampleRate, 128)
// 获取左右通道数据
const result = recorder.getChannelData()
const buffer = []
const leftData = result.left && new Int16Array(result.left.buffer, 0, result.left.byteLength / 2)
const rightData = result.right && new Int16Array(result.right.buffer, 0, result.right.byteLength / 2)
const remaining = leftData.length + (rightData ? rightData.length : 0)
const maxSamples = 1152
for (let i = 0; i < remaining; i += maxSamples) {
const left = leftData.subarray(i, i + maxSamples)
let right = null
let mp3buf = null
if (channels === 2) {
right = rightData.subarray(i, i + maxSamples)
mp3buf = mp3enc.encodeBuffer(left, right)
} else {
mp3buf = mp3enc.encodeBuffer(left)
}
if (mp3buf.length > 0) {
buffer.push(mp3buf)
}
}
const enc = mp3enc.flush()
if (enc.length > 0) {
buffer.push(enc)
}
return new Blob(buffer, { type: 'audio/mp3' })
}
export default convertToMp3
import Vue from 'vue' import Vue from 'vue'
import App from './App.vue' import App from './App.vue'
import axios from 'axios'
import router from './router'
axios.defaults.baseURL = window.location.origin
Vue.config.productionTip = false Vue.config.productionTip = false
new Vue({ new Vue({
router,
render: h => h(App) render: h => h(App)
}).$mount('#app') }).$mount('#app')
import Vue from 'vue'
import VueRouter from 'vue-router'
Vue.use(VueRouter)
const routes = [
{
path: '/microEdit',
component: () => import(/* webpackChunkName:"name" */'@/components/MicroEdit.vue'),
meta: {
title: '微课编辑'
}
}, {
path: '/microLecturePlay',
component: () => import(/* webpackChunkName:"name" */'@/components/MicroLecturePlay.vue'),
meta: {
title: '微课'
}
}
]
const router = new VueRouter({
routes
})
export default router
module.exports = {
publicPath: process.env.NODE_ENV === 'production' ? './' : '/',
assetsDir: 'static',
outputDir: 'micro-lecture'
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment