Hi Riz

Did you get a chance to file the bug for crash. This is not specific
to file I believe. I get the same crash with a different .3gp file
when prepare is called after create.

Regds,
Venky

On Aug 19, 3:14 pm, riz <rizcs...@gmail.com> wrote:
> I m trying to play mp4 
> moviehttp://www.mp4mail.com/docs/files/disney_128v_16a.mp4
> .mediaplayer.start() method is onprepaidEventListener() , but still no
> success. please help me
>
> I m using this code
>
> 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 = new MediaPlayer() ;
>
>                 AssetFileDescriptor afd = getResources().openRawResourceFd
> (R.raw.disney);
>                      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);
>
> } catch (Exception e) {
>
>         Log.e(TAG, "error: " + e.getMessage(), e);
>         }
>
> }
>
> public void onBufferingUpdate(MediaPlayer arg0, int percent) {
> Log.d(TAG, "onBufferingUpdate percent:" + percent);
>
> }
>
> public void onCompletion(MediaPlayer arg0) {
> Log.d(TAG, "onCompletion called");
>
> }
>
> public void onPrepared(MediaPlayer mediaplayer) {
>         try  {
>                 Log.d(TAG, "onPrepared called");
>                 mVideoWidth = mMediaPlayer.getVideoWidth();
>                 mVideoHeight = mMediaPlayer.getVideoHeight();
>                 Log.d(TAG, "VideoWidth :"+mVideoWidth);
>                 Log.d(TAG, "VideoHeight :"+mVideoHeight);
>                 if (mVideoWidth != 0 && mVideoHeight != 0) {
>                         holder.setFixedSize(mVideoWidth, mVideoHeight);
>   mMediaPlayer.start();
>         Log.d(TAG, "Player Started ....");
>                 }
>         }
>                 catch(Exception e) {
>                         Log.d(TAG, "Exception Trace.." +e.getMessage());
>
>                 }
>
> }
>
> here is the stack trace
>
> I/ActivityManager(  568): Starting activity: Intent { flags=0x10000000
> comp={Hel
> lo.Android/Hello.Android.HellAndroid} }
> D/AndroidRuntime(  712): Shutting down VM
> D/dalvikvm(  712): DestroyJavaVM waiting for non-daemon threads to
> exit
> D/dalvikvm(  712): DestroyJavaVM shutting VM down
> D/dalvikvm(  712): HeapWorker thread shutting down
> D/dalvikvm(  712): HeapWorker thread has shut down
> D/jdwp    (  712): JDWP shutting down net...
> D/dalvikvm(  712): VM cleaning up
> I/ActivityManager(  568): Start proc Hello.Android for activity
> Hello.Android/.H
> ellAndroid: pid=718 uid=10019 gids={3003}
> D/dalvikvm(  712): LinearAlloc 0x0 used 637060 of 4194304 (15%)
> I/jdwp    (  653): received file descriptor 30 from ADB
> I/jdwp    (  662): received file descriptor 25 from ADB
> I/jdwp    (  681): received file descriptor 27 from ADB
> I/jdwp    (  718): received file descriptor 13 from ADB
> I/ActivityManager(  568): Displayed activity
> Hello.Android/.HellAndroid: 1542 ms
>
> D/dalvikvm(  633): GC freed 2853 objects / 162352 bytes in 132ms
> D/dalvikvm(  653): GC freed 2852 objects / 175536 bytes in 142ms
> D/dalvikvm(  662): GC freed 1248 objects / 79664 bytes in 117ms
> D/dalvikvm(  611): GC freed 2128 objects / 114400 bytes in 115ms
>
> On Aug 19, 2:03 pm, 李亮亮 <leeco...@hotmail.com> wrote:
>
> > 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: rizcs...@gmail.com
> > > To: android-developers@googlegroups.com
>
> > > 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 <rizcs...@gmail.com> 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 <marc...@android.com> wrote:
>
> > > > > On Tue, Aug 18, 2009 at 12:07 AM,rizwan<rizcs...@gmail.com> 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 android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to