Playing local audio file


#1

hi, is there any way to play audio file locally for mobile application?

apparently, it works in the web, but it doesn’t work in the mobile application

was wondering what am i missing


#2

Are you talking local audio files in the www folder or files on the device it’s self. Like the music for ios’s ipod


#3

I referring to the www folder.
I intend to create an mobile app where users can learn certain languages. Whenever users click on a word or syllabus it will play an audio file from the app itself, this is the stage that I’m stuck at.

I tried using phone media but it just says media is undefined.
On the other hand the audio syntax works, but only works in the Web version

would be happy if someone have a codepen or something for my problem :smiley:


#4

anyone manage to find a solution or can post a working example?


#5

Is this for iOS or android? If iOS, you should add this option to you config.xml:

<preference name="AllowInlineMediaPlayback" value="false" />

Most of the time, if its iOS, they won’t let you play video/audio inline in the browser, but this should do the trick.

If not try using this cordova plugin.

http://plugins.cordova.io/#/package/org.apache.cordova.media


#6

i’ll try it out at later period of time when ionic framework become more…stable for android interface

apparently, there are certain issues with ionic for android; such as sometimes keypad not appearing at all, or what not

too bad I don’t have mac OS so as to develop an app for iOS, guess i will stick with the phonegap instead for now


#7

Most of these issue are typical issue with cordova and android <4.4. Since those versions of android use the default browser webview as opposed to 4.4 using chrome for its webview.

We try to make dealing with these issue less of a pain, but we understand that there is a lot of work that needs to be done. Thankfully people out there have found other solutions to make older versions of android a much better experience.


Both of these let you use chrome webview instead of the default webview.

For the keyboard, you should check out our blog, where we documented our struggle to get cordova’s keyboard plugin to work properly. This lead us to fork it and optimize it for ionic :smile:

http://ionicframework.com/blog/ionic-keyboard/

Also, remember ionic is just the UI, we use cordova/phonegap to make the magic happen. So these issue will always be present, with or without ionic.


#8

Hi,

I’m building a small app with ionic and I need to access device’s audio files and play them.
Can you point me to a solution?

Thanks