import{_ as a,b as t,d as e,p as i,w as A,H as l,i as s,o as g,f as n,k as o,t as d,e as u,F as r,v as h,C as c,L as p,D as m}from"./index-2PZN6pGH.js";import{f as b}from"./util.BQsFLuvY.js";import{a as I,_ as C}from"./stop.Bbaqifkj.js";const B=a({data:()=>({title:"backgroundAudio",bgAudioMannager:null,dataUrl:"https://vkceyugu.cdn.bspapp.com/VKCEYUGU-hello-uniapp/2cc220e0-c27a-11ea-9dfb-6da8e309e0d8.mp3",playing:!1,playTime:0,formatedPlayTime:"00:00:00"}),onLoad:function(){this.playing=this.$backgroundAudioData.playing,this.playTime=this.$backgroundAudioData.playTime,this.formatedPlayTime=this.$backgroundAudioData.formatedPlayTime;let a=uni.getBackgroundAudioManager();a.title||(a.title="致爱丽丝"),a.singer||(a.singer="暂无"),a.coverImgUrl||(a.coverImgUrl="https://web-assets.dcloud.net.cn/unidoc/zh/Alice.jpeg"),a.onPlay((()=>{console.log("开始播放"),this.$backgroundAudioData.playing=this.playing=!0})),a.onPause((()=>{console.log("暂停播放"),this.$backgroundAudioData.playing=this.playing=!1})),a.onEnded((()=>{this.playing=!1,this.$backgroundAudioData.playing=!1,this.$backgroundAudioData.playTime=this.playTime=0,this.$backgroundAudioData.formatedPlayTime=this.formatedPlayTime=b(0)})),a.onTimeUpdate((t=>{Math.floor(a.currentTime)>Math.floor(this.playTime)&&(this.$backgroundAudioData.formatedPlayTime=this.formatedPlayTime=b(Math.floor(a.currentTime))),this.$backgroundAudioData.playTime=this.playTime=a.currentTime})),this.bgAudioMannager=a},methods:{play:function(a){this.bgAudioMannager.src?(this.bgAudioMannager.seek(this.playTime),this.bgAudioMannager.play()):(this.bgAudioMannager.startTime=this.playTime,this.bgAudioMannager.src=this.dataUrl)},seek:function(a){this.bgAudioMannager.seek(a.detail.value)},pause:function(){this.bgAudioMannager.pause()},stop:function(){this.bgAudioMannager.stop(),this.$backgroundAudioData.playing=this.playing=!1,this.$backgroundAudioData.playTime=this.playTime=0,this.$backgroundAudioData.formatedPlayTime=this.formatedPlayTime=b(0)}}},[["render",function(a,b,B,y,Q,w){const k=t(e("page-head"),l),F=c,f=s,E=p,U=m;return g(),i(f,null,{default:A((()=>[n(k,{title:Q.title},null,8,["title"]),n(f,{class:"uni-padding-wrap"},{default:A((()=>[n(f,{class:"uni-center"},{default:A((()=>[n(F,{class:"time-big"},{default:A((()=>[o(d(Q.formatedPlayTime),1)])),_:1})])),_:1}),n(f,{class:"uni-common-mt"},{default:A((()=>[n(E,{class:"slider",min:"0",max:"21",step:"1",value:Q.playTime,onChange:w.seek},null,8,["value","onChange"])])),_:1}),n(f,{class:"play-time"},{default:A((()=>[n(F,null,{default:A((()=>[o("00:00")])),_:1}),n(F,null,{default:A((()=>[o("00:21")])),_:1})])),_:1}),n(f,{class:"uni-hello-text"},{default:A((()=>[o("注意：离开当前页面后背景音乐将保持播放，但退出uni-app将停止")])),_:1}),n(f,{class:"page-body-buttons"},{default:A((()=>[Q.playing?(g(),u(r,{key:0},[n(f,{class:"page-body-button",onClick:w.stop},{default:A((()=>[n(U,{src:I})])),_:1},8,["onClick"]),n(f,{class:"page-body-button",onClick:w.pause},{default:A((()=>[n(U,{src:"data:image/png;base64,[encoded data, 5016 characters]"})])),_:1},8,["onClick"])],64)):h("",!0),Q.playing?h("",!0):(g(),u(r,{key:1},[n(f,{class:"page-body-button"}),n(f,{class:"page-body-button",onClick:w.play},{default:A((()=>[n(U,{src:C})])),_:1},8,["onClick"])],64)),n(f,{class:"page-body-button"})])),_:1})])),_:1})])),_:1})}],["__scopeId","data-v-42f159e4"]]);export{B as default};
