Estoy creando dinámicamente un archivo de audio y cambiando la fuente sobre la marcha. Sin embargo, después de cambiar el src y tratar de cambiar el tiempo actual, siempre recibo un error de estado Inválido. ¿Cómo haces para probarlo? O mejor enciende un evento cuando está listo y luego llama a currentTime para cambiar su posición de audio.Prueba de audio HTML5 para Error de estado no válido (o Excepción de Dom 11)
this.doneLoading = function(aTime){
try{
this.mAudioPlayer.currentTime = aTime/1000.0;
}catch(err){
console.log(err);
}
this.mAudioPlayer.play();
}
this.playAtTime = function(aTime) {
Debug("play at time audio: " + aTime);
Debug("this.mAudioPlayer.currentTime: " + this.mAudioPlayer.currentTime);
this.startTime = aTime;
if (this.mAudioPlayer.src != this.mAudioSrc) {
this.mAudioPlayer = new Audio();
this.mAudioPlayer.src = this.mAudioSrc;
this.mAudioPlayer.load();
this.mAudioPlayer.play();
this.mAudioPlayer.addEventListener('canplaythrough', this.doneLoading(aTime), false);
}
else if ((isChrome() || isMobileSafari()) && aTime == 0) {
this.mAudioPlayer.load();
this.mAudioPlayer.currentTime = aTime/1000.0;
this.mAudioPlayer.play();
Debug("Reloading audio");
}else{
this.mAudioPlayer.currentTime = aTime/1000.0;
this.mAudioPlayer.play();
}
};
ESTA OBRAS Creo que esta debería ser la respuesta aceptada THX – Prozi