详细问题描述
ios真机,创建audioplayer对象,调用api方法isPaused(),返回null.
[内容]
重现步骤
[步骤]
uniapp项目
this.palyer = plus.audio.createPlayer({
"autoplay": false,
"title": "title",
"coverImgUrl": "http://113.108.157.90:8088/resource/lesson/1558853548932.jpg",
"backgroundControl": true,
"epname":"epname",
"singer": "singer",
"src": "http://113.108.157.90:8088/resource/lesson/mp3/lesson/1558853662545.mp3",
"startTime": 0,
"volume": 1,
})
console.log(this.palyer.isPaused())
[结果]
null
[期望]
期望返回正确的状态值
IDE运行环境说明
[HBuilder 或 HBuilderX。如果你用其他工具开发uni-app,也需要在此说明]
[IDE版本号]
HBuilderX 1.9.9
[windows版本号]
win10
[mac版本号]
uni-app运行环境说明
[运行端是h5或app或某个小程序?]
ios真机运行
[运行端版本号]
1.9.9
[项目是cli创建的还是HBuilderX创建的?如果是cli创建的,请更新到最新版cli再试]
HBuilderX创建空uniapp项目
[编译模式是老模板模式还是新的自定义组件模式?]
自定义组件模式
App运行环境说明
[Android版本号]
[iOS版本号]
ios版本 12.1.4(16D57)
[手机型号]
iphone6
[模拟器型号]
真机
附件
[IDE问题请提供HBuilderX运行日志。菜单帮助-查看运行日志,点右键打开文件所在目录,将log文件压缩成zip包上传]
[App问题请提供可重现问题的代码片段,你补充的细一点,问题就解决的快一点]
[App安装包或H5地址]
ios安装包地址 https://fir.im/brandmaxtestios?release_id=5cedf364548b7a7178e7a8bf
[可重现代码片段]
<template>
<view class="content">
<button @tap="play" type="default" class="login-btn">播放</button>
<button @tap="pause" type="default" class="login-btn">暂停</button>
<button @tap="info" type="default" class="login-btn">状态</button>
<view style="width: 100%;" v-for="(devitem,devitemindex) in devmsg" :key="devitemindex">
<text>方法:{{devitem.method}}</text>
<text v-show="devitem.msg">消息:{{devitem.msg}}</text>
</view>
</view>
</template>
<script>
export default {
data() {
return {
srcList: [],
player:undefined,
devmsg: []
}
},
onLoad() {
this.palyer = plus.audio.createPlayer({
"autoplay": false,
"title": "title",
"coverImgUrl": "http://113.108.157.90:8088/resource/lesson/1558853548932.jpg",
"backgroundControl": true,
"epname":"epname",
"singer": "singer",
"src": "http://113.108.157.90:8088/resource/lesson/mp3/lesson/1558853662545.mp3",
"startTime": 0,
"volume": 1,
})
this.palyer.addEventListener("canplay",this._onCanplay);
this.palyer.addEventListener("play",this._onPlay);
this.palyer.addEventListener("pause",this._onPause);
this.palyer.addEventListener("stop",this._onStop);
this.palyer.addEventListener("ended",this._onEnded);
this.palyer.addEventListener("error",this._onError);
this.palyer.addEventListener("waiting",this._onWaiting);
this.palyer.addEventListener("seeking",this._onSeeking);
this.palyer.addEventListener("seeked",this._onSeeked);
},
methods: {
addDevMsg(methodname, msg) {
this.devmsg.push({
"method": methodname,
"msg": msg
})
},
play(){
this.palyer.play();
},
pause(){
this.palyer.pause();
},
resume(){
},
stop(){
}
,
seekTo(){
},
info(){
this.addDevMsg('info()',"getBuffered:"+this.palyer.getBuffered()+","+"getDuration:"+this.palyer.getDuration()+","+"getPosition:"+this.palyer.getPosition()+","+"isPaused:"+this.palyer.isPaused())
},
_onCanplay(){
this.addDevMsg('_onCanplay()')
},_onPlay(){
this.addDevMsg('_onPlay()')
},_onPause(){
this.addDevMsg('_onPause()')
},_onStop(){
this.addDevMsg('_onStop()')
},_onEnded(){
this.addDevMsg('_onEnded()')
},_onError(){
this.addDevMsg('_onError()')
},_onWaiting(){
this.addDevMsg('_onWaiting()')
},_onSeeking(){
this.addDevMsg('_onSeeking()')
},_onSeeked(){
this.addDevMsg('_onSeeked()')
}
}
}
</script>
<style>
.content {
text-align: center;
height: 400upx;
}
.logo {
height: 200upx;
width: 200upx;
margin-top: 200upx;
}
.title {
font-size: 36upx;
color: #8f8f94;
}
</style>
联系方式
[QQ]
123905778
1 个回复
前端大白 - 前端攻城狮
遇到一样的问题