Iam a learner of creating android custom app. I create simple app using HTML files via Quick-App-v1.1. I have include the audio file in html file. it's properly play when open the HTML file in browsers, but when create the app the audio file not playing. Please advice me.
Create a folder in Android Studio under 'res' and name it 'raw'.
Copy your audio file to the raw folder.
To play the audio file you can use something such as:
MediaPlayer song;
//then play it inside your onCreate
song = MediaPlayer.create(this, R.raw.YOUR_SONG_NAME);
song.start();
Check this out:
http://developer.android.com/reference/android/media/MediaPlayer.html
Related
I tried to add a mp3 song to android, exactly like this explanation, but it's not recognizing my mp3 file as sound, and shows me this error message:
Try putting the mp3 file in assets folder.
Please clear the empty characters in the filename.
I have created a music player using kivy. it is working fine for MP3 songs on Linux.
But when I am converting that into APK file using buildozer, then it is giving error that unable to load the file.
I am using sound loader of kivy to play the files.
This is working fine for .wav file and .ogg file. Error is coming only for MP3 files.
Any suggestions will be helpful.
Thanks in advance
Kivy only loads wav and ogg files on Android. Also make sure...
You load the sound file with kivy.core.audio.SoundLoader.load
You check if <SOUND_FILE_VARIABLE>: before you change the state of the sound because if the file doesn't exist or Kivy couldn't load the file, the sound file variable would be None
If the file is too long, the audio might be glitchy on Android.
How to notify the android that a mp3 file is added to the storage and let it display the file inside the music app? I am converting a video to audio, but the file is not displaying in the music player. Now, I moved the file from one folder to another using File Manager. Now the music player is displaying the file. Shall I notify the android that a media file is added so that the music player can display it??
Probably you're looking for Media ScannerConnection Class. Just have a look in the developer site here:
MediaScannerConnection
I am trying to play an .pls file (available at http://stream.radiosai.net:8002/listen.pls) in android 2.2. But it isn't working. Playing MP3 works fine.
A pls or a playlist file is basically a text file with the path of each track in each entry. Kind of like an .ini file. Take a look at the WP entry.
I don't think the inbuilt MediaPlayer supports these formats, so you'll have to download the file and parse the file and play the actual mp3's one by one.
Android doesn't support the .pls format. Link
I have a video file that file extension is.mp4. I placed it in assets folder. Now I want to play this video in my app. Anyone give me some code suggestions for this.