更新记录
1.0.6(2023-07-25)
下载此版本
日志更新
音频-拖动-倍速-自动播放-兼容ios和安卓
用法
<!-- v-if='mediaId==mediaList[mediaIndex].id'确保切换时组件可以被销毁 -->
<template v-if='mediaId==mediaList[mediaIndex].id'>
<class-audio
:classTitle="classTitle"
:currentMedia="mediaList[mediaIndex]"
:mediaIndex="mediaIndex"
@change="mediaChange"
@durationsChange="durationsChange">
</class-audio>
</template>
export default {
data() {
return {
mediaList:[
{
durations:0,
id: 1341,
title: "音频1",
url: "https://bjetxgzv.cdn.bspapp.com/VKCEYUGU-hello-uniapp/2cc220e0-c27a-11ea-9dfb-6da8e309e0d8.mp3",
viewing_record: 0
},
{
durations: 0,
id: 1342,
title: "音频2",
url: "https://bjetxgzv.cdn.bspapp.com/VKCEYUGU-hello-uniapp/2cc220e0-c27a-11ea-9dfb-6da8e309e0d8.mp3",
viewing_record: 0
},
{
durations: 0,
id: 1343,
title: "音频3",
url: "https://bjetxgzv.cdn.bspapp.com/VKCEYUGU-hello-uniapp/2cc220e0-c27a-11ea-9dfb-6da8e309e0d8.mp3",
viewing_record: 0
}
],
mediaIndex:0,
classTitle:'课程名称',
mediaId:0,
}
},
methods: {
mediaChange(step){
const mindex = this.mediaIndex
if(step === -1 && mindex === 0){
uni.showToast({
title: "当前是第一节哦~",
icon: "none",
});
return;
}
if (step === 1 && mindex === this.mediaList.length - 1) {
uni.showToast({
title: "没有更多了~",
icon: "none",
});
return;
}
this.mediaIndex = mindex+step
this.$nextTick(()=>{
this.mediaId = this.mediaList[this.mediaIndex].id
})
},
durationsChange(params){
const {
durations,
currentMedia,
} = params;
console.log(params,'params')
},
},
}
props
参数名 |
说明 |
类型 |
默认值 |
mediaList |
音频信息 |
{} |
必 |
classTitle |
课程名 |
String |
必 |
@change |
切换上一节下一节 |
function |
@durationsChange |
播放时间记录 |
function |
1.0.5(2023-07-25)
下载此版本
优化onCanplay里面赋值duration赋值问题
音频-拖动-倍速-自动播放-兼容ios和安卓
用法
<!-- v-if='chapterId==chapterList[chapterIndex].id'确保切换时组件可以被销毁 -->
<template v-if='chapterId==chapterList[chapterIndex].id'>
<class-audio
:classTitle="classTitle"
:currentMedia="mediaList[mediaIndex]"
:mediaIndex="mediaIndex"
@change="mediaChange"
@durationsChange="durationsChange">
</class-audio>
</template>
export default {
data() {
return {
mediaList:[
{
durations:0,
id: 1341,
title: "音频1",
url: "https://bjetxgzv.cdn.bspapp.com/VKCEYUGU-hello-uniapp/2cc220e0-c27a-11ea-9dfb-6da8e309e0d8.mp3",
viewing_record: 0
},
{
durations: 0,
id: 1342,
title: "音频2",
url: "https://bjetxgzv.cdn.bspapp.com/VKCEYUGU-hello-uniapp/2cc220e0-c27a-11ea-9dfb-6da8e309e0d8.mp3",
viewing_record: 0
},
{
durations: 0,
id: 1343,
title: "音频3",
url: "https://bjetxgzv.cdn.bspapp.com/VKCEYUGU-hello-uniapp/2cc220e0-c27a-11ea-9dfb-6da8e309e0d8.mp3",
viewing_record: 0
}
],
mediaIndex:0,
classTitle:'课程名称',
}
},
methods: {
mediaChange(step){
const mindex = this.mediaIndex
if(step === -1 && mindex === 0){
uni.showToast({
title: "当前是第一节哦~",
icon: "none",
});
return;
}
if (step === 1 && mindex === this.mediaList.length - 1) {
uni.showToast({
title: "没有更多了~",
icon: "none",
});
return;
}
this.mediaIndex = mindex+step
},
durationsChange(params){
const {
durations,
currentMedia,
} = params;
console.log(params,'params')
},
},
}
props
参数名 |
说明 |
类型 |
默认值 |
mediaList |
音频信息 |
{} |
必 |
classTitle |
课程名 |
String |
必 |
@change |
切换上一节下一节 |
function |
@durationsChange |
播放时间记录 |
function |
1.0.4(2023-07-24)
下载此版本
优化报错
查看更多
平台兼容性
App |
快应用 |
微信小程序 |
支付宝小程序 |
百度小程序 |
字节小程序 |
QQ小程序 |
× |
× |
√ |
× |
× |
√ |
× |
钉钉小程序 |
快手小程序 |
飞书小程序 |
京东小程序 |
× |
× |
× |
× |
H5-Safari |
Android Browser |
微信浏览器(Android) |
QQ浏览器(Android) |
Chrome |
IE |
Edge |
Firefox |
PC-Safari |
√ |
√ |
√ |
√ |
√ |
√ |
× |
× |
× |
音频-拖动-倍速-自动播放-兼容ios和安卓
用法
<!-- v-if='mediaId==mediaList[mediaIndex].id'确保切换时组件可以被销毁 -->
<template v-if='mediaId==mediaList[mediaIndex].id'>
<class-audio
:classTitle="classTitle"
:currentMedia="mediaList[mediaIndex]"
:mediaIndex="mediaIndex"
@change="mediaChange"
@durationsChange="durationsChange">
</class-audio>
</template>
export default {
data() {
return {
mediaList:[
{
durations:0,
id: 1341,
title: "音频1",
url: "https://bjetxgzv.cdn.bspapp.com/VKCEYUGU-hello-uniapp/2cc220e0-c27a-11ea-9dfb-6da8e309e0d8.mp3",
viewing_record: 0
},
{
durations: 0,
id: 1342,
title: "音频2",
url: "https://bjetxgzv.cdn.bspapp.com/VKCEYUGU-hello-uniapp/2cc220e0-c27a-11ea-9dfb-6da8e309e0d8.mp3",
viewing_record: 0
},
{
durations: 0,
id: 1343,
title: "音频3",
url: "https://bjetxgzv.cdn.bspapp.com/VKCEYUGU-hello-uniapp/2cc220e0-c27a-11ea-9dfb-6da8e309e0d8.mp3",
viewing_record: 0
}
],
mediaIndex:0,
mediaId:0,
classTitle:'课程名称',
}
},
onLoad(){
this.mediaId = this.mediaList[this.mediaIndex].id
},
methods: {
mediaChange(step){
const mindex = this.mediaIndex
if(step === -1 && mindex === 0){
uni.showToast({
title: "当前是第一节哦~",
icon: "none",
});
return;
}
if (step === 1 && mindex === this.mediaList.length - 1) {
uni.showToast({
title: "没有更多了~",
icon: "none",
});
return;
}
this.mediaIndex = mindex+step
this.$nextTick(()=>{
this.mediaId = this.mediaList[this.mediaIndex].id
})
},
durationsChange(params){
const {
durations,
currentMedia,
} = params;
console.log(params,'params')
},
},
}
props
参数名 |
说明 |
类型 |
默认值 |
mediaList |
音频信息 |
{} |
必 |
classTitle |
课程名 |
String |
必 |
@change |
切换上一节下一节 |
function |
@durationsChange |
播放时间记录 |
function |