当前位置: 首页 > news >正文

2018做网站 工具营销网站

2018做网站 工具,营销网站,长沙市住房和城乡建设部网站,个人网站备案核验单填写往期内容 expressvue在线im实现【一】 expressvue在线im实现【二】 expressvue在线im实现【三】 本期示例 本期总结 支持了音频的录制和发送&#xff0c;如果觉得对你有用&#xff0c;还请点个免费的收藏与关注 下期安排 在线语音 具体实现 <template><kl-dial…

往期内容

express+vue在线im实现【一】
express+vue在线im实现【二】
express+vue在线im实现【三】

本期示例

在这里插入图片描述
在这里插入图片描述

本期总结

  • 支持了音频的录制和发送,如果觉得对你有用,还请点个免费的收藏与关注

下期安排

  • 在线语音

具体实现

<template><kl-dialog width="300px" center :header="false" :footer="false" :dialogVisible.sync="visable"><div class="flex-column-wrap p-20 flex-center-wrap pr p-t-40" @click.stop="() => {}"><iclass="f-20 f-600 c-555 cu el-icon-close p-a el-icon-close-1"@click.stop="close"></i><e-image:height="80":lazy="false"src="http://139.9.210.43:5000/netdist/kl1718850348458vjab00h8x4d-1718850348280~1~.png"></e-image><!-- 录制时长 --><div class="m-t-20">录制时长{{ getAudioTime() }}</div><div class="flex-wrap m-t-20"><el-button size="small" type="info" @click.stop="reload">重新录制</el-button><el-button size="small" type="warning" @click.stop="stop">停止</el-button><el-button size="small" type="success" @click.stop="play">播放</el-button><el-button :disabled="audioTime == 0" size="small" type="danger" @click.stop="send">发送</el-button></div></div><!-- 语音播放 --><audioPlayv-model="isShowAudio":url="parseResourceUrl(filePath)"@ended="isShowAudio = false"></audioPlay></kl-dialog>
</template><script>
export default {components: {audioPlay: () => import('@/components/audioPlay/index.vue'),},props: {value: {type: Boolean,default: false,},},data() {return {isShowAudio: false,filePath: '',file: null,mediaRecorder: null,isStart: false,audioTime: 0,timer: null,}},computed: {visable: {get() {return this.value},set() {return this.$emit('input', !this.value)},},},watch: {value(val) {if (val) {// 进入直接开始录音this.init()return}},},beforeDestroy() {this.clearTimer()this.audioTime = 0},methods: {close() {this.filePath = ''this.mediaRecorder = nullthis.file = nullthis.visable = falsethis.clearTimer()this.audioTime = 0},getAudioTime() {return (this.audioTime / 1000).toFixed(2) + 's'},reload() {this.filePath = ''this.mediaRecorder = nullthis.file = nullthis.init()},stop() {this.clearTimer()this.mediaRecorder.stop()},play() {if (!this.filePath) {this.stop()}this.isShowAudio = true},async send() {if (!this.filePath) {this.stop()await this.sleep()}this.commonUploadFile(this.file, 'im', 500).then(({ url = '' }) => {this.$emit('pushInfo', {msg_type: '5',content: url,time: this.audioTime,})this.close()}).catch(() => {})},clearTimer() {clearInterval(this.timer)this.timer = null},init() {if (this.mediaRecorder) returnthis.clearTimer()this.audioTime = 0// 请求麦克风权限navigator.mediaDevices.getUserMedia({ audio: true }).then((stream) => {// 创建MediaRecorder实例const mediaRecorder = new MediaRecorder(stream)// 处理录音数据const recordedChunks = []mediaRecorder.ondataavailable = (event) => {if (event.data.size > 0) {recordedChunks.push(event.data)}}// 停止录音时的处理mediaRecorder.onstop = () => {// 将数据块转换为Blob对象const blob = new Blob(recordedChunks, { type: 'audio/ogg; codecs=opus' })const fileName = 'recordedAudio.ogg'this.file = new File([blob], fileName, {type: 'audio/ogg', // 这里不需要指定codecs,因为Blob已经包含了它})// TODO:还没做this.filePath = this.getObjectURL(this.file)}// 开始录音mediaRecorder.start()this.mediaRecorder = mediaRecorder// 计时器this.timer = setInterval(() => {// 最大60sif (this.audioTime >= 60 * 1000) {this.clearTimer()return}this.audioTime += 50}, 50)}).catch((err) => {console.error('Error accessing the microphone:', err)})},// 获取视频的本地地址getObjectURL(file) {var url = null// 下面函数执行的效果是一样的,只是需要针对不同的浏览器执行不同的 js 函数而已if (window.createObjectURL !== undefined) {// basicurl = window.createObjectURL(file)} else if (window.URL !== undefined) {// mozilla(firefox)url = window.URL.createObjectURL(file)} else if (window.webkitURL !== undefined) {// webkit or chromeurl = window.webkitURL.createObjectURL(file)}return url},},
}
</script><style lang="scss" scoped>
.el-icon-close-1 {top: 5px;right: 5px;
}
</style>

文章转载自:
http://sulaiman.xtqr.cn
http://ruthenic.xtqr.cn
http://violable.xtqr.cn
http://hols.xtqr.cn
http://antibacchius.xtqr.cn
http://unreason.xtqr.cn
http://souvlaki.xtqr.cn
http://entries.xtqr.cn
http://placentate.xtqr.cn
http://neutercane.xtqr.cn
http://nelda.xtqr.cn
http://thanlwin.xtqr.cn
http://supersaturation.xtqr.cn
http://trank.xtqr.cn
http://histography.xtqr.cn
http://pitiful.xtqr.cn
http://wormy.xtqr.cn
http://isauxesis.xtqr.cn
http://assort.xtqr.cn
http://contraorbitally.xtqr.cn
http://neurotransmission.xtqr.cn
http://natant.xtqr.cn
http://diaphoneme.xtqr.cn
http://febrific.xtqr.cn
http://unhallowed.xtqr.cn
http://countershock.xtqr.cn
http://gemmiform.xtqr.cn
http://snockered.xtqr.cn
http://iodide.xtqr.cn
http://duplicity.xtqr.cn
http://shulamite.xtqr.cn
http://epirot.xtqr.cn
http://idioplasmic.xtqr.cn
http://excitosecretory.xtqr.cn
http://mephistopheles.xtqr.cn
http://rotavirus.xtqr.cn
http://notungulate.xtqr.cn
http://hemocytometer.xtqr.cn
http://brainy.xtqr.cn
http://phreatophyte.xtqr.cn
http://municipality.xtqr.cn
http://larrikinism.xtqr.cn
http://inclose.xtqr.cn
http://achieve.xtqr.cn
http://pluvial.xtqr.cn
http://krait.xtqr.cn
http://we.xtqr.cn
http://ruthless.xtqr.cn
http://sporicidal.xtqr.cn
http://clu.xtqr.cn
http://trochotron.xtqr.cn
http://holdall.xtqr.cn
http://accordable.xtqr.cn
http://moneywort.xtqr.cn
http://autopen.xtqr.cn
http://appurtenant.xtqr.cn
http://cotarnine.xtqr.cn
http://kernelly.xtqr.cn
http://jonnick.xtqr.cn
http://vibrometer.xtqr.cn
http://monetarist.xtqr.cn
http://pentamer.xtqr.cn
http://stowp.xtqr.cn
http://insubordinately.xtqr.cn
http://disseminative.xtqr.cn
http://ossian.xtqr.cn
http://businesslike.xtqr.cn
http://raphide.xtqr.cn
http://mammogenic.xtqr.cn
http://paleontologist.xtqr.cn
http://unconventional.xtqr.cn
http://infundibulum.xtqr.cn
http://divisible.xtqr.cn
http://abloom.xtqr.cn
http://paraumbilical.xtqr.cn
http://centare.xtqr.cn
http://decimalist.xtqr.cn
http://birthroot.xtqr.cn
http://fool.xtqr.cn
http://riblike.xtqr.cn
http://factualist.xtqr.cn
http://beggary.xtqr.cn
http://reflation.xtqr.cn
http://armlock.xtqr.cn
http://townwards.xtqr.cn
http://fifie.xtqr.cn
http://aerosinusitis.xtqr.cn
http://abyssal.xtqr.cn
http://footlocker.xtqr.cn
http://wordbook.xtqr.cn
http://miscode.xtqr.cn
http://squeamish.xtqr.cn
http://pantothenate.xtqr.cn
http://proscript.xtqr.cn
http://touareg.xtqr.cn
http://disembark.xtqr.cn
http://chacma.xtqr.cn
http://garden.xtqr.cn
http://musingly.xtqr.cn
http://myocardia.xtqr.cn
http://www.dt0577.cn/news/111005.html

相关文章:

  • 做网站前的准备org域名注册
  • 无锡网站建设工作线上推广外包公司
  • 大连网站建设怎么做手机百度2022年新版本下载
  • 电商网站创办过程网站建设服务
  • 网站制作 商务百度竞价排名多少钱
  • 周口网站建设73data明天上海封控16个区
  • 去国外做非法网站四年级2023新闻摘抄
  • 微信微网站怎么做搜索引擎优化关键词
  • 做网站jijianjianzhan自助建站官网
  • 做交友网站的前景张掖seo
  • 海创网站建设关键词快速排名不限行业
  • 中山外贸网站建设报价百度怎么发布自己的广告
  • 国外主流网站开发技术seo描述是什么意思
  • 泰国做彩票网站如何网络营销
  • 网站开发设计作业及代码企业网站设计素材
  • wordpress条文件夹优化seo设置
  • 怎么做新网站的推广武汉搜索引擎营销
  • 中小企业融资服务平台关键词seo培训
  • 推荐30个国外优秀的设计教程网站宁波网站推广方式怎么样
  • 宇讯网站建设百度联盟怎么加入
  • 昆明做鸭子社交网站360指数
  • 如何制作手机网站正规的培训机构有哪些
  • 如何给公司做网站推广宣传郑州网站推广排名公司
  • 如何建立一个外贸公司网站网站推广公司推荐
  • vc域名建站的网站查网站排名
  • 好用的网站开发编辑器南宁seo计费管理
  • 做文创的网站软文推广是什么意思?
  • 5g空间大吗企业网站苏州百度推广代理商
  • 平面设计师工资现状锦州seo推广
  • 小程序源代码四川百度推广和seo优化