i thought it may be with an intent but can't find anything, nor can i find anything in the mediaplayer class, but what do i have to do to trigger the stock music player and do i have to pass in a filename as the param?
mhh, something like:
Code:
Uri data = Uri.parse("file://" + mf1.getFilename());
MediaPlayer mp = android.media.MediaPlayer.create(this, data);
mp.start();
will only trigger it as a background process, not switch to it. and an intent view seems to launch a mini player inside the app, so how do i switch to the music player?
http://forum.xda-developers.com/showpost.php?p=13036528&postcount=4
Note: TouchWiz has it's own DB for music for Samsung phones, so you know, we hate them (and the second method may/maynot work on TouchWiz phones).
thanks, i need to get my head around querying the content provider now!
Related
Right now I'm using Microsoft Voice Command to play music through my HT820's, but when I say, for instance, "Play Red Hot Chili Peppers", though I have several mp3's worth of their music, it will only find and queue 1 of their songs. I'm thinking that WMP is the bottleneck and isn't reading the tags on the mp3's quite the same way HTC Audio is, which is my preferred media player, and also finds all of the artist names (If I go to the "artist" section of WMP it only shows 6 categories; "All Songs by Artist", "Unknown", "Sample Artist 1", "Sample Artist 2", 'Van Morrison"). I have about 1.75 GB of music on my 4 GB card, and I'd like to try this setup out with HTC Audio as the default (If it's possible) to see if it'll resolve the remaining tie-ups.
Hello everyone,
i'm trying to do a podcast software, but i can't find a way to play music througth the default media player.
What should i use?
I use now Mediaplayer() but it has no user interface (no pause, forward ...) which is pretty annoying.
Thank you for your answers!
Have you looked at the MediaController class:
http://developer.android.com/reference/android/widget/MediaController.html
By now, i used another method with Intent.
String path = "/sdcard/feed/"+ title+"/"+fileName + ".mp3";
Intent myIntent =new Intent(android.content.Intent.ACTION_VIEW);
myIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
myIntent.setDataAndType(Uri.parse("file://"+ path),"audio/*");
startActivity(myIntent);
Which actually works for mp3s.
I am looking for the basic Android downloader (the one used by the market for example)
Do you know how to use it?
Thank you a lot
So you want to download the file first to the sdcard, then play it by launching the default program for MIME type "audio/*"? seems convoluted. The MediaPlayer object will do all this for you in streaming mode and the MediaController class will give you a nice interface.
Otherwise, I don't know what you mean by "basic Android downloader".
Building an app that tracks your music plays Last.fm-style; is there anywhere with a list of the Intents different players send out w/ metadata on a track change? Ex: Sense uses
Code:
com.htc.music.metachanged
. Looking for 3rd-party (non-bundled) players in particular.
I have a media file playing in the oncreate, and everytime i switch over to landscape it replays the audio file, i cannot restrict it from turning to land scape because thats the purpose of the app, is there any way i can possible pause the player and start it up again once its on landscape?
i tried
if(alert.isPlaying() == true){
alert.stop;
}else{
alert.start;
}
Click to expand...
Click to collapse
I just typed this out in this post so i know i made an error, im still new to android programming.
Please and thank you,
Alexander Napoles
Take a look at this.
You could also save if it has already been played in a variable.
Or make an extra class, maybe as activity to play to play the audio file. Use an addiotinaly variable to procted the class from being created twice, because we only want to play it once.
This should keep running in the background and not start again when going landscape mode because it is not part of the activity that is getting recreated when you switch your gui to landscape.
Thank you "Clicks Thanks button" Im going to be testing this out tomorrow morning.
I have an Online Radio App and would like to add some sort of recording feature on it. I have done quite a bit of research and found one solution and from what I understand maybe the only solution is to rip it byte by byte. I have also tried to use the built in android recording method but it only records from the mic and I do not know or cannot figure out how to record from an external source such as a url like http://92.68.34.221:7000. Currently I am using the default Android media player method to play the url and its working flawlessly problem is I would like to set up the recording feature as a service to where when a the button is clicked run the service start recording and when it is clicked again terminate the service and save the file in a folder called online radio. Button might end up being a ToggleButton. I would really appreciate it if anyone could help me out and steer me in the right direction. Thanks in Advance
Saving a stream to file is quite easy, but if you want to define the exact start and end point of saving/recording by a button click it gets difficult.
You'll have to change your implementation a lot. Your android mediaplayer class handles everything for you, it opens the stream, fills a buffer and starts playing when the buffer is full. The mediaplayer doesn't offer any access to the bytes that it received.
Next problem: If you click on the button to start recording, the bytes you are listening to, have been in the (internal) buffer for an unknown amount of time. So you can't just open another connection to the stream url to start saving the bytes.
I would try it this way:
Implement these three parts in three different threads.
1. Use android.media.MediaExtractor to open the stream and implement a ringbuffer to store the extracted bytes
2. Use android.media.MediaCodec to decode your stream to pcm.
3. And use android.media.AudioTrack to play the pcm stream
Choose the size of the ringbuffer as large as the buffer of the AudioTrack. (Size in seconds, not in bytes!)
When the user clicks on the record button, you can read the data out of the ringbuffer, (encode them back to mp3 or something else) and save them to a file.
Not very easy for a beginner, but its a way you can do it.