0
Ich benutze Web Audio API, um ein einfaches Streaming Audio mit dieser Funktion: Funktion MyAudio (URL) { var song = new Audio(); song.crossOrigin = "anonym"; song.src = URL;So stoppen/pausieren Sie MediaElementSource (Web Audio API)
this.source = context.createMediaElementSource(song);
this.source.connect(context.destination);
}
MyAudio.prototype.play = function(){
this.source.mediaElement.play();
};
return MyAudio;
});
Aber ich kann nicht herausfinden, wie es zu unterbrechen oder zu stoppen. Ich habe hier andere Fragen gesehen, aber sie benutzen noteOn/noteOff und das funktioniert in meinem Fall nicht.
Ich habe ohne Erfolg versucht, Dinge wie:
MyAudio.prototype.stop = function(){
this.source.mediaElement.noteOff();
};
MyAudio.prototype.stop = function(){
this.source.mediaElement.Stop();
};
MyAudio.prototype.stop = function(){
this.source.stop(0);
};
Kein Glück.
Dies kann Ihnen helfen. http://stackoverflow.com/a/14697336/3279156 – sreeramu