Copy link to clipboard
Copied
I have a .mp3 file which is part of the timeline of a movieclip symbol and triggered from an action on a button. I play this symbol from frame 1 and then audio kicks in along with timeline and then I can stop it with another button.
However, the audio is not working in Safari desktop, works fine in Chrome/Firefox, iPhone and randomly some iPads but not others.
Anyone got any ideas?
Copy link to clipboard
Copied
Does it fail when you do a test movie? What is the code like, that triggers the playback?
Copy link to clipboard
Copied
Hello Colin, Thanks for reply, I get the same thing when I use Test Movie in Browser, works in Chrome/Firefox but not in Safari.
I haven't written any code to trigger the playback, just added the .mp3 to a movieclip symbol which I then have a button when clicked simply plays the symbol timeline and then the audio is part of that (no animation) as the timeline rolls through, I then stop the symbol with a button which stops the audio.
I can send you any files or links by DM if that helps.
Copy link to clipboard
Copied
For the button to then play the timeline would need code. If you have the animation in the down state for the button, that might work around that, but I'm not sure if it would meet Safari's security demands.
In Animate is a Code Snippets window, you can open that and get some pre-made scripts. In the screenshot I have made a play button movieclip, selected it, and used the Click to Go to Frame and Play code snippet. As it stands it's going to frame 5, but I could change that to be a different frame.
Try that on a test file, and see if you then get sound.
 
Copy link to clipboard
Copied
Thanks, sorry I misunderstood, I do have some code to trigger this, is below, am using some variables as need to run this function for multiple examples.
function PlayAudio()
{
window.nsong=nsong;
this.Needle.gotoAndPlay(0);
return [eval("this.Text"+nsong+".gotoAndPlay(0);"),eval("this.Record"+nsong+".gotoAndPlay(0);")];
}
It is the 'this.Text' symbol which has the audio .mp3 attached to the timeline
Copy link to clipboard
Copied
It's the code that calls PlayAudio() that matters more. How is PlayAudio() called?
Copy link to clipboard
Copied
this.linkb.addEventListener("click", PlayAudio.bind(this,nsong));
The button is an almost transparent link over a graphic to get the mouse to change as a link, called linkb. I don't have a down state set, only an up and then the click calls the function.
Then I just used the panel in my screenshot above to link the .mp3 to the timeline of the symbol layer and then used the code to play the timeline of that symbol, it works a treat for most browsers, but not Safari??
Copy link to clipboard
Copied
Some browsers have less tough security than Safari. Are you able to post a zip file online somwhere, with as little as is needed to show the problem?
One useful thing to try, if you have an iPad connected to a Mac, in the Mac Safari Develop menu you can live debug the Safari page that is open on the iPad. That might show what is going wrong.
Copy link to clipboard
Copied
Update: Have tried several things but seems like a bug as getting security issues with Safari despite everything ok, audio seems a massive gap in Animate functionality so hopefully on the roadmap soon.