Riz Try this. holder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS); mMediaPlayer.setScreenOnWhilePlaying(true);
On Aug 20, 8:02 pm, riz <[email protected]> wrote: > when I try to createmediaPlayerthrough Create(Context,Resource_ID) > (rest of the codr remain same)it played the audio of the video file > but still no video . ......my project is stuck . I need to know how to > play video file from resource folder. ................. > > On Aug 20, 8:41 am, riz <[email protected]> wrote: > > > Hi Venky, > > No I have not file the bug yet ,if you want to file the bug then > > please go ahead. most important thing for me right now is how to play > > a resource video file in android ? > > please suggest me alternate solution . I m stuck here ,looking for a > > solution .......please help me . > > > Thanks > > Riz > > > On Aug 19, 4:39 pm, Venky <[email protected]> wrote: > > > > 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 <[email protected]> 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 localmedia > > > > file path. > > > > */ > > > > setContentView(R.layout.mediaplayer_2); > > > > mPreview = (SurfaceView) findViewById(R.id.surface); > > > > holder = mPreview.getHolder(); > > > > > // Create a newmediaplayerand 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 (Exceptione) { > > > > > 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, "PlayerStarted ...."); > > > > } > > > > } > > > > catch(Exceptione) { > > > > Log.d(TAG, "ExceptionTrace.." +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, 李亮亮 <[email protected]> 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:mediaplayerexception > > > > > > 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 newmediaplayerand 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 > > > > > > > throughmediaPlayeror > > > > > > > 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 simplemediaplayeractivity .............. > > > > > > > > > > public void onCreate(Bundle icicle) { > > > > > > > > > super.onCreate(icicle); > > > > > > > > > > try { > > > > > > > > > > /* > > > > > > > > > * TODO: Set the path variable to a localmedia > > > > > > > > > file path. > > > > > > > > > */ > > > > > > > > > setContentView(R.layout.mediaplayer_2); > > > > > > > > > mPreview = (SurfaceView) findViewById(R.id.surface); > > > > > > > > > holder = mPreview.getHolder(); > > > > > > > > > > // Create a newmediaplayerand 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-Hide > > > > > quoted text - > > > - Show quoted text - --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---

