微信小程序进度条组件自定义数字_微信小程序自定义音频组件,自定义滚动条,单曲循环,循环播放...

小程序自定义音频组件,带滚动条

摘要:首先自定义音频组件,是因为产品有这样的需求,需要如下样式的

而微信小程序API给我们提供的就是这样的

而且产品需要小程序有后台播放功能,所以我们不考虑小程序的 audio 组件,即使官方推荐更强大的  wx.createInnerAudioContext 但是不符合需求,所以这里用到的是 backgroundAudioManager()

分析一下:这个页面构成,主要就是进度条和一些icon,进度条之前我自定义了一版,但是效果不理想,最后重构了页面,所以这里用的就是 slider 滑动选择器 https://developers.weixin.qq.com/miniprogram/dev/component/slider.html

audio.wxml

{ {current_process}}

bindchange="hanle_slider_change"

bindtouchstart="handle_slider_move_start"

bindtouchend="handle_slider_move_end"

min="0"

block-size="16"

max="{ {slider_max}}"

activeColor="#fff"

backgroundColor="rgba(255,255,255,.3)"

value="{ {slider_value}}"

/>

{ {total_process}}

滑动事件 bindchange="hanle_slider_change"

开始滑动 bindtouchstart="handle_slider_move_start"

停止滑动 bindtouchend="handle_slider_move_end"

audio.wxss

.audio {

position: relative;

width: 750rpx;

height: 640rpx;

padding: 60rpx 32rpx 52rpx;

box-sizing: border-box;

text-align: center;

overflow: hidden;

background: rgba(0,0,0,.18);

}

.audio .bg {

position: absolute;

top: 0;

left: -100%;

bottom: 0;

right: 0;

margin: auto;

width: 300%;

height: 300%;

z-index: -1;

filter: blur(40rpx);

}

.editor {

padding: 32rpx;

box-sizing: border-box;

color: #333;

font-size: 28rpx;

background: #fff;

}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值