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();

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

MediaPlayer.setDataSource() and prepare() not working – android

Try MediaPlayer.create(), you also may want to start only after player is actually ready, for example: @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); MediaPlayer player = MediaPlayer.create(this, Uri.parse(“http://www.urltofile.com/file.mp3”)); player.setOnPreparedListener(new OnPreparedListener() { @Override public void onPrepared(MediaPlayer mp) { mp.start(); } }); }

How to play a WPF Sound File resource

I tried this with an image file, which works the same as a sound file as far as the uri is concerned because it’s just another resource. I used the code below which essentially matches what you have. new Uri(@”pack://application:,,,/Resources/logo.png”) Make sure that your ‘Media’ folder is not nested in any other folder. If it … Read more

Android MediaPlayer Problems :”Error (-38 , 0) ” and “stop called in state 1”

Before prepare(), you need first to call setDataSource(..). The Media framework is a very strict state machine, and it’s really cumbersome to handle all the different states. I’ve used this little wrapper that makes the coding/debugging a bit easier. You can give it a try. Regarding emulator – note that not all file formats are … Read more

How do I play an mp3 in the res/raw folder of my android app?

When starting the activity i.e on onCreate put the following code. public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); MediaPlayer mPlayer = MediaPlayer.create(FakeCallScreen.this, R.raw.mysoundfile); mPlayer.start(); } When stopping the activity i.e on onDestroy put the following code. public void onDestroy() { mPlayer.stop(); super.onDestroy(); } Hope it helps 🙂

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

how to play audio file in android

Simply you can use MediaPlayer and play the audio file. Check out this nice example for playing Audio: public void audioPlayer(String path, String fileName){ //set up MediaPlayer MediaPlayer mp = new MediaPlayer(); try { mp.setDataSource(path + File.separator + fileName); mp.prepare(); mp.start(); } catch (Exception e) { e.printStackTrace(); } }