Hi, Maybe you didn't post all your code, But I didn't find mMediaPlayer.start();
You'd better try some more STANDARD format first like MP4. Best Regards LiangLiang Li > Date: Wed, 19 Aug 2009 01:44:19 -0700 > Subject: [android-developers] Re: media player exception > From: [email protected] > To: [email protected] > > > I am trying from hours to play a video file from raw resource but no > success. > > I have tried > > setContentView(R.layout.mediaplayer_2); > mPreview = (SurfaceView) findViewById(R.id.surface); > holder = mPreview.getHolder(); > > // Create a new media player and set the listeners > mMediaPlayer = new MediaPlayer() ; > > AssetFileDescriptor afd = getResources().openRawResourceFd > (R.raw.lucky); > mMediaPlayer.setDataSource(afd.getFileDescriptor(), > afd.getStartOffset(), afd.getLength()); > mMediaPlayer.setDisplay(holder); > > // mMediaPlayer.prepare(); > mMediaPlayer.setOnBufferingUpdateListener(this); > mMediaPlayer.setOnCompletionListener(this); > mMediaPlayer.setOnPreparedListener(this); > mMediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC); > > > nothing happens on the screen and it just stand idle ,neither > OnBuffering event called nor onCompletion Event. I have tried to play > boht wmv and 3gp file. but nothing works . please advise what i m > missing. > > > On Aug 19, 7:57 am, riz <[email protected]> wrote: > > ok Nelisson , I will , > > but tell me how can load a movie from resource through media Player or > > any other alternative,please ......... > > > > On Aug 18, 9:00 pm, Marco Nelissen <[email protected]> wrote: > > > > > On Tue, Aug 18, 2009 at 12:07 AM,rizwan<[email protected]> wrote: > > > > > > Hi, > > > > > > I m trying to run a simple media player activity .............. > > > > > > public void onCreate(Bundle icicle) { > > > > super.onCreate(icicle); > > > > > > try { > > > > > > /* > > > > * TODO: Set the path variable to a local media > > > > file path. > > > > */ > > > > setContentView(R.layout.mediaplayer_2); > > > > mPreview = (SurfaceView) findViewById(R.id.surface); > > > > holder = mPreview.getHolder(); > > > > > > // Create a new media player and set the listeners > > > > mMediaPlayer = MediaPlayer.create(this, R.raw.lucky); > > > > mMediaPlayer.setDisplay(holder); > > > > mMediaPlayer.prepare(); > > > > > That won't work, because MediaPlayer.create() calls prepare() > > > internally, and you can't call prepare() twice. > > > It shouldn't cause a native crash though. Can you file a bug > > > athttp://b.android.com, and attach the file you're trying to play? > > _________________________________________________________________ 张三挖到了元宝,小美又掉进陷阱了,快来MClub与好友齐乐乐!立刻访问! http://club.msn.cn/?from=3 --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~----------~----~----~----~------~----~------~--~---

