今天在华为nova 4e 型号MAR-AL00 安卓9版本测试, 调用录音api时,app闪退了,但是在小米手机测试,不会出现,使用的老模板模式编译模式,代码如下:

语音描述(录音时长最大为10分钟)

删除录音

{{

isRecord === 0?'点击录制':'录制中'

}}

{{

timing+(isRecord == 2?' 点击播放':' 正在播放')

}}

const soundRecords = uni.getRecorderManager();

const innerAudioContext = uni.createInnerAudioContext();

innerAudioContext.autoplay = true;

let timer = null;

let minutes = 0;

let seconds = 0;

import { mapGetters } from 'vuex';

export default {

data() {

return {

timing: '0分0秒',

text: '',

isRecord: 0,

iconPath: '../../static/record/startrecord@3x.png',

voicePath: '',

time: 0,

isPlay: false

};

},

computed: {

...mapGetters(['getToken'])

},

mounted() {

console.log("1111")

},

onLoad() {

// this.$http.gettonken(this.getToken);

},

watch: {

"voicePath"(newValue) {

if(newValue){

console.log(this.time);

console.log(this.voicePath);

let voice = {

voicePath: newValue,

time: this.time

}

this.$emit("input",voice)

}

}

},

mounted(){

soundRecords.onStop(res => {

console.log(this.time);

clearTimeout(timer);

if(res.tempFilePath){

this.voicePath = res.tempFilePath

console.log(this.voicePath);

}else{

console.log("这里测试是否为空");

}

console.log('res: ' + JSON.stringify(res));

});

innerAudioContext.onEnded(() => {

this.isRecord = 2;

this.iconPath = '../../static/record/startplay@3x.png';

this.isPlay = false;

// this.timing = `0分0秒`;

});

},

methods: {

catchMove(){

return ;

},

onDeleteTap() {

this.voicePath = '';

this.timing = '0分0秒';

this.isRecord = 0;

minutes = 0;

seconds = 0;

this.isPlay = false;

this.iconPath= '../../static/record/startrecord@3x.png'

this.$modal({

title: "提示",

content: "删除成功",

showCancel: false

})

},

onToggleRecordStatusTap() {

switch (this.isRecord) {

case 0:

this.onStartRecordTap();

this.iconPath = '../../static/record/stoprecord@3x.png';

break;

case 1:

this.onStopRecordTap();

this.iconPath = '../../static/record/startplay@3x.png';

break;

case 2:

if(!this.isPlay){

this.isPlay = true;

this.onPlayRecordTap();

this.iconPath = '../../static/record/stopplay@3x.png';

}else{

this.toast("正在播放,请勿重复点击")

}

break;

}

},

onStartRecordTap() {

console.log('1: ');

soundRecords.start({

format: 'mp3'

});

this.isRecord = 1;

this.getTiming();

},

getTiming() {

if (this.isRecord == 1) {

if (minutes == 10 && seconds == 0) {

clearTimeout(timer);

minutes = 0;

seconds = 0;

} else {

this.time +=1;

console.log(this.time);

if (seconds == 59) {

seconds = 0;

minutes += 1;

} else {

seconds += 1;

}

this.timing = `${this.formatFull(minutes)}分${this.formatFull(seconds)}秒`;

timer = setTimeout(() => {

console.log(11);

this.getTiming();

}, 1000);

}

}

},

onStopRecordTap() {

soundRecords.stop();

console.log(this.time);

this.isRecord = 2;

},

onPlayRecordTap() {

if(this.isPlay){

this.toast("正在播放,请勿重复点击")

return ;

}

this.isPlay = true;

if (this.voicePath) {

// this.isRecord = 3;

innerAudioContext.src = this.voicePath;

innerAudioContext.onPlay(() => {

console.log('开始播放');

});

}else{

console.log('res: ' + this.voicePath);

}

}

}

};

.record-index {

height: 200upx;

width: 100%;

background: #ffffff;

}

/* .billow{

width: 6upx;

height: 16upx;

display: inline-block;

background: #66CC99;

position: absolute;top: 50%;transform: translateY(-50%);

animation: play 1.8s linear infinite;

border-radius: 3upx;

}

.billow1{

height: 20upx;

animation-delay: .8s;

}

.billow2{

height: 56upx;

animation-delay: 1s;

}

.billow3{

height: 50upx;

animation-delay: 1.2s;

}

.billow4{

height: 40upx;

animation-delay: 1.4s;

}

.billow5{

height: 30upx;

animation-delay: 1.6s;

}

.billow6{

height: 16upx;

animation-delay: 1.8s;

}

@keyframes play{

0% {

height: 20upx;

}

16% {

height: 56upx;

}

32% {

height: 50upx;

}

48% {

height: 40upx;

}

54% {

height: 30upx;

}

80% {

height: 16upx;

}

100% {

height: 20upx;

}

} */

android录音程序闪退,【报Bug】调用录音时,app闪退了相关推荐

  1. android 9 qq登录,【报Bug】安卓离线打包targetSdkVersion设置28时,在安卓9.0手机上QQ授权登录闪退...

    详细问题描述 [内容] 安卓离线打包,targetSdkVersion设置为28,在安卓9.0手机上运行,下面这段QQ授权登录代码会导致应用闪退或应用重启.低于9.0系统的手机不会出现这个问题.如果t ...

  2. android横向展示状态,【报Bug】Android横屏状态下启动App,即使在App.vue中锁定竖屏,但是首页nvue中的rpx单位是按照启动的横竖屏状态显示的!...

    详细问题描述 (DCloud产品不会有明显的bug,所以你遇到的问题大都是在特定环境下才能重现的问题,请仔细描述你的环境和重现方式,否则DCloud很难排查解决你的问题) [内容] 重现步骤 [步骤] ...

  3. android本地socket正常,【报Bug】Android 本地打包 websocket 出错

    详细问题描述 1.代码websocket在基座(android,ios)能够正常运行. 打包到android本地,websocket连接出错 Caused by: java.lang.NoClassD ...

  4. ios 上传图片失败 小程序_【报Bug】百度小程序真机IOS无法上传图片

    详细问题描述 (DCloud产品不会有明显的bug,所以你遇到的问题大都是在特定环境下才能重现的问题,请仔细描述你的环境和重现方式,否则DCloud很难排查解决你的问题) [内容] 在百度小程序开发者 ...

  5. android+iphone+共用字体,【报Bug】苹果和安卓手机 字体大小颜色字重都一样 效果却不同...

    详细问题描述 (DCloud产品不会有明显的bug,所以你遇到的问题大都是在特定环境下才能重现的问题,请仔细描述你的环境和重现方式,否则DCloud很难排查解决你的问题) [内容] 重现步骤 [步骤] ...

  6. android 小米imei 空,【报Bug】小米9获取imei为空

    详细问题描述 (DCloud产品不会有明显的bug,所以你遇到的问题大都是在特定环境下才能重现的问题,请仔细描述你的环境和重现方式,否则DCloud很难排查解决你的问题) [内容] 重现步骤 小米9在 ...

  7. Android A4尺寸 canvas,【报Bug】canvas绘制尺寸比较大的图片时,会出现绘制不出来的问题...

    详细问题描述 canvas绘制尺寸比较大,像素比较高的图片时,会出现绘制不出来的问题 (DCloud产品不会有明显的bug,所以你遇到的问题大都是在特定环境下才能重现的问题,请仔细描述你的环境和重现方 ...

  8. android平板 竖屏,【报Bug】Android平板横屏底部有白边

    详细问题描述 (DCloud产品不会有明显的bug,所以你遇到的问题大都是在特定环境下才能重现的问题,请仔细描述你的环境和重现方式,否则DCloud很难排查解决你的问题) [内容] 重现步骤 [步骤] ...

  9. android 5开机卡,【报Bug】安卓5.1.1一直卡在启动页,不能进入主页

    详细问题描述 (DCloud产品不会有明显的bug,所以你遇到的问题大都是在特定环境下才能重现的问题,请仔细描述你的环境和重现方式,否则DCloud很难排查解决你的问题) [内容] 重现步骤 [步骤] ...

  10. android richtext显示html,【报Bug】关于rich-text显示html 的问题

    详细问题描述(DCloud产品不会有明显的bug,所以你遇到的问题大都是在特定环境下才能重现的问题,请仔细描述你的环境和重现方式,否则DCloud很难排查解决你的问题) [内容] 我分别在真机和微信开 ...

最新文章

  1. 需求管理(3)------方法论
  2. mdpi的手机_【初印象】Android手机屏幕适配API:nodpi,xhdpi,hdpi,mdpi,ldpi
  3. 2018年中国C++大会详细日程+报名
  4. python后端框架flask_Vue+Flask轻量级前端、后端框架,如何完美同步开发
  5. Bootstrap3 列表元素的样式
  6. 十二月十六日鸿蒙,华为12月16日举行鸿蒙 2.0 手机开发者Beta活动,分享鸿蒙OS2.0设计理念...
  7. [PyTorch] 基于Python和PyTorch的MNIST的手写数字数据集的分类
  8. MATLAB2017a安装破解教程
  9. java方面的文献综述怎么写_java论文参考文献
  10. Vue + element + Springboot 通过邮箱找回密码
  11. Discuz模板安装步骤以及发生的问题
  12. CSS学习03:CSS文本属性
  13. 复无法自动修复此计算机,win10自动修复而且无法重置
  14. html(h5)页面实现微信js分享
  15. 计算机总出现安全警报如何处理,打开文件出现安全警告怎么取消?
  16. LeetCode.191:关于十进制与二进制的浅薄理解
  17. idea提示未找到包,实际上包存在 问题解决
  18. MASM32 v11 汇编、连接及运行程序的方法
  19. UI自动化测试如何去实现无头模式必踩的坑
  20. 【matlab报错】错误使用 graph.validateEdgeProperties (第 375 行) 边属性必须为表。

热门文章

  1. 使用天地图 报错Uncaught TypeError: Cannot read property '_tdt_events' of null
  2. mybatis一级缓存和二级缓存的区别?
  3. linux性能调优看这篇就懂,[转载]Linux性能调优
  4. 企企通入选《高质量数字化转型产品及服务全景图》,助力行业数智化高质量发展
  5. Taptic Engine初探
  6. [区块链] 如何在Corda上写一个派发股息的Dapp
  7. 基于VB.NET的NX UG软件二次开发基础
  8. vasp phonopy消除虚频个人经验总结
  9. java种List和Array的相互转换
  10. Android的原生态开发和非原生态开发