FUSE: Responsible for the project in the words of the inter-service module, processing audio a bit of a problem
Previous processing:
// Loop Play sound
varDialaudiodocument = document.createelement (' Audio '); This is the sound of dialing (only one audio is written here)varDialsource = document.createelement (' source '); Dialsource.type= "Audio/mpeg";d Ialsource.type= "Audio/mpeg";d Ialsource.autoplay= "AutoPlay";d Ialsource.controls= "Controls";
URL: Indicates the audio path, flag: An identity, call or dial out, audio: Indicates the above dialaudiodocument, source: Above the Dialsourcefunctionplayaudio (URL, flag, audio, source) {console.log (URL); Note: This audio is to be played with the source, and there is no way to stop him (for unknown reason) console.log (flag); Console.log (audio); Console.log (source); SOURCE.SRC=URL; Audio.appendchild (source); Audio.play (); if(flag = = "Dial") {Dialalert= SetTimeout ("playaudio" + URL + "', ' dial ', '" +audio+ "', '" +source+ "')", 1000*5); } if(Flag = = "Call") {Callalert= SetTimeout ("playaudio" + URL + "', ' call ', '" +audio+ "', '" +source+ "')", 1000*29); }}
Disadvantage: Because there is no way to let the audio stop, this time can only select the short duration of the audio loop playback, the stop is through Clearinter. The way to stop, and the back of the audio, it is not .....
Little demo at the time: (testing whether this audio method works)
<! DOCTYPE html>
The current programme:
<!--Here's the recording--
<audio id= "Dialaudio" src= "/static/audio/dialaudio.mp3" ></audio>
<audio id= "Callaudio" src= "/static/audio/callaudio.mp3" ></audio>
<audio id= "Hangaudio" src= "/static/audio/hangaudio.mp3" ></audio>
$ (function () {
Initialize the recording label
Dialaudiodocument = document.getElementById (' Dialaudio '); Only document can be obtained here, the reason is unknown, conjecture may be the loading order problem
Callaudiodocument = document.getElementById (' Callaudio ');
Hangaudiodocument = document.getElementById (' Hangaudio ');
Loop play sound function playaudio (document, flag) { Console.log (document); = 0; Document.play (); if (flag = = "Dial") {= SetTimeout ("Playaudio ('" + Document + "', ' dial ')", 1000*5); } if (Flag = = "Call") {= SetTimeout ("Playaudio ('" + Document + "', ' call ')", 1000*29); }}
Stop the sound.
function Pauseaudio (document, flag) {
if (flag = = "Dial") {
Document.pause ();
}
if (flag = = "Call") {
Document.pause ();
}
}
Advantages: Solve the above shortcomings
Take time to record, far greater than dead knocks
Audio problems with HTML pages