Playing.m4a

I have a audio file named. myAudio.m4a.
How should I write code for browser playing it?

What have you tried? Have you looked at the <audio> tag?

I just want to playing it when I open the page which has the code for playing it

I tried some audio code but failed.

Show us what you tried.

<audio controls="controls" autoplay="autoplay">
<source src="myAudio.m4a?filename=myAudio.m4a" type="audio/mp4">
</audio>

The code above doesn’t work

Define “doesn’t work”.

You realise that starting a sound file playing without the user’s permission is considered bad form? In fact Chrome disables this feature (I’m not sure about Firefox) - which may be the reason your audio file doesn’t start playing. It requires specific user interaction.

1 Like

The page shows audio play.
However the button of the audio play is not clickable.
That is why I can listen to the audio.
“Doesn’t work” means that I can not listen to the audio.

How can I make user interaction?

What is the meaning of the query string?

As I remove the query string, it works by autoplaying.
Thank you.

1 Like