When I download MP3 files with my app they go to the download folder and when I navigate there and try to play them I get content not supported. I have looked around a little bit, but can't figure out why. Anyone know how I can fix this, is it something with the MIME types? What does this do:
connection.setRequestProperty("Content-Type", "audio/*");
MP3 • Mono/Stereo 8-320Kbps constant (CBR) or variable bit-rate
(VBR) MP3 (.mp3)
Android Supports MP3 in the above format. Incorrect encoding makes this type of error. Also check to see if the extension and file names are proper. Because some downloaders may name the file like mywebsite.com-mysong.mp3. The android OS may wrongly interpret the file as a .com file rather than a .mp3 file.
Reference:
http://developer.android.com/guide/appendix/media-formats.html#core
Please ensure you save with the .mp3 extension. sometimes it can get lost along the way.
Related
I have mp4 and avi, two types of files on sdcard. Should I need to give full name with extension in code to play this file?
Please help me regarding this.
You will get IOException.
You are setting the path in setDataSource.
For example,
You want to play sdcard/yourMP4file.mp4,if you are not giving full path,then it will take sdcard/yourMP4file as filepath.....
Actually sdcard/yourMP4file does not exists,what exists is sdcard/yourMP4file.mp4. So you will get IOException
Without the extension, the file can not be found correctly. SetDatasource will throw out exception.
http://developer.android.com/reference/android/media/MediaPlayer.html#setDataSource(java.lang.String)
I have a simple Android webview app, built with Phonegap Build. When trying to play a local mp3 file that's included in the APK, nothing happens. However, if I pull an mp3 from the web it works.
e.g.
<audio src="www.example.com/01.mp3" > WORKS JUST FINE
<audio src="01.mp3" > DOES NOT WORK
I'm new to Android development, so I can only guess that the file is somehow inaccessible by Android's media player. Here's a link to the errors/warnings from my log file if that helps shed any light on the problem.
http://pastebin.com/isS542RE
I have it working using Phonegap's Media class. I must have been doing something wrong initially, but I'm not sure what. The proper way to access it through the media object is as Simon stated previously:
myMedia = new Media("/android_asset/www/test.mp3");
You have to put the full path as the media class defaults to the /SDCARD directory on relative paths.
Simon also has a great write up about using the media class:
http://simonmacdonald.blogspot.com/2011/05/using-media-class-in-phonegap.html?m=1
As for the HTML5 method and using the AUDIO tag, I'm still not certain why it fails on local files. Phonegap's media class works just fine though and is probably a more reliable solution anyhow. Phonegap FTW!
Have you tried pointing the file to the local file system path using "file:///android_assets/01.mp3" assuming your .mp3 is within the applications assets directory?
We had the same problem, the media files, in order to be played, needs to be in the external storage dir. Try to move your HTML and related files to /mnt/sdcard/.
I filed an official bug report on this:
http://code.google.com/p/android/issues/detail?id=41995&thanks=41995&ts=1356643666
My question is I have used many examples of http uploads of files for the android. They all seem to work except for video files that are .3gpp. I use the same code for .mov video files and it works OK. On the web side is just a PHP script. Does any know or have successfully uploaded a video (.3gpp) to a server? I don't get any error that I can see. The code I use also works for image files (jpg). It's just the .3gpp file type.
Thanks for any help you can give me..
isnt it 3gp
is it possible u are giving it the wrong extension?
i would say that the method u are using to upload should be pretty dumb to what files its uploading so it should work (as u said). the only other thing is i would try to match file size. so do a 5mb picture then a 5min video to ensure it is the file type causing the error
i would also say that maybe the 3 in the extension could cause problems (depending on how or what is reading it)
1.What are the benefits if using oggvorbis over mp3 in android?
2.if we use ogg vorbis,is it possible to change its header(xor or encryption) and make it unplayble?
regards,
hitendra gohil
The problem is more specific to encryption rather than using ogg or mp3, I had a similar issue where client wants that the downloaded images can only be viewed through his apps, what I applied is I cut the 32 bytes from the beginning of every file and write it database and when I want the resource to be used I pick that 32 bytes and the original file to make usable file at some hidden location.
I hope the point is clear and might help.
I have a requirement of playing a Asx stream through an Android application
I have read the Android documentation, and they don't seem to support Windows Media streams
Is there any workaround possible? Has anyone did that before? If yes, is there some source code available? Or a library that implements this
Thanks
Are you worried about asx file only or any possible outcome after this?
The asx file can be readable as simple string, read the file using byte array and you can get one or many urls that can be
pls file
m3u file
mp3 url
wma url
We don't have to worry about 1,2 and 3. 1 and 2 can have different parsing logics but at the end they will give 3 [mp3 url] and an mp3 url can be easily handled by MediaPlayer api in android . but 4 is also difficult work to be done.