微信语音怎么设置自动播放?

html-css021

微信语音怎么设置自动播放?,第1张

1、打开手机内存。

/iknow-pic.cdn.bcebos.com/fc1f4134970a304efdb24553dfc8a786c8175c83"target="_blank"title="点击查看大图"class="ikqb_img_alink">/iknow-pic.cdn.bcebos.com/fc1f4134970a304efdb24553dfc8a786c8175c83?x-bce-process=image%2Fresize%2Cm_lfit%2Cw_600%2Ch_800%2Climit_1%2Fquality%2Cq_85%2Fformat%2Cf_auto"esrc="https://iknow-pic.cdn.bcebos.com/fc1f4134970a304efdb24553dfc8a786c8175c83"/>

2、在目录找到一个Tencent文件点击进去。

/iknow-pic.cdn.bcebos.com/a044ad345982b2b74145dc6d3fadcbef77099b45"target="_blank"title="点击查看大图"class="ikqb_img_alink">/iknow-pic.cdn.bcebos.com/a044ad345982b2b74145dc6d3fadcbef77099b45?x-bce-process=image%2Fresize%2Cm_lfit%2Cw_600%2Ch_800%2Climit_1%2Fquality%2Cq_85%2Fformat%2Cf_auto"esrc="https://iknow-pic.cdn.bcebos.com/a044ad345982b2b74145dc6d3fadcbef77099b45"/>

3、进去之后在找一个MicroMsg文件。

/iknow-pic.cdn.bcebos.com/0b7b02087bf40ad127f3234a592c11dfa9ecce00"target="_blank"title="点击查看大图"class="ikqb_img_alink">/iknow-pic.cdn.bcebos.com/0b7b02087bf40ad127f3234a592c11dfa9ecce00?x-bce-process=image%2Fresize%2Cm_lfit%2Cw_600%2Ch_800%2Climit_1%2Fquality%2Cq_85%2Fformat%2Cf_auto"esrc="https://iknow-pic.cdn.bcebos.com/0b7b02087bf40ad127f3234a592c11dfa9ecce00"/>

4、再进去有一个一长串数字和字母的文件夹。

/iknow-pic.cdn.bcebos.com/902397dda144ad34d7c3632edea20cf431ad851f"target="_blank"title="点击查看大图"class="ikqb_img_alink">/iknow-pic.cdn.bcebos.com/902397dda144ad34d7c3632edea20cf431ad851f?x-bce-process=image%2Fresize%2Cm_lfit%2Cw_600%2Ch_800%2Climit_1%2Fquality%2Cq_85%2Fformat%2Cf_auto"esrc="https://iknow-pic.cdn.bcebos.com/902397dda144ad34d7c3632edea20cf431ad851f"/>

5、再进去找到voice文件夹。

/iknow-pic.cdn.bcebos.com/810a19d8bc3eb135fcb15312a81ea8d3fd1f4421"target="_blank"title="点击查看大图"class="ikqb_img_alink">/iknow-pic.cdn.bcebos.com/810a19d8bc3eb135fcb15312a81ea8d3fd1f4421?x-bce-process=image%2Fresize%2Cm_lfit%2Cw_600%2Ch_800%2Climit_1%2Fquality%2Cq_85%2Fformat%2Cf_auto"esrc="https://iknow-pic.cdn.bcebos.com/810a19d8bc3eb135fcb15312a81ea8d3fd1f4421"/>

6、进去有的文件是隐藏的可以点击右上角显示出来只要全面带点的留下 其他全部删除。删完之后微信语音就可以自动播放了。

/iknow-pic.cdn.bcebos.com/c2fdfc039245d6883b4e560daac27d1ed31b24cf"target="_blank"title="点击查看大图"class="ikqb_img_alink">/iknow-pic.cdn.bcebos.com/c2fdfc039245d6883b4e560daac27d1ed31b24cf?x-bce-process=image%2Fresize%2Cm_lfit%2Cw_600%2Ch_800%2Climit_1%2Fquality%2Cq_85%2Fformat%2Cf_auto"esrc="https://iknow-pic.cdn.bcebos.com/c2fdfc039245d6883b4e560daac27d1ed31b24cf"/>

我的html结构是这样的

class="app-voice-you" voiceSrc="xx.mp3">

class="app-voice-headimg" src="xx.png" />

style="width: 60%" class="app-voice-state-bg">

class="app-voice-state app-voice-pause">

class="app-voice-time app-voice-unread">

1'6"

id="audio_my" src="">

Your browser does not support the audio tag.

核心功能就是语音播放,主要包括了以下几个功能点:

红点表明未听语音,语音听过后,红点会消失

将“未读”状态的样式独立出来,“已读”的时候,把样式删除就行。结合本地存储处理就搞定了。

//this是点击的语音的document

var app_voice_time = this.getElementsByClassName("app-voice-time")[0]

if(app_voice_time.className.indexOf("app-voice-unread") != -1){

//存在红点时,把红点样式删除

app_voice_time.className = app_voice_time.className.replace("app-voice-unread","")

}

第一次听语音,会自动播放下一段语音

这里主要是使用HTML5的audio控件的“语音播放完”事件

语音播放完,找到下一个语音,播放下一个语音

//语音播放完事件(PAGE.audio是audio控件的document)

PAGE.audio.addEventListener('ended', function () {

//循环获取下一个节点

PAGE.preVoice = PAGE.currentVoice

var currentVoice = PAGE.currentVoice

while(true){

currentVoice = currentVoice.nextElementSibling//下一个兄弟节点

//已经到达最底部

if(!currentVoice){

PAGE.preVoice.getElementsByClassName("app-voice-state")[0].className = "app-voice-state app-voice-pause"

return false

}

var voiceSrc = currentVoice.getAttribute("voiceSrc")

if(voiceSrc &&voiceSrc != ""){

break

}

}

if(!PAGE.autoNextVoice){

PAGE.preVoice.getElementsByClassName("app-voice-state")[0].className = "app-voice-state app-voice-pause"

return false

}

PAGE.currentVoice = currentVoice

//获取得到下一个语音节点,播放

PAGE.audio.src = voiceSrc

PAGE.audio.play()

PAGE.Event_PlayVoice()

}, false)

每段语音可以暂停、继续播放、重新播放

这个比较简单,但是也是比较多逻辑。需要变换样式告诉用户,怎样是继续播放/重新播放。

播放中的语音有动画,不是播放中的语音则会停止动画。

这里主要是CSS3动画的应用

.app-voice-pause,.app-voice-play{

height: 18px

background-repeat: no-repeat

background-image: url(../img/voice.png)

background-size: 18px auto

opacity: 0.5

}

.app-voice-you .app-voice-pause{

/*从未播放*/

background-position: 0px -39px

}

.app-voice-you .app-voice-play{

/*播放中(不需要过渡动画)*/

background-position: 0px -39px

-webkit-animation: voiceplay 1s infinite step-start

-moz-animation: voiceplay 1s infinite step-start

-o-animation: voiceplay 1s infinite step-start

animation: voiceplay 1s infinite step-start

}

@-webkit-keyframes voiceplay {

0%,

100% {

background-position: 0px -39px

}

33.333333% {

background-position: 0px -0px

}

66.666666% {

background-position: 0px -19.7px

}

}