Home > front end >  HTML base64 mp3, broadcast time is multi-purpose
HTML base64 mp3, broadcast time is multi-purpose

Time:09-25

Ladies and gentlemen, I am of base64 at ajax, mp3, then dynamic playback,
The data: audio/mp3; Base64,//MoxAAOsCpoXhDABBqbktsAlGMDpwZwjWIS6ClIzjx95K5hjKnXP
The data in the var SND=new Audio (sndblock); ,
Then play,
Found that quality obviously wrong, played the trace a look, and found that playing time is twice the mp3 itself time,
Excuse me, how to solve this problem,
Thank you,

Var begintim=new Date (). GetTime ();
Var sndblock=bloblist. Shift ();
Var SND=new Audio (sndblock);
The console. The log (" before pay: "+ sndblock. The substring (0 40));
Df. The appendChild (SND);//keep in fragments until finished playing
SND. AddEventListener (' ended ', function () {the console. The log (gettime () + "" + $(this). Attr (" playID") + "play end."); Df. RemoveChild (this); });
Var begintim2=new Date (). GetTime ();
The console. The log (gettime () + + playID "play id:" + "part2 time:" + "" + (begintim2 - begintim));

$(SND). Attr (" playID "playID);

The console. The log (" playID "+ +" "+ SND playID. Duration).

SND. Play ();


  • Related