Upload a audio file, mobile browser doesnt play it

hello
Hello World! (skylv.glitch.me)
i did an example of uploaded audio.
but from the mobile devices sound doesnt play?
any suggestions, how can i fix it?

<audio autoplay>

i used this lines and put it before the /head

There isn’t enough information to know for sure but if for instance you have an iPhone (and I assume other browsers can do the same) autoplay may not be recognized.

I know at least a few browser and Apple in particular required user interaction to play a video.

1 Like

but how is possible to make a button play?
and than it will start? right?

Yes any type of control that the user can use wired to a play event. I think (best to check) you’ll find that Chrome browsers have autoplay disabled by default as well. I am looking at your page right now and I see audio link but I don’t hear anything.

Most of Mobile browser is disabling Autoplay for security reason. You can’t do anything with that except making startup screen like “Tap to continue” or telling to client to enable Autoplay (There’s a option to enable it at settings)

Can you help please, how to add a button?
Maybe there are some example at some glitch project?

I don’t believe there is a “security” issue, it is mostly about annoying people with ads and such. These days I see a lot of sites that have say a news story about one thing and a video playing about something else entirely.

The good news (sort of) is that the sound is now playing on my chrome-based browser so I might have had the volume down before.

Finding examples of a play button (and remember it doesn’t have to look like a “button”) should be easy, just search the Internet.

2 Likes

This person usually has straightforward examples How to use the HTML audio tag you might even like to use the audio control. It should look nice and people can start, stop the audio.

My Music Visualizer has a play/pause function as well as a looping function,

The source code for the script file is linked here.

If you have any other problems feel free to reply.

Happy coding!

but i need integrate my audio inside of this project via code.
not upload it in web viewer.
can i modify it?
just to open a page and push play button, after audio will start.

I’m not quite sure what you mean by this but… @Demonitized was simply offering an example of something that worked via a button. The point is you don’t have to use that project or that button or that code but it shows you that it can be done via a button.

My advice is to simply turn on the built-in control for now. That should prove to you that it is controllable and whether that is the actual issue on your mobile phone. Then when it is working you can decide what the button should look like, where it should be placed, etc.

Also: Demonitized, I notice you have 2 calls to fetch the audio tag, I think one of them is superfluous.

// If any developers see this and know why the visualizer is not going very high, please tell me!
var file;
var audio = document.getElementById(“audio”);

window.onload = function() {
audio = document.getElementById(“audio”);
file = document.getElementById(“audioFile”);

I know that there are two calls to fetch the audio element, but the weird thing is if I remove either one, it just stops working. I have no idea why it does this, but it does. Might just be a bug

You may not feel like pursuing it (or maybe you do when you have some time) but it is almost certainly not a bug in the browser. These events have all been determined to work not just some sometimes or for some tags :slight_smile:

My rule of thumb is, the odder the behavior the more likely it is something I have done.

You might look into moving your script tag(s) to the end of the body tag. Loading them last rather than inline speeds up the process and insures that all the UI elements exist.

I’ve never thought of it like that. As I don’t want to flood this topic with my own issues, I would suggest using my topic on #the-gallery at this link that is conveniently placed here.

Yea, then the other reason I believe is apps instantly taking out a lot of your bandwidth when you’re on a celluar network with limits.