2020-12-17 13:07:28
957
https://demo.ivx.cn/
2025-09-14 16:33:52
bva3fg8rq1iqaq80831g
[{"insert":"封装小程序背景音乐小模块。调用小程序API接口:BackgroundAudioManager\n参考文档:"},{"attributes":{"link":"https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/BackgroundAudioManager.html"},"insert":"https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/BackgroundAudioManager.html"},{"insert":"\n\n自定义函数之后,设置好src属性后,可以实现自动播放\n"},{"attributes":{"width":"434"},"insert":{"image":"//file3.ih5.cn/v35/files/2b277fa0935dd6e01c96f68c6017366c_116859_908_570.png"}},{"insert":"\n\n案例已经封装好“背景音乐”小模块,只需在小程序中添加,使用时给小模块传入相关参数"},{"insert":{"image":"//file3.ih5.cn/v35/files/157816da2ead96a0df7a3ca012e5aef9_1096_163_37.png"}},{"insert":"\n注意音乐地址支持的格式:目前支持的格式有m4a, aac, mp3, wav\n"},{"insert":{"image":"//file3.ih5.cn/v35/files/10c30317834ded6a3c3fdf926d9667ad_23196_963_265.png"}},{"insert":"\n背景音乐如果要循环播放的话,先用onEnded检测音乐自然播放结束的情况,播放完之后,再次给设置自动播放地址为我们的音乐地址即可\n"},{"insert":{"image":"//file3.ih5.cn/v35/files/f5715691a11aa7e4fa7529b2de8e2753_58612_611_183.png"}},{"insert":"\n首次进入小程序之后,音乐会自动播放\n"},{"attributes":{"width":"260"},"insert":{"image":"//file3.ih5.cn/v35/files/8062f19f4a4420be2bff3e31969a8439_19123_505_741.png"}},{"insert":"\n展开图标可以看到设置好的音乐名称,并且可以点击“X”,关闭音乐\n"},{"insert":{"image":"//file3.ih5.cn/v35/files/a071db08e335376b682bca4acc3e4822_22047_508_675.png"}},{"insert":"\n\n手机下拉列表中有已经设置好的音乐的详细信息,可以点击暂停及播放按钮控制音乐的播放状态,也可关闭音乐。\n\n"},{"insert":{"image":"//file3.ih5.cn/v35/files/e414b73c97417effaee5d39a79f751aa_21428_500_124.png"}},{"insert":"\n"}]
[{"insert":"通过这个方法:https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/BackgroundAudioManager.html, 封装一个小模块,可以设置微信小程序的背景音乐。\n"}]
打开小程序实现背景音乐的自动播放,可以对音乐进行暂停、继续播放、关闭操作。背景音乐可以实现自动循环播放。音乐背景小模块中可以对音乐地址等进行设置
微信小程序添加背景音乐
微信小程序添加背景音乐
微信小程序添加背景音乐
2020-12-17 17:50:49
271
null
1
0
24
84163c2b37bdce3d447037ba66f4664f_4770_503_512.png
小程序
吴嘤之
2
0
10558079
3351
534
805
已上架
应用
1
曾国庆
https://file307b34e95cf4.v4.h5sys.cn/play/Is9XWpCw
手机