I want to play audio in the Android browser, using the html5 <audio> tag. It works fine in the iPhone browser, but not in Android. I'm using Android Virtual Device 4.0.3.
Does anyone know why?
The Android source:
webView.loadUrl("file:///android_asset/www/test.html");
The HTML file:
<audio controls="controls" format="mp3">
<source src="achievement.mp3" />
</audio>
(i couldn't hear the audio with <embed> and <object> tags either)
I found the solution here
Embed Background Audio in Android >= 2.3 Browser
<audio id="audio1" controls="controls" loop="loop" autoplay="autoplay" >
<source src="scene1.mp3" type="audio/mpeg" />
<source src="scene1.ogg" type="audio/ogg" />
</audio>
it's work for me :)
I did a quick search and found this issue report on google code. It seems the tag is unsupported. However, the tag is and can play mp3 files. The down side is (if I read it correctly) that the controls are not available. Give it a read and let us know how you make out.
I found another question that has lots of different possible solutions: Check it out
Related
I have this code to play a video on a mobile web browser, but it does not autoplay.
can anyone suggest ways to make this work on Android devices?
<video id="vidone" name="vidone" autoplay poster="eh5v.files/html5video/testx.jpg" style="width:100%" title="testx" preload='true'>
<source src="eh5v.files/html5video/testx.m4v" />
<source src="eh5v.files/html5video/testx.webm" type="video/webm" />
<source src="eh5v.files/html5video/testx.ogv" type="video/ogg" />
</video>
This works on regular browsers and mobile browser simulators, but not on the actual device, I have tried multiple javascript options and still no code that works.
Autoplay on mobile devices is generally switched off by the manufacturers to avoid users racking up huge costs in downloading videos that autoplay.
This is a good thing.
You can't, and shouldn't, do anything about it.
I am trying to use HTML5 audio across devices and have managed to get it to work on desktop machines by using the following code:
<audio id="audio-1" preload="auto" >
<source src="~/Assets/audio/file1.m4a" type="audio/mpeg">
<source src="~/Assets/audio/file1.ogg" type="audio/ogg">
</audio>
<audio id="audio-2" preload="auto">
<source src="~/Assets/audio/file2.m4a" type="audio/mpeg">
<source src="~/Assets/audio/file2.ogg" type="audio/ogg">
</audio>
<audio id="audio-3" preload="auto">
<source src="~/Assets/audio/file3.m4a" type="audio/mpeg">
<source src="~/Assets/audio/file3.ogg" type="audio/ogg">
</audio>
However on devices (both Android 5.1.1 and iOS 9) the sounds don't play.
When debugging the iPad I noticed that GET requests were sent for all the audio files but no status code was returned.
I have read an article from IBM about a combination of AAC and OGG are the best source of cross browser compatibility: http://www.ibm.com/developerworks/library/wa-ioshtml5/#resources so I'm hopeful that it isn't the file types causing the issue.
I've also read that there are possible issues with files being served up over HTTPS on devices.
What I don't know is if there is a work around to get these files to play on devices? (They are triggered on events using native HTML5 audio methods in JS)
I have since found out that you cannot autoplay sounds on mobile devices. You have to have a user interaction such as a button press to instigate the action.
http://codetheory.in/fixing-html5-audio-problems-in-ios-and-android-mobile-browsers-to-overcome-the-limitations/
I want to make a streaming with HTML5, in desktop works fine, but in android dont work, only work with local files on my server ".mp3", but with the code attached only works on my desktop, but not in android, any ideas? Thanks
<audio controls="controls">
<source src="http://radio3.oceanofm.com:8010/;" type="audio/ogg">
<source src="http://radio3.oceanofm.com:8010/;" type="audio/mpeg">
<source src="http://radio3.oceanofm.com:8010/;" type="audio/wav">
<source src="http://radio3.oceanofm.com:8010/;" type="audio/mp3">
I'm sorry; your browser doesn't support HTML5.
</audio>
According to this post: HTML5 audio tag is not working in Android , it seems that there can be many causes for your problem. Have you already checked those?
I want to write an HTML page, that can play some audio files. I use this code:
<audio width="100%" controls >
<source src="sprachMemo.mp3" type="audio/mpeg" />
<source src="sprachMemo.m4a" type="audio/x-aac" />
<source src="sprachMemo.ogg" type="audio/ogg" />
<source src="sprachMemo.wav" type="audio/wav" />
Problem!
</audio>
When I open the page with Chrome and a PC it work. But on the mobile, it shows the audio file, but you can not play it. So it just shows, that there is a file used.
I have also been looking for other solutions , but want to have a simple variant. And as I could see, the system worked on other sites.
How can I make it work on Android, too?
I have a Flash animation with sound that I converted to HTML5.
When I play it in a WebView or open it with the device browser, there is no sound.
I've tried several sound formats with no success.
I used www.html5test.com to see the browser compatibility and it supposed to support mp3.
Is is possible?
Any ideas how?
I am using Android 4.0.4
I found the solution here Embed Background Audio in Android >= 2.3 Browser
<audio id="audio1" controls="controls" loop="loop" autoplay="autoplay" >
<source src="scene1.mp3" type="audio/mpeg" />
<source src="scene1.ogg" type="audio/ogg" />
</audio>
it's work for me :)