更新记录
1.0.1(2025-08-09) 下载此版本
yao-Channel
1.0.0(2025-08-09) 下载此版本
yao-Channel
仿左右耳声道播放
平台兼容性
uni-app(4.07)
Vue2 | Vue3 | Chrome | Safari | app-vue | app-nvue | Android | iOS | 鸿蒙 |
---|---|---|---|---|---|---|---|---|
√ | √ | √ | √ | √ | × | √ | √ | × |
微信小程序 | 支付宝小程序 | 抖音小程序 | 百度小程序 | 快手小程序 | 京东小程序 | 鸿蒙元服务 | QQ小程序 | 飞书小程序 | 快应用-华为 | 快应用-联盟 |
---|---|---|---|---|---|---|---|---|---|---|
× | × | × | × | × | × | × | × | × | × | × |
yao-Channel
说明
插件只是将左右耳的音量变成0,非左右耳声道
示例代码
<template>
<view class="content">
<view class="left" @click="onLeft">切换左声道</view>
<view class="right" @click="onRight">切换右声道</view>
<view class="play" @click="onPlay">播放</view>
<view class="stop" @click="onStop">停止</view>
<yao-Channel
ref="channel"
:channelOption="channelOption"></yao-Channel>
</view>
</template>
<script>
export default {
data() {
return {
channelOption:{
channelType:'left',//声道类型 (left,right)
url:'https://web-ext-storage.dcloud.net.cn/uni-app/ForElise.mp3', //音频地址 (仅支持url地址)
}
}
},
onLoad() {
},
methods: {
//切换左声道
onLeft(){
this.channelOption.channelType='left';
},
//切换右声道
onRight(){
this.channelOption.channelType='right';
},
//播放
onPlay(){
this.$refs.channel.play();
},
onStop(){
this.$refs.channel.stop();
}
}
}
</script>