How to resume the mediaplayer?

Thank you for your attention but I’ve got it myself for pausing the Mediaplayer I used: Mediaplayer.pause(); length=Mediaplayer.getCurrentPosition(); and for resuming the player from the position where it stopped lately is done by: Mediaplayer.seekTo(length); Mediaplayer.start();

Online radio streaming app for Android

So I found this sample and it works for me, here it is if you have the same issue: in myMain.java import android.app.Activity; import android.os.Bundle; import java.io.IOException; import android.media.MediaPlayer; import android.media.MediaPlayer.OnBufferingUpdateListener; import android.media.MediaPlayer.OnPreparedListener; import android.util.Log; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.ProgressBar; public class myMain extends Activity implements OnClickListener { private ProgressBar playSeekBar; private … Read more

AudioTrack, SoundPool or MediaPlayer, which should I use?

SoundPool is actually an audio mixer. It can play short clips only, regardless of whether they are encoded as “ogg” or “mp3” or they are uncompressed. SoundPool always store them in memory uncompressed, and note that the limit is 1 MB. If your clip is too big in memory, SoundPool will fall silent and you’ll … Read more

How to play the audio files directly from res/raw folder?

add this code in onItemClickListener. listView.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> arg0, View view, int position,long id) { TextView txtView=(TextView)view.findViewById(R.id.txt_view); String fname=txtView.getText().toString().toLowerCase(); int resID=getResources().getIdentifier(fname, “raw”, getPackageName()); MediaPlayer mediaPlayer=MediaPlayer.create(this,resID); mediaPlayer.start(); } });

Android Media Stream Error? java.io.FileNotFoundException: No content provider :http://

Go to this file https://github.com/Old-Geek/Radio/blob/master/app/src/main/java/org/oucho/radio/Player.java#L234 and change player.setDataSource(context, Uri.parse(url)); to player.setDataSource(url) The problem is that void setDataSource (String path) Sets the data source (file-path or http/rtsp URL) to use. path String: the path of the file, or the http/rtsp URL of the stream you want to play the github code uses void setDataSource (Context context, … Read more

Android : How to set MediaPlayer volume programmatically?

Using AudioManager, you can simply control the volume of media players. AudioManager audioManager = (AudioManager)getSystemService(Context.AUDIO_SERVICE); audioManager.setStreamVolume(AudioManager.STREAM_MUSIC, 20, 0); also from MediaPlayer (But I didn’t try that) setVolume(float leftVolume, float rightVolume) Since: API Level 1 Sets the volume on this player. This API is recommended for balancing the output of audio streams within an application. Unless … Read more

Passing parameters on button action:@selector

Edit. Found a neater way! One argument that the button can receive is (id)sender. This means you can create a new button, inheriting from UIButton, that allows you to store the other intended arguments. Hopefully these two snippets illustrate what to do. myOwnbutton.argOne = someValue [myOwnbutton addTarget:self action:@selector(buttonTouchUpInside:) forControlEvents:UIControlEventTouchUpInside]; and – (IBAction) buttonTouchUpInside:(id)sender { MyOwnButton … Read more

iPhone SDK:How do you play video inside a view? Rather than fullscreen

As of the 3.2 SDK you can access the view property of MPMoviePlayerController, modify its frame and add it to your view hierarchy. MPMoviePlayerController *player = [[MPMoviePlayerController alloc] initWithContentURL:[NSURL fileURLWithPath:url]]; player.view.frame = CGRectMake(184, 200, 400, 300); [self.view addSubview:player.view]; [player play]; There’s an example here: http://www.devx.com/wireless/Article/44642/1954

tech