Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@dw/wx-audio

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@dw/wx-audio - npm Package Compare versions

Comparing version 1.0.4 to 1.0.5

2

lib/d-audio.js

@@ -1,1 +0,1 @@

!function(i,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var e=t();for(var A in e)("object"==typeof exports?exports:i)[A]=e[A]}}(window,function(){return function(i){var t={};function e(A){if(t[A])return t[A].exports;var o=t[A]={i:A,l:!1,exports:{}};return i[A].call(o.exports,o,o.exports,e),o.l=!0,o.exports}return e.m=i,e.c=t,e.d=function(i,t,A){e.o(i,t)||Object.defineProperty(i,t,{configurable:!1,enumerable:!0,get:A})},e.r=function(i){Object.defineProperty(i,"__esModule",{value:!0})},e.n=function(i){var t=i&&i.__esModule?function(){return i.default}:function(){return i};return e.d(t,"a",t),t},e.o=function(i,t){return Object.prototype.hasOwnProperty.call(i,t)},e.p="",e(e.s=2)}([function(i,t){i.exports="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFQAAABUCAMAAAArteDzAAAAaVBMVEUAAAAarRkarRkarRkarRkarRkarRkarRkarRkarRkarRkarRkarRkarRkarRkarRkarRkarRkarRkarRkarRkarRkarRkarRkarRkarRkarRkarRkarRkarRkarRkarRkarRkarRkarRlIa6J1AAAAInRSTlMA9wYa38QR7ZJnMK1IIqBsO3fXDbSGQudZz5fKpV0rfbpRlHIjYQAAA35JREFUWMPFWduyqjAMDS0tgtwEFBGv/P9Hntmh3cWDTYsMs/Oio3SRy0qapuCU7PXIRdUGQxCFncgfrwzWCb/l4TCTML/xbxFlIQariEJ+AZnkwUBKkCdLIZvBQ5olsPw61Uhc4vTOa4Ca39P4IqYWXH2dyw5mWXUs2ez/8liZVx6YD2bW6wXRzmpesov0U70HxW5azT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IYnBURzkGO3Q85kfgBRgdVxmcFOBihhYHNbQ9RoJhMrlT7SYLxDAgACH5BAU/AMkALCsAFgAMACgAAAjVAJMli2BikcCDByNUOIYrAkKBCo9J/GPgYS6JGBE9TFYMo8QYDxuM8MgIw8Nbmjw22ujLowUdG2F5FLTRlsdSxDZO8ThpoyuPSjbWMIMx1MZkijwO2xjGY5iNUjxS2WhAF8ZaR69gZHQ0B8YNRwthxHHUEMYFRyVg5HUUFcZSRy1gfLVRgMddG3t5nLXxkMdgG01gBCDgoQ2PqDbK8gjs4Q0FHls8POCx1UMCOzzSeijMI5qHHTwei4UwDWSMch5a8WjMy0MNATCC3Aj72K+jAjVUORoQACH5BAU5AMkALCMAFgAUACgAAAgwAJEJHEiwoMGDCBMqXMiwocOHECNKnEixosWLGDNq3Mixo8ePIEOKHEmypMmTFAMCACH5BAU1AMkALCQAHQAKABoAAAiOAJMJjCBGoMGBFSpEOJgsQoVjx1gRMnjmIcRjpAxikHERoimDBkR1LIHBoBdNHQcdJNHxz8EGjDqOOVgm5cFUHU8dpEHmoiqGJS66PGjxGCCGoS6aOEioI5SDjjomOqikoyOKMy4GiGJwVEc5Bjt0POZH4AUYHVcZnBTgYoYWBzW0PUaCYTK5U+0mC8QwIAAh+QQFPwDJACwsABYADAAoAAAI1QCTJYtgYpHAgwcjVDiGKwJCgQqPSfxj4GEuiRgRPUxWDKPEGA8bjPDICMPDW5o8Ntroy6MFHRtheRS00ZbHUsQ2TvE4aaMrj0o21jCDMdTGZIo8DtsYxmOYjVI8UtloQBfGWkevYGR0NAfGDUcLYcRx1BDGBUclYOR1FBXGUkctYHy1UYDHXRt7eZy18ZDHYBtNYAQg4KENj6g2yvII7OENBR5bPDzgsdVDAjs80noozCOahx08HouFMA1kjHIeWvFozMtDDQEwgtwI+9ivowI1VDkaEAA7"},function(i,t,e){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var A=function(){function i(i,t){for(var e=0;e<t.length;e++){var A=t[e];A.enumerable=A.enumerable||!1,A.configurable=!0,"value"in A&&(A.writable=!0),Object.defineProperty(i,A.key,A)}}return function(t,e,A){return e&&i(t.prototype,e),A&&i(t,A),t}}();e(7);var o=e(1),n=e(0),r=function(){function i(t){!function(i,t){if(!(i instanceof t))throw new TypeError("Cannot call a class as a function")}(this,i);this.opt=Object.assign({},{ele:null,width:"320px",title:"这是一个测试title",src:"",disc:"这是一个测试disc",loop:!0,ended:function(){}},t),"string"==typeof this.opt.ele&&(this.opt.ele=document.querySelector(this.opt.ele)),this.opt.ele&&(this.loading=!1,this.isDrag=!1,this.isplaying=!1,this.durationT=0,this.currentT=0,this.currentP=0,this.maxProgressWidth=0,this.dragProgressTo=0,this.reduceTBefore=0,this.reduceTAfter=0,this.initDom())}return A(i,[{key:"initDom",value:function(){this.wxAudioC=document.createElement("div"),this.wxAudioC.className="wx-audio-content",this.wxAudioC.style.width=this.opt.width,this.opt.ele.appendChild(this.wxAudioC),this.wxAudio=document.createElement("audio"),this.wxAudio.className="wx-audio-content",this.wxAudio.src=this.opt.src,this.opt.loop&&this.wxAudio.setAttribute("loop",this.opt.loop),this.wxAudioC.appendChild(this.wxAudio),this.wxAudioL=document.createElement("div"),this.wxAudioL.className="wx-audio-left",this.wxAudioC.appendChild(this.wxAudioL),this.wxAudioStateImg=document.createElement("img"),this.wxAudioStateImg.className="wx-audio-state",this.wxAudioStateImg.src=n,this.wxAudioL.appendChild(this.wxAudioStateImg),this.wxAudioR=document.createElement("div"),this.wxAudioR.className="wx-audio-right",this.wxAudioC.appendChild(this.wxAudioR),this.wxAudioT=document.createElement("p"),this.wxAudioT.className="wx-audio-title",this.wxAudioT.innerText=this.opt.title,this.wxAudioR.appendChild(this.wxAudioT),this.wxAudioD=document.createElement("p"),this.wxAudioD.className="wx-audio-disc",this.wxAudioD.innerText=this.opt.disc,this.wxAudioR.appendChild(this.wxAudioD),this.wxAudioP=document.createElement("div"),this.wxAudioP.className="wx-audio-progrees",this.wxAudioR.appendChild(this.wxAudioP),this.wxAudioDetail=document.createElement("div"),this.wxAudioDetail.className="wx-progrees-detail",this.wxAudioP.appendChild(this.wxAudioDetail),this.wxVoiceP=document.createElement("span"),this.wxVoiceP.className="wx-voice-p",this.wxAudioDetail.appendChild(this.wxVoiceP),this.wxBufferP=document.createElement("span"),this.wxBufferP.className="wx-buffer-p",this.wxAudioDetail.appendChild(this.wxBufferP),this.wxLoading=document.createElement("span"),this.wxLoading.className="wx-loading",this.wxAudioDetail.appendChild(this.wxLoading),this.wxLoadingWrapper=document.createElement("span"),this.wxLoadingWrapper.className="wx-loading-wrapper",this.wxLoading.appendChild(this.wxLoadingWrapper),this.wxAudioOrigin=document.createElement("div"),this.wxAudioOrigin.className="wx-audio-origin",this.wxAudioP.appendChild(this.wxAudioOrigin),this.wxAudioTime=document.createElement("div"),this.wxAudioTime.className="wx-audio-time",this.wxAudioR.appendChild(this.wxAudioTime),this.wxAudioCurrent=document.createElement("span"),this.wxAudioCurrent.className="current-t",this.wxAudioCurrent.innerText="00:00",this.wxAudioTime.appendChild(this.wxAudioCurrent),this.wxAudioDuration=document.createElement("span"),this.wxAudioDuration.className="duration-t",this.wxAudioDuration.innerText="00:00",this.wxAudioTime.appendChild(this.wxAudioDuration),this.initAudioEvent()}},{key:"audioPlay",value:function(){this.wxAudio.play(),this.isPlaying=!0}},{key:"audioPause",value:function(){this.wxAudio.pause(),this.isPlaying=!1}},{key:"audioPlayPause",value:function(){this.isPlaying?this.audioPause():this.audioPlay()}},{key:"audioCut",value:function(i,t,e){this.wxAudio.src=i,this.wxAudioT.innerText=t,this.wxAudioD.innerText=e,this.durationT=0,this.currentT=0,this.currentP=0,this.dragProgressTo=0,this.wxAudioCurrent.innerText="00:00",this.wxAudioOrigin.style.left="0px",this.wxVoiceP.style.width="0px",this.audioPlay()}},{key:"showLoading",value:function(i){this.loading=i||!1,this.loading?this.wxLoading.style.display="block":this.wxLoading.style.display="none"}},{key:"initAudioEvent",value:function(){var i=this;i.wxAudio.onplaying=function(){var t=new Date;i.isPlaying=!0,i.reduceTBefore=Date.parse(t)-Math.floor(1e3*i.wxAudio.currentTime),i.wxAudioStateImg.src=o},i.wxAudio.onpause=function(){i.isPlaying=!1,i.showLoading(!1),i.wxAudioStateImg.src=n},i.wxAudio.onloadedmetadata=function(){i.durationT=i.wxAudio.duration,i.wxAudioDuration.innerText=i.formartTime(i.wxAudio.duration)},i.wxAudio.onwaiting=function(){i.wxAudio.paused||i.showLoading(!0)},i.wxAudio.onprogress=function(){if(i.wxAudio.buffered.length>0){for(var t=0,e=0;e<i.wxAudio.buffered.length;e++)(t+=i.wxAudio.buffered.end(e)-i.wxAudio.buffered.start(e))>i.durationT&&(t=i.durationT,i.showLoading(!1),console.log("缓冲完成"));var A=Math.floor(t/i.durationT*100);i.wxBufferP.style.width=A+"%"}var o=new Date;i.wxAudio.paused||(i.reduceTAfter=Date.parse(o)-Math.floor(1e3*i.currentT),i.reduceTAfter-i.reduceTBefore>1e3?i.showLoading(!0):i.showLoading(!1))},i.wxAudio.onended=function(){i.opt.ended()},i.wxAudio.ontimeupdate=function(){var t=new Date;i.isDrag||(i.currentT=i.wxAudio.currentTime,i.currentP=Number(i.wxAudio.currentTime/i.durationT*100),i.reduceTBefore=Date.parse(t)-Math.floor(1e3*i.currentT),i.currentP=i.currentP>100?100:i.currentP,i.wxVoiceP.style.width=i.currentP+"%",i.wxAudioOrigin.style.left=i.currentP+"%",i.wxAudioCurrent.innerText=i.formartTime(i.wxAudio.currentTime),i.showLoading(!1))},i.wxAudioStateImg.onclick=function(){i.audioPlayPause()},i.wxAudioOrigin.onmousedown=function(t){i.isDrag=!0;var e=(t||window.event).clientX,A=t.target.offsetLeft;i.maxProgressWidth=i.wxAudioDetail.offsetWidth,i.wxAudioC.onmousemove=function(t){if(i.isDrag){var o=(t||window.event).clientX;i.dragProgressTo=Math.min(i.maxProgressWidth,Math.max(0,A+(o-e))),i.updatePorgress()}},i.wxAudioC.onmouseup=function(){i.isDrag&&(i.isDrag=!1,i.wxAudio.currentTime=Math.floor(i.dragProgressTo/i.maxProgressWidth*i.durationT))},i.wxAudioC.onmouseleave=function(){i.isDrag&&(i.isDrag=!1,i.wxAudio.currentTime=Math.floor(i.dragProgressTo/i.maxProgressWidth*i.durationT))}},i.wxAudioOrigin.ontouchstart=function(t){i.isDrag=!0;var e=t||window.event,A=e.touches[0].clientX,o=e.target.offsetLeft;i.maxProgressWidth=i.wxAudioDetail.offsetWidth,i.wxAudioC.ontouchmove=function(t){if(i.isDrag){var e=(t||window.event).touches[0].clientX;i.dragProgressTo=Math.min(i.maxProgressWidth,Math.max(0,o+(e-A))),i.updatePorgress()}},i.wxAudioC.ontouchend=function(){i.isDrag&&(i.isDrag=!1,i.wxAudio.currentTime=Math.floor(i.dragProgressTo/i.maxProgressWidth*i.durationT))}},i.wxAudioDetail.onclick=function(t){var e=(t||window.event).layerX,A=i.wxAudioDetail.offsetWidth;i.wxAudio.currentTime=Math.floor(e/A*i.durationT)}}},{key:"updatePorgress",value:function(){this.wxAudioOrigin.style.left=this.dragProgressTo+"px",this.wxVoiceP.style.width=this.dragProgressTo+"px";var i=Math.floor(this.dragProgressTo/this.maxProgressWidth*this.durationT);this.wxAudioCurrent.innerText=this.formartTime(i)}},{key:"formartTime",value:function(i){var t=function(i){return(i=i.toString())[1]?i:"0"+i},e=Math.floor(i/60),A=Math.floor(i%60);return t(e)+":"+t(A)}}]),i}();t.default=r},,,,,function(i,t){}])});
!function(i,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.WxAudio=t():i.WxAudio=t()}(window,function(){return function(i){var t={};function e(A){if(t[A])return t[A].exports;var o=t[A]={i:A,l:!1,exports:{}};return i[A].call(o.exports,o,o.exports,e),o.l=!0,o.exports}return e.m=i,e.c=t,e.d=function(i,t,A){e.o(i,t)||Object.defineProperty(i,t,{configurable:!1,enumerable:!0,get:A})},e.r=function(i){Object.defineProperty(i,"__esModule",{value:!0})},e.n=function(i){var t=i&&i.__esModule?function(){return i.default}:function(){return i};return e.d(t,"a",t),t},e.o=function(i,t){return Object.prototype.hasOwnProperty.call(i,t)},e.p="",e(e.s=2)}([function(i,t){i.exports="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFQAAABUCAMAAAArteDzAAAAaVBMVEUAAAAarRkarRkarRkarRkarRkarRkarRkarRkarRkarRkarRkarRkarRkarRkarRkarRkarRkarRkarRkarRkarRkarRkarRkarRkarRkarRkarRkarRkarRkarRkarRkarRkarRkarRlIa6J1AAAAInRSTlMA9wYa38QR7ZJnMK1IIqBsO3fXDbSGQudZz5fKpV0rfbpRlHIjYQAAA35JREFUWMPFWduyqjAMDS0tgtwEFBGv/P9Hntmh3cWDTYsMs/Oio3SRy0qapuCU7PXIRdUGQxCFncgfrwzWCb/l4TCTML/xbxFlIQariEJ+AZnkwUBKkCdLIZvBQ5olsPw61Uhc4vTOa4Ca39P4IqYWXH2dyw5mWXUs2ez/8liZVx6YD2bW6wXRzmpesov0U70HxW5azTBmpD1xqJW9uUzfaS0Lp1ms0Nru6Nfv9WPSi8lahT2BKoWyvARPKZUPhLRiduq9ckHaKds6y5pa6XmARXJQutaEP4MzLJTzyJfmk193I2YKiyUdUXcf+OnCdKPO+JqNvxO2kx4YNcr+c2jvjpE7Wv27W4uRS/C1jFEu3mpdhJyX34PWISY3ByNj/SxhhZRjfZ0UMkUJt3Bxx08rJU2xbFB16YEZDiG3JSy6sHlXNPbCHIbOVpHiN1VzjBLzKOCkmxjGKld6B4oNbjkiqi3rkJeBNN8jBj7SUEaxyGgnjE1OkS0mHkUAgd5X/qWF80mWR7PaOY0410GrnHHXVHpSqlZII521RzeXqtpkTkgEEitIiwF1YeLDJgQnIldbgAx5wMBj5z4br+aWB5GdGbxUxGjUp6ESLmxhJsaMFzx+Pi5+VIpN6bTUlcvPfw/InXlvjO5MjsdE/ucg6DjxRlEJY4Wb0J1IlnR0ZoXGEHF/6l1I68d+vj3ho9xH0mO+cjumNiMxvg/tTOWYcIAkqCl+X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dNHQcdJNHxz8EGjDqOOVgm5cFUHU8dpEHmoiqGJS66PGjxGCCGoS6aOEioI5SDjjomOqikoyOKMy4GiGJwVEc5Bjt0POZH4AUYHVcZnBTgYoYWBzW0PUaCYTK5U+0mC8QwIAAh+QQFPwDJACwsABYADAAoAAAI1QCTJYtgYpHAgwcjVDiGKwJCgQqPSfxj4GEuiRgRPUxWDKPEGA8bjPDICMPDW5o8Ntroy6MFHRtheRS00ZbHUsQ2TvE4aaMrj0o21jCDMdTGZIo8DtsYxmOYjVI8UtloQBfGWkevYGR0NAfGDUcLYcRx1BDGBUclYOR1FBXGUkctYHy1UYDHXRt7eZy18ZDHYBtNYAQg4KENj6g2yvII7OENBR5bPDzgsdVDAjs80noozCOahx08HouFMA1kjHIeWvFozMtDDQEwgtwI+9ivowI1VDkaEAA7"},function(i,t,e){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var A=function(){function i(i,t){for(var e=0;e<t.length;e++){var A=t[e];A.enumerable=A.enumerable||!1,A.configurable=!0,"value"in A&&(A.writable=!0),Object.defineProperty(i,A.key,A)}}return function(t,e,A){return e&&i(t.prototype,e),A&&i(t,A),t}}();e(7);var o=e(1),n=e(0),r=function(){function i(t){!function(i,t){if(!(i instanceof t))throw new TypeError("Cannot call a class as a function")}(this,i);this.opt=Object.assign({},{ele:null,width:"320px",title:"这是一个测试title",src:"",disc:"这是一个测试disc",loop:!0,ended:function(){}},t),"string"==typeof this.opt.ele&&(this.opt.ele=document.querySelector(this.opt.ele)),this.opt.ele&&(this.loading=!1,this.isDrag=!1,this.isplaying=!1,this.durationT=0,this.currentT=0,this.currentP=0,this.maxProgressWidth=0,this.dragProgressTo=0,this.reduceTBefore=0,this.reduceTAfter=0,this.initDom())}return A(i,[{key:"initDom",value:function(){this.wxAudioC=document.createElement("div"),this.wxAudioC.className="wx-audio-content",this.wxAudioC.style.width=this.opt.width,this.opt.ele.appendChild(this.wxAudioC),this.wxAudio=document.createElement("audio"),this.wxAudio.className="wx-audio-content",this.wxAudio.src=this.opt.src,this.opt.loop&&this.wxAudio.setAttribute("loop",this.opt.loop),this.wxAudioC.appendChild(this.wxAudio),this.wxAudioL=document.createElement("div"),this.wxAudioL.className="wx-audio-left",this.wxAudioC.appendChild(this.wxAudioL),this.wxAudioStateImg=document.createElement("img"),this.wxAudioStateImg.className="wx-audio-state",this.wxAudioStateImg.src=n,this.wxAudioL.appendChild(this.wxAudioStateImg),this.wxAudioR=document.createElement("div"),this.wxAudioR.className="wx-audio-right",this.wxAudioC.appendChild(this.wxAudioR),this.wxAudioT=document.createElement("p"),this.wxAudioT.className="wx-audio-title",this.wxAudioT.innerText=this.opt.title,this.wxAudioR.appendChild(this.wxAudioT),this.wxAudioD=document.createElement("p"),this.wxAudioD.className="wx-audio-disc",this.wxAudioD.innerText=this.opt.disc,this.wxAudioR.appendChild(this.wxAudioD),this.wxAudioP=document.createElement("div"),this.wxAudioP.className="wx-audio-progrees",this.wxAudioR.appendChild(this.wxAudioP),this.wxAudioDetail=document.createElement("div"),this.wxAudioDetail.className="wx-progrees-detail",this.wxAudioP.appendChild(this.wxAudioDetail),this.wxVoiceP=document.createElement("span"),this.wxVoiceP.className="wx-voice-p",this.wxAudioDetail.appendChild(this.wxVoiceP),this.wxBufferP=document.createElement("span"),this.wxBufferP.className="wx-buffer-p",this.wxAudioDetail.appendChild(this.wxBufferP),this.wxLoading=document.createElement("span"),this.wxLoading.className="wx-loading",this.wxAudioDetail.appendChild(this.wxLoading),this.wxLoadingWrapper=document.createElement("span"),this.wxLoadingWrapper.className="wx-loading-wrapper",this.wxLoading.appendChild(this.wxLoadingWrapper),this.wxAudioOrigin=document.createElement("div"),this.wxAudioOrigin.className="wx-audio-origin",this.wxAudioP.appendChild(this.wxAudioOrigin),this.wxAudioTime=document.createElement("div"),this.wxAudioTime.className="wx-audio-time",this.wxAudioR.appendChild(this.wxAudioTime),this.wxAudioCurrent=document.createElement("span"),this.wxAudioCurrent.className="current-t",this.wxAudioCurrent.innerText="00:00",this.wxAudioTime.appendChild(this.wxAudioCurrent),this.wxAudioDuration=document.createElement("span"),this.wxAudioDuration.className="duration-t",this.wxAudioDuration.innerText="00:00",this.wxAudioTime.appendChild(this.wxAudioDuration),this.initAudioEvent()}},{key:"audioPlay",value:function(){this.wxAudio.play(),this.isPlaying=!0}},{key:"audioPause",value:function(){this.wxAudio.pause(),this.isPlaying=!1}},{key:"audioPlayPause",value:function(){this.isPlaying?this.audioPause():this.audioPlay()}},{key:"audioCut",value:function(i,t,e){this.wxAudio.src=i,this.wxAudioT.innerText=t,this.wxAudioD.innerText=e,this.durationT=0,this.currentT=0,this.currentP=0,this.dragProgressTo=0,this.wxAudioCurrent.innerText="00:00",this.wxAudioOrigin.style.left="0px",this.wxVoiceP.style.width="0px",this.audioPlay()}},{key:"showLoading",value:function(i){this.loading=i||!1,this.loading?this.wxLoading.style.display="block":this.wxLoading.style.display="none"}},{key:"initAudioEvent",value:function(){var i=this;i.wxAudio.onplaying=function(){var t=new Date;i.isPlaying=!0,i.reduceTBefore=Date.parse(t)-Math.floor(1e3*i.wxAudio.currentTime),i.wxAudioStateImg.src=o},i.wxAudio.onpause=function(){i.isPlaying=!1,i.showLoading(!1),i.wxAudioStateImg.src=n},i.wxAudio.onloadedmetadata=function(){i.durationT=i.wxAudio.duration,i.wxAudioDuration.innerText=i.formartTime(i.wxAudio.duration)},i.wxAudio.onwaiting=function(){i.wxAudio.paused||i.showLoading(!0)},i.wxAudio.onprogress=function(){if(i.wxAudio.buffered.length>0){for(var t=0,e=0;e<i.wxAudio.buffered.length;e++)(t+=i.wxAudio.buffered.end(e)-i.wxAudio.buffered.start(e))>i.durationT&&(t=i.durationT,i.showLoading(!1),console.log("缓冲完成"));var A=Math.floor(t/i.durationT*100);i.wxBufferP.style.width=A+"%"}var o=new Date;i.wxAudio.paused||(i.reduceTAfter=Date.parse(o)-Math.floor(1e3*i.currentT),i.reduceTAfter-i.reduceTBefore>1e3?i.showLoading(!0):i.showLoading(!1))},i.wxAudio.onended=function(){i.opt.ended()},i.wxAudio.ontimeupdate=function(){var t=new Date;i.isDrag||(i.currentT=i.wxAudio.currentTime,i.currentP=Number(i.wxAudio.currentTime/i.durationT*100),i.reduceTBefore=Date.parse(t)-Math.floor(1e3*i.currentT),i.currentP=i.currentP>100?100:i.currentP,i.wxVoiceP.style.width=i.currentP+"%",i.wxAudioOrigin.style.left=i.currentP+"%",i.wxAudioCurrent.innerText=i.formartTime(i.wxAudio.currentTime),i.showLoading(!1))},i.wxAudioStateImg.onclick=function(){i.audioPlayPause()},i.wxAudioOrigin.onmousedown=function(t){i.isDrag=!0;var e=(t||window.event).clientX,A=t.target.offsetLeft;i.maxProgressWidth=i.wxAudioDetail.offsetWidth,i.wxAudioC.onmousemove=function(t){if(i.isDrag){var o=(t||window.event).clientX;i.dragProgressTo=Math.min(i.maxProgressWidth,Math.max(0,A+(o-e))),i.updatePorgress()}},i.wxAudioC.onmouseup=function(){i.isDrag&&(i.isDrag=!1,i.wxAudio.currentTime=Math.floor(i.dragProgressTo/i.maxProgressWidth*i.durationT))},i.wxAudioC.onmouseleave=function(){i.isDrag&&(i.isDrag=!1,i.wxAudio.currentTime=Math.floor(i.dragProgressTo/i.maxProgressWidth*i.durationT))}},i.wxAudioOrigin.ontouchstart=function(t){i.isDrag=!0;var e=t||window.event,A=e.touches[0].clientX,o=e.target.offsetLeft;i.maxProgressWidth=i.wxAudioDetail.offsetWidth,i.wxAudioC.ontouchmove=function(t){if(i.isDrag){var e=(t||window.event).touches[0].clientX;i.dragProgressTo=Math.min(i.maxProgressWidth,Math.max(0,o+(e-A))),i.updatePorgress()}},i.wxAudioC.ontouchend=function(){i.isDrag&&(i.isDrag=!1,i.wxAudio.currentTime=Math.floor(i.dragProgressTo/i.maxProgressWidth*i.durationT))}},i.wxAudioDetail.onclick=function(t){var e=(t||window.event).layerX,A=i.wxAudioDetail.offsetWidth;i.wxAudio.currentTime=Math.floor(e/A*i.durationT)}}},{key:"updatePorgress",value:function(){this.wxAudioOrigin.style.left=this.dragProgressTo+"px",this.wxVoiceP.style.width=this.dragProgressTo+"px";var i=Math.floor(this.dragProgressTo/this.maxProgressWidth*this.durationT);this.wxAudioCurrent.innerText=this.formartTime(i)}},{key:"formartTime",value:function(i){var t=function(i){return(i=i.toString())[1]?i:"0"+i},e=Math.floor(i/60),A=Math.floor(i%60);return t(e)+":"+t(A)}}]),i}();t.default=r},,,,,function(i,t){}]).default});
{
"name": "@dw/wx-audio",
"version": "1.0.4",
"version": "1.0.5",
"description": "wx-audio",

@@ -13,2 +13,6 @@ "main": "lib/wx-audio.js",

},
"files": [
"lib/",
"README.md"
],
"repository": {

@@ -15,0 +19,0 @@ "type": "git",

@@ -14,3 +14,3 @@ # wx-audio

```js
npm install wx-audio
npm install @dw/wx-audio
```

@@ -17,0 +17,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc