Open omishe opened 8 years ago
We will check this out.
Tested on El Capitan (10.11.1) in Safari (9.0.1) with no problems. Can you let me know if you have the same versions, and if the problem persists?
Thank you for your response!
Yes, I have the same version, the event triggers perfectly, but when I attempt to reassign it again to the same object the event does not trigger again until I delete the object and declare it again (This is my momentary solution).
It is like if the event stays in cache and can´t be detected again until y I reload the browser in the natural way.
Thank you.
Can you be more specific about what you mean by "reassign it again"? A code sample would help to get to the bottom of this.
Yes. A minimal excerpt of code:
var audio1 = "audio1";
function initAudios() {
createjs.Sound.alternateExtensions = ["ogg"];
createjs.Sound.registerSound("audios/audio1.mp3", audio1);
}
function initAct1() {
btnEsfinge = $('#btnEsfinge');
btnEsfinge.on('click tap', function(event) {
event.stopPropagation();
var audioPlaying = createjs.Sound.play(audio1);
audioPlaying.on('complete', function() {
// This work once, a second attempt fails
console.log('Audio ended!');
audioPlaying = null;
}, this);
});
}
$(document).ready(function(){
initAudios();
initAct1();
// button to reinit application
$('#btnReinitApp').on('click',function(){
initAct1();
// Here I reload the audio again, so it worked for me
initAudios();
})
});
This is a reduced excerpt of code, but essentially this is the idea about how it should work.
Thank you a lot!
Thanks. It could be due to re-registering the audio that already exists. I will check it out.
I tested out your code, and was unable to reproduce an issue. Tested in Safari on both Yosemite, as well as El Capitan.
One note: Your initAct1
method will append a click handler on the btnEsfinge
each time you click it. So each time you restart, you get another console log per click. Note that I receive console logs each time, so the bug you describe is not happening.
The behaviour is expected with the way the code is written.
Yes, the code works well in this basic form, but if I comment or delete the call to function "initAudios ()" in the event the "#btnReinitApp" button bug appears only the first time the event '' complete '' It should be called in later called the event works well.
My complete application manipulates the DOM of HTML much saving it in a variable and then deleting it from the html and creating it again using the stored in the variable. The application is to run locally without the use of any server. I apologize for not having made a detailed code, here again the code including the allocation of the variable and the corresponding html.
// Scripts.js audio1 var = "audio1"; var photo; initAudios function () { createjs.Sound.alternateExtensions = ["ogg"]; createjs.Sound.registerSound ("Audio / texto1.mp3" audio1); }
initAct1 function () { btnEsfinge = $ ('# btnEsfinge');
btnEsfinge.on ('click tap', function (event) {
event.stopPropagation ();
audioPlaying var = createjs.Sound.play (audio1);
audioPlaying.on ('complete', function () {
// This work once, a second Attempt fails
console.log ('Audio ended!');
}, This);
});
}
$ (Document) .ready (function () { initAudios (); initAct1 ();
photo = $ ('# envDiv') html ().;
// Button to reinit application
$ ('# BtnReinitApp'). On ('click tap', function () {
$ ('# EnvDiv') html ('') html (photo)..;
// InitAudios ();
initAct1 ();
})
});
// HTML
<! DOCTYPE html>
Hi!
I have a strange issue in Safari 9.0.1. The event on("complete") only works once and when I try to replay a sound and catch on("complete") event again Safari does not catch the event. Any idea about this issue?. No problem with Firefox and Chrome.
Thanks!!