5***@qq.com
5***@qq.com
  • 发布:2019-01-20 19:44
  • 更新:2019-01-21 18:02
  • 阅读:2855

我感觉是bug,新版本的问题

分类:uni-app

recorderManager.start({format:"mp3"});
我在录音中写了这一串代码,本来在上个版本(1.4.1)打包后录音不报错,然而在最新版(1.5.0)打包后报错,然后我又根据弹出的区配置manifest.json,结果还是不行,我只好切换上一个版本,也就是1.5.0的上一个版本1.4.1结果今天1.4.1直接编译不了,报错Browserslist: caniuse-lite is outdated. Please run next command npm update caniuse-lite browserslist,希望官方解决下

2019-01-20 19:44 1 条评论 负责人:无 分享
已邀请:
2***@qq.com

2***@qq.com

我也遇到相同的问题 帮顶同求,我也是升级成了1.5 主要是1.5的 json结构貌似和网址上说明的json结构略有不同。

  • 5***@qq.com (作者)

    这样吗,您能发一份json过来我对比下吗谢谢

    2019-01-20 21:14

  • 2***@qq.com

    json发在下面了 麻烦看下

    2019-01-20 23:54

DCloud_Android_ST

DCloud_Android_ST

感谢你的反馈! mp3的问题请重新提交云端打包修复此问题。
(遇到相同mp3的问题同学请重新提交云端打包)

5***@qq.com

5***@qq.com (作者)

manifext.json那个配置"plus": {
"distribute": {
"plugins": {
"audio": {
"mp3": {
"description": "Android平台录音支持MP3格式文件"
}
},
//...
},
//...
},
//...
}我这样写过打包不行,然后把“plus”改完“app-plus”打包也不行

DCloud_heavensoft

DCloud_heavensoft

  • 5***@qq.com (作者)

    那个录音打包问题呢,大佬,1.5.0json格式遍历?

    2019-01-20 21:14

  • 5***@qq.com (作者)

    格式变了?不是遍历emm

    2019-01-20 21:36

DCloud_UNI_FXY

DCloud_UNI_FXY

是否可以提供一个简单的测试工程,方便我们测试

5***@qq.com

5***@qq.com (作者)

这次可以测试的简单例子

2***@qq.com

2***@qq.com

{
"name" : "-------",
"appid" : "----",
"description" : "----",
"versionName" : "1.0.0",
"versionCode" : "100",
"transformPx" : true,
"app-plus" : {
/ 5+App特有相关 /
"modules" : {},
/ 模块配置 /
"distribute" : {
/ 应用发布信息 /
"android" : {
/ android打包配置 /
"permissions" : [
"<uses-feature android:name=\"android.hardware.camera\"/>",
"<uses-feature android:name=\"android.hardware.camera.autofocus\"/>",
"<uses-permission android:name=\"android.permission.ACCESS_COARSE_LOCATION\"/>",
"<uses-permission android:name=\"android.permission.ACCESS_FINE_LOCATION\"/>",
"<uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\"/>",
"<uses-permission android:name=\"android.permission.ACCESS_WIFI_STATE\"/>",
"<uses-permission android:name=\"android.permission.CALL_PHONE\"/>",
"<uses-permission android:name=\"android.permission.CAMERA\"/>",
"<uses-permission android:name=\"android.permission.CHANGE_NETWORK_STATE\"/>",
"<uses-permission android:name=\"android.permission.CHANGE_WIFI_STATE\"/>",
"<uses-permission android:name=\"android.permission.FLASHLIGHT\"/>",
"<uses-permission android:name=\"android.permission.GET_ACCOUNTS\"/>",
"<uses-permission android:name=\"android.permission.MODIFY_AUDIO_SETTINGS\"/>",
"<uses-permission android:name=\"android.permission.MOUNT_UNMOUNT_FILESYSTEMS\"/>",
"<uses-permission android:name=\"android.permission.READ_CONTACTS\"/>",
"<uses-permission android:name=\"android.permission.READ_LOGS\"/>",
"<uses-permission android:name=\"android.permission.READ_PHONE_STATE\"/>",
"<uses-permission android:name=\"android.permission.READ_SMS\"/>",
"<uses-permission android:name=\"android.permission.RECORD_AUDIO\"/>",
"<uses-permission android:name=\"android.permission.SEND_SMS\"/>",
"<uses-permission android:name=\"android.permission.VIBRATE\"/>",
"<uses-permission android:name=\"android.permission.WAKE_LOCK\"/>",
"<uses-permission android:name=\"android.permission.WRITE_CONTACTS\"/>",
"<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>",
"<uses-permission android:name=\"android.permission.WRITE_SMS\"/>"
]
},
"ios" : {},
/ ios打包配置 /
"sdkConfigs" : {}
}
},
/ SDK配置 /
"quickapp" : {},
/ 快应用特有相关 /
"mp-weixin" : {
/ 小程序特有相关 /
"appid" : "",
"setting" : {
"urlCheck" : true
}
}
}

  • 5***@qq.com (作者)

    好的谢谢,我json也是这样

    2019-01-20 23:56

  • 5***@qq.com (作者)

    我直接改格式acc了 没用MP3打包就没那问题了

    2019-01-21 03:47

  • 2***@qq.com

    我是做的公众号相关,音频不支持acc,uini-app貌似又播放不了amr....

    2019-01-21 10:24

5***@qq.com

5***@qq.com (作者)

例子

5***@qq.com

5***@qq.com (作者)

<template>
<view>
<page-head :title="title"></page-head>
<view class="uni-padding-wrap">
<block v-if="!recording && !playing && !hasRecord">
<view class="page-body-time">
<text class="time-big">{{formatedRecordTime}}</text>
</view>
<view class="page-body-buttons">
<view class="page-body-button"></view>
<view class="page-body-button" @click="startRecord">
<image src="../../../static/record.png"></image>
</view>
<view class="page-body-button"></view>
</view>
</block>
<block v-if="recording === true">
<view class="page-body-time">
<text class="time-big">{{formatedRecordTime}}</text>
</view>
<view class="page-body-buttons">
<view class="page-body-button"></view>
<view class="page-body-button" @click="stopRecord">
<view class="button-stop-record"></view>
</view>
<view class="page-body-button"></view>
</view>
</block>
<block v-if="hasRecord === true && playing === false">
<view class="page-body-time">
<text class="time-big">{{formatedPlayTime}}</text>
<text class="time-small">{{formatedRecordTime}}</text>
</view>
<view class="page-body-buttons">
<view class="page-body-button"></view>
<view class="page-body-button" @click="playVoice">
<image src="../../../static/play.png"></image>
</view>
<view class="page-body-button" @click="clear">
<image src="../../../static/trash.png"></image>
</view>
</view>
</block>
<block v-if="hasRecord === true && playing === true">
<view class="page-body-time">
<text class="time-big">{{formatedPlayTime}}</text>
<text class="time-small">{{formatedRecordTime}}</text>
</view>
<view class="page-body-buttons">
<view class="page-body-button" @click="stopVoice">
<image src="../../../static/stop.png"></image>
</view>
<view class="page-body-button" @click="clear">
<image src="../../../static/trash.png"></image>
</view>
</view>
</block>
</view>
</view>
</template>
<script>
var util = require('../../../common/util.js')
var playTimeInterval = null;
var recordTimeInterval = null;
var recorderManager = null;
var music = null;
export default {
data() {
return {
title: 'start/stopRecord、play/stopVoice',
recording: false, //录音中
playing: false, //播放中
hasRecord: false, //是否有了一个
tempFilePath: '',
recordTime: 0,
playTime: 0,
formatedRecordTime: '00:00:00', //录音的总时间
formatedPlayTime: '00:00:00' //播放录音的当前时间
}
},
onUnload: function() {
this.end();
},
onLoad: function() {
music = uni.createInnerAudioContext();
music.onEnded(() => {
clearInterval(playTimeInterval)
var playTime = 0
console.log('play voice finished')
this.playing = false;
this.formatedPlayTime = util.formatTime(playTime);
this.playTime = playTime;
});
recorderManager = uni.getRecorderManager();
recorderManager.onStart(() => {
console.log('recorder start');
});
recorderManager.onStop((res) => {
console.log('on stop');
music.src = res.tempFilePath;

            this.hasRecord = true;  
            this.recording = false;  
        });  
    },  
    methods: {  
        startRecord() { //开始录音  
            this.recording = true;  

            recordTimeInterval = setInterval(() => {  
                this.recordTime += 1;  
                this.formatedRecordTime = util.formatTime(this.recordTime);  
            }, 1000)  

            recorderManager.start({  
                format:"mp3"  
            });  
        },  
        stopRecord() { //停止录音  
            recorderManager.stop();  
            clearInterval(recordTimeInterval);  
        },  
        playVoice() {  
            console.log('play voice');  
            playTimeInterval = setInterval(() => {  
                this.playing = true;  
                this.playTime += 1;  
                this.formatedPlayTime = util.formatTime(this.playTime);  
            }, 1000)  
            music.play();  
        },  
        stopVoice() {  
            clearInterval(playTimeInterval)  
            this.playing = false;  
            this.formatedPlayTime = util.formatTime(0);  
            this.playTime = 0;  
            music.stop();  
        },  
        end() {  
            music.stop();  
            recorderManager.stop();  
            clearInterval(recordTimeInterval)  
            clearInterval(playTimeInterval);  
            this.recording = false, this.playing = false, this.hasRecord = false;  
            this.playTime = 0, this.recordTime = 0;  
            this.formatedRecordTime = "00:00:00", this.formatedRecordTime = "00:00:00";  
        },  
        clear() {  
            this.end();  
        }  
    }  
}  

</script>

<style>
image {
width: 150upx;
height: 150upx;
}

.page-body-wrapper {  
    justify-content: space-between;  
    flex-grow: 1;  
    margin-bottom: 300upx;  
}  

.page-body-time {  
    display: flex;  
    flex-direction: column;  
    align-items: center;  
}  

.time-big {  
    font-size: 60upx;  
    margin: 20upx;  
}  

.time-small {  
    font-size: 30upx;  
}  

.page-body-buttons {  
    margin-top: 60upx;  
    display: flex;  
    justify-content: space-around;  
}  

.page-body-button {  
    width: 250upx;  
    text-align: center;  
}  

.button-stop-record {  
    width: 110upx;  
    height: 110upx;  
    border: 20upx solid #fff;  
    background-color: #f55c23;  
    border-radius: 130upx;  
    margin: 0 auto;  
}  

</style>

5***@qq.com

5***@qq.com (作者)

直接用的官方uni-app那个有接口的录音例子测得,改了一个参数recorderManager.start({
format:"mp3"
});然后打包就会报我反映的错误,希望官方解决下,真的是bug,配置啥plus也不行唉唉

2***@qq.com

2***@qq.com

打包测试了 没问题了

该问题目前已经被锁定, 无法添加新回复