[android-developers] Re: MediaPlayer not running - just blank screen
Thanks for your reply, but still not working.. Now i am trying with this code... import android.app.Activity; import android.media.MediaPlayer; import android.os.Bundle; import android.util.Log; import android.view.SurfaceHolder; import android.view.SurfaceView; import android.widget.MediaController.MediaPlayerControl; public class Monster extends Activity implements SurfaceHolder.Callback, MediaPlayer.OnPreparedListener { SurfaceView mPreview; SurfaceHolder holder; MediaPlayer mediaplayer; int mVideoWidth,mVideoHeight; public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.bushentry); mPreview = (SurfaceView)findViewById(R.id.surface); holder = mPreview.getHolder(); holder.addCallback(this); holder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS); mediaplayer = MediaPlayer.create(this, R.raw.monster); mediaplayer.start(); mediaplayer.setDisplay(holder); mediaplayer.setOnPreparedListener(this); } public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) { } public void surfaceCreated(SurfaceHolder holder1) { mVideoWidth = mediaplayer.getVideoWidth(); mVideoHeight = mediaplayer.getVideoHeight(); if (mVideoWidth != 0 mVideoHeight != 0) { holder.setFixedSize(mVideoWidth, mVideoHeight); mediaplayer.start(); } } public void surfaceDestroyed(SurfaceHolder holder) { } public void onPrepared(MediaPlayer mp) { mVideoWidth = mediaplayer.getVideoWidth(); mVideoHeight = mediaplayer.getVideoHeight(); if (mVideoWidth != 0 mVideoHeight != 0) { holder.setFixedSize(mVideoWidth, mVideoHeight); mediaplayer.start(); } } } Still, the same problem, no error, but blank screen, any idea please.. Nithin On Mar 5, 12:58 pm, Dave Sparks davidspa...@android.com wrote: You need to tell the mediaplayer where to display the video with setDisplaySurface(). Check out the media demo apps on developer.android.com. On Mar 4, 11:45 pm, Nithin nithin.war...@gmail.com wrote: hi, I tried a simple mediaplayer application, just to run a .3gp file. First, i put the .3gp file in Raw folder and tried to run, but nothing is displaying, just blank screen only please guide me, where i am going wrong. I dont have any xml file, is it needed ?? heres the code, which i am trying import android.app.Activity; import android.media.MediaPlayer; import android.os.Bundle; public class MonsterEntry extends Activity { public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); MediaPlayer mediaplayer = MediaPlayer.create(this, R.raw.monster); mediaplayer.start(); } } Thanks Nithin --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[android-developers] Re: MediaPlayer not running - just blank screen
did you get any error in ddms logcat ? may be your player gives error while try to play On Thu, Mar 5, 2009 at 3:14 PM, nithin nithin.war...@gmail.com wrote: Thanks for your reply, but still not working.. Now i am trying with this code... import android.app.Activity; import android.media.MediaPlayer; import android.os.Bundle; import android.util.Log; import android.view.SurfaceHolder; import android.view.SurfaceView; import android.widget.MediaController.MediaPlayerControl; public class Monster extends Activity implements SurfaceHolder.Callback, MediaPlayer.OnPreparedListener { SurfaceView mPreview; SurfaceHolder holder; MediaPlayer mediaplayer; int mVideoWidth,mVideoHeight; public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.bushentry); mPreview = (SurfaceView)findViewById(R.id.surface); holder = mPreview.getHolder(); holder.addCallback(this); holder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS); mediaplayer = MediaPlayer.create(this, R.raw.monster); mediaplayer.start(); mediaplayer.setDisplay(holder); mediaplayer.setOnPreparedListener(this); } public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) { } public void surfaceCreated(SurfaceHolder holder1) { mVideoWidth = mediaplayer.getVideoWidth(); mVideoHeight = mediaplayer.getVideoHeight(); if (mVideoWidth != 0 mVideoHeight != 0) { holder.setFixedSize(mVideoWidth, mVideoHeight); mediaplayer.start(); } } public void surfaceDestroyed(SurfaceHolder holder) { } public void onPrepared(MediaPlayer mp) { mVideoWidth = mediaplayer.getVideoWidth(); mVideoHeight = mediaplayer.getVideoHeight(); if (mVideoWidth != 0 mVideoHeight != 0) { holder.setFixedSize(mVideoWidth, mVideoHeight); mediaplayer.start(); } } } Still, the same problem, no error, but blank screen, any idea please.. Nithin On Mar 5, 12:58 pm, Dave Sparks davidspa...@android.com wrote: You need to tell the mediaplayer where to display the video with setDisplaySurface(). Check out the media demo apps on developer.android.com. On Mar 4, 11:45 pm, Nithin nithin.war...@gmail.com wrote: hi, I tried a simple mediaplayer application, just to run a .3gp file. First, i put the .3gp file in Raw folder and tried to run, but nothing is displaying, just blank screen only please guide me, where i am going wrong. I dont have any xml file, is it needed ?? heres the code, which i am trying import android.app.Activity; import android.media.MediaPlayer; import android.os.Bundle; public class MonsterEntry extends Activity { public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); MediaPlayer mediaplayer = MediaPlayer.create(this, R.raw.monster); mediaplayer.start(); } } Thanks Nithin -- Dilli Rao. M --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[android-developers] Re: MediaPlayer not running - just blank screen
no, there is no error in logcat... i put log messages every where and logcat showing all messages, but no video is playing.. Nithin On Mar 5, 2:48 pm, dillirao malipeddi dillir...@arijasoft.com wrote: did you get any error in ddms logcat ? may be your player gives error while try to play On Thu, Mar 5, 2009 at 3:14 PM, nithin nithin.war...@gmail.com wrote: Thanks for your reply, but still not working.. Now i am trying with this code... import android.app.Activity; import android.media.MediaPlayer; import android.os.Bundle; import android.util.Log; import android.view.SurfaceHolder; import android.view.SurfaceView; import android.widget.MediaController.MediaPlayerControl; public class Monster extends Activity implements SurfaceHolder.Callback, MediaPlayer.OnPreparedListener { SurfaceView mPreview; SurfaceHolder holder; MediaPlayer mediaplayer; int mVideoWidth,mVideoHeight; public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.bushentry); mPreview = (SurfaceView)findViewById(R.id.surface); holder = mPreview.getHolder(); holder.addCallback(this); holder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS); mediaplayer = MediaPlayer.create(this, R.raw.monster); mediaplayer.start(); mediaplayer.setDisplay(holder); mediaplayer.setOnPreparedListener(this); } public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) { } public void surfaceCreated(SurfaceHolder holder1) { mVideoWidth = mediaplayer.getVideoWidth(); mVideoHeight = mediaplayer.getVideoHeight(); if (mVideoWidth != 0 mVideoHeight != 0) { holder.setFixedSize(mVideoWidth, mVideoHeight); mediaplayer.start(); } } public void surfaceDestroyed(SurfaceHolder holder) { } public void onPrepared(MediaPlayer mp) { mVideoWidth = mediaplayer.getVideoWidth(); mVideoHeight = mediaplayer.getVideoHeight(); if (mVideoWidth != 0 mVideoHeight != 0) { holder.setFixedSize(mVideoWidth, mVideoHeight); mediaplayer.start(); } } } Still, the same problem, no error, but blank screen, any idea please.. Nithin On Mar 5, 12:58 pm, Dave Sparks davidspa...@android.com wrote: You need to tell the mediaplayer where to display the video with setDisplaySurface(). Check out the media demo apps on developer.android.com. On Mar 4, 11:45 pm, Nithin nithin.war...@gmail.com wrote: hi, I tried a simple mediaplayer application, just to run a .3gp file. First, i put the .3gp file in Raw folder and tried to run, but nothing is displaying, just blank screen only please guide me, where i am going wrong. I dont have any xml file, is it needed ?? heres the code, which i am trying import android.app.Activity; import android.media.MediaPlayer; import android.os.Bundle; public class MonsterEntry extends Activity { public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); MediaPlayer mediaplayer = MediaPlayer.create(this, R.raw.monster); mediaplayer.start(); } } Thanks Nithin -- Dilli Rao. M --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[android-developers] Re: MediaPlayer not running - just blank screen
ya, i saw log messages, in that, getVideoSize returning -1... what may be the reason for that, any idea please.. Nithin 03-05 14:59:43.072: INFO/(324): 111 03-05 14:59:43.113: INFO/222(324): 03-05 14:59:43.123: INFO/333(324): 33 03-05 14:59:43.333: INFO/(324): 03-05 14:59:43.412: INFO/666(324): 666 03-05 14:59:43.412: ERROR/MediaPlayerService(24): getVideoSize returned -1 03-05 14:59:43.424: ERROR/MediaPlayerService(24): getVideoSize returned -1 03-05 14:59:43.634: INFO/5(324): 55 03-05 14:59:43.644: ERROR/MediaPlayerService(24): getVideoSize returned -1 03-05 14:59:43.654: ERROR/MediaPlayerService(24): getVideoSize returned -1 03-05 14:59:43.714: INFO/ActivityManager(46): Displayed activity com.monster/.Monster: 735 ms 03-05 14:59:48.863: DEBUG/dalvikvm(94): GC freed 1037 objects / 53600 bytes in 68ms 03-05 14:59:51.931: WARN/AudioFlinger(24): write blocked for 157 msecs 03-05 14:59:53.465: WARN/AudioFlinger(24): write blocked for 146 msecs 03-05 14:59:54.915: WARN/AudioFlinger(24): write blocked for 259 msecs 03-05 14:59:55.094: WARN/AudioFlinger(24): write blocked for 130 msecs 03-05 14:59:55.190: WARN/AudioFlinger(24): write blocked for 58 msecs 03-05 14:59:55.449: WARN/AudioFlinger(24): write blocked for 96 msecs 03-05 14:59:56.705: WARN/AudioFlinger(24): write blocked for 75 msecs 03-05 15:05:42.232: DEBUG/dalvikvm(88): GC freed 9596 objects / 538312 bytes in 73ms 03-05 15:21:10.564: DEBUG/dalvikvm(88): GC freed 9289 objects / 524248 bytes in 90ms On Mar 5, 3:03 pm, nithin nithin.war...@gmail.com wrote: no, there is no error in logcat... i put log messages every where and logcat showing all messages, but no video is playing.. Nithin On Mar 5, 2:48 pm, dillirao malipeddi dillir...@arijasoft.com wrote: did you get any error in ddms logcat ? may be your player gives error while try to play On Thu, Mar 5, 2009 at 3:14 PM, nithin nithin.war...@gmail.com wrote: Thanks for your reply, but still not working.. Now i am trying with this code... import android.app.Activity; import android.media.MediaPlayer; import android.os.Bundle; import android.util.Log; import android.view.SurfaceHolder; import android.view.SurfaceView; import android.widget.MediaController.MediaPlayerControl; public class Monster extends Activity implements SurfaceHolder.Callback, MediaPlayer.OnPreparedListener { SurfaceView mPreview; SurfaceHolder holder; MediaPlayer mediaplayer; int mVideoWidth,mVideoHeight; public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.bushentry); mPreview = (SurfaceView)findViewById(R.id.surface); holder = mPreview.getHolder(); holder.addCallback(this); holder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS); mediaplayer = MediaPlayer.create(this, R.raw.monster); mediaplayer.start(); mediaplayer.setDisplay(holder); mediaplayer.setOnPreparedListener(this); } public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) { } public void surfaceCreated(SurfaceHolder holder1) { mVideoWidth = mediaplayer.getVideoWidth(); mVideoHeight = mediaplayer.getVideoHeight(); if (mVideoWidth != 0 mVideoHeight != 0) { holder.setFixedSize(mVideoWidth, mVideoHeight); mediaplayer.start(); } } public void surfaceDestroyed(SurfaceHolder holder) { } public void onPrepared(MediaPlayer mp) { mVideoWidth = mediaplayer.getVideoWidth(); mVideoHeight = mediaplayer.getVideoHeight(); if (mVideoWidth != 0 mVideoHeight != 0) { holder.setFixedSize(mVideoWidth, mVideoHeight); mediaplayer.start(); } } } Still, the same problem, no error, but blank screen, any idea please.. Nithin On Mar 5, 12:58 pm, Dave Sparks davidspa...@android.com wrote: You need to tell the mediaplayer where to display the video with setDisplaySurface(). Check out the media demo apps on developer.android.com. On Mar 4, 11:45 pm, Nithin nithin.war...@gmail.com wrote: hi, I tried a simple mediaplayer application, just to run a .3gp file. First, i put the .3gp file in Raw folder and tried to run, but nothing is displaying, just blank screen only please guide me, where i am going wrong. I dont have any xml file, is it needed ?? heres the code, which i am trying import android.app.Activity; import
[android-developers] Re: MediaPlayer not running - just blank screen
That won't work for a number of reasons: - when you create the MediaPlayer and call start(), your display isn't ready yet. You need to wait for the surfaceCreated() callback. - you need to use the version of MediaPlayer.create() that takes a SurfaceHolder parameter. (this was all discussed on this mailing list a few weeks ago, you might want to search the archives) On Thu, Mar 5, 2009 at 1:44 AM, nithin nithin.war...@gmail.com wrote: Thanks for your reply, but still not working.. Now i am trying with this code... import android.app.Activity; import android.media.MediaPlayer; import android.os.Bundle; import android.util.Log; import android.view.SurfaceHolder; import android.view.SurfaceView; import android.widget.MediaController.MediaPlayerControl; public class Monster extends Activity implements SurfaceHolder.Callback, MediaPlayer.OnPreparedListener { SurfaceView mPreview; SurfaceHolder holder; MediaPlayer mediaplayer; int mVideoWidth,mVideoHeight; public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.bushentry); mPreview = (SurfaceView)findViewById(R.id.surface); holder = mPreview.getHolder(); holder.addCallback(this); holder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS); mediaplayer = MediaPlayer.create(this, R.raw.monster); mediaplayer.start(); mediaplayer.setDisplay(holder); mediaplayer.setOnPreparedListener(this); } public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) { } public void surfaceCreated(SurfaceHolder holder1) { mVideoWidth = mediaplayer.getVideoWidth(); mVideoHeight = mediaplayer.getVideoHeight(); if (mVideoWidth != 0 mVideoHeight != 0) { holder.setFixedSize(mVideoWidth, mVideoHeight); mediaplayer.start(); } } public void surfaceDestroyed(SurfaceHolder holder) { } public void onPrepared(MediaPlayer mp) { mVideoWidth = mediaplayer.getVideoWidth(); mVideoHeight = mediaplayer.getVideoHeight(); if (mVideoWidth != 0 mVideoHeight != 0) { holder.setFixedSize(mVideoWidth, mVideoHeight); mediaplayer.start(); } } } Still, the same problem, no error, but blank screen, any idea please.. Nithin On Mar 5, 12:58 pm, Dave Sparks davidspa...@android.com wrote: You need to tell the mediaplayer where to display the video with setDisplaySurface(). Check out the media demo apps on developer.android.com. On Mar 4, 11:45 pm, Nithin nithin.war...@gmail.com wrote: hi, I tried a simple mediaplayer application, just to run a .3gp file. First, i put the .3gp file in Raw folder and tried to run, but nothing is displaying, just blank screen only please guide me, where i am going wrong. I dont have any xml file, is it needed ?? heres the code, which i am trying import android.app.Activity; import android.media.MediaPlayer; import android.os.Bundle; public class MonsterEntry extends Activity { public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); MediaPlayer mediaplayer = MediaPlayer.create(this, R.raw.monster); mediaplayer.start(); } } Thanks Nithin --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[android-developers] Re: MediaPlayer not running - just blank screen
Thanks marco, at last got it... thanks for your valuable input.. Nithin On Mar 5, 10:02 pm, Marco Nelissen marc...@android.com wrote: That won't work for a number of reasons: - when you create theMediaPlayerand call start(), your display isn't ready yet. You need to wait for the surfaceCreated() callback. - you need to use the version ofMediaPlayer.create() that takes a SurfaceHolder parameter. (this was all discussed on this mailing list a few weeks ago, you might want to search the archives) On Thu, Mar 5, 2009 at 1:44 AM, nithin nithin.war...@gmail.com wrote: Thanks for your reply, but still not working.. Now i am trying with this code... import android.app.Activity; import android.media.MediaPlayer; import android.os.Bundle; import android.util.Log; import android.view.SurfaceHolder; import android.view.SurfaceView; import android.widget.MediaController.MediaPlayerControl; public class Monster extends Activity implements SurfaceHolder.Callback,MediaPlayer.OnPreparedListener { SurfaceView mPreview; SurfaceHolder holder; MediaPlayermediaplayer; int mVideoWidth,mVideoHeight; public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.bushentry); mPreview = (SurfaceView)findViewById(R.id.surface); holder = mPreview.getHolder(); holder.addCallback(this); holder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS); mediaplayer=MediaPlayer.create(this, R.raw.monster); mediaplayer.start(); mediaplayer.setDisplay(holder); mediaplayer.setOnPreparedListener(this); } public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) { } public void surfaceCreated(SurfaceHolder holder1) { mVideoWidth =mediaplayer.getVideoWidth(); mVideoHeight =mediaplayer.getVideoHeight(); if (mVideoWidth != 0 mVideoHeight != 0) { holder.setFixedSize(mVideoWidth, mVideoHeight); mediaplayer.start(); } } public void surfaceDestroyed(SurfaceHolder holder) { } public void onPrepared(MediaPlayermp) { mVideoWidth =mediaplayer.getVideoWidth(); mVideoHeight =mediaplayer.getVideoHeight(); if (mVideoWidth != 0 mVideoHeight != 0) { holder.setFixedSize(mVideoWidth, mVideoHeight); mediaplayer.start(); } } } Still, the same problem, no error, but blank screen, any idea please.. Nithin On Mar 5, 12:58 pm, Dave Sparks davidspa...@android.com wrote: You need to tell themediaplayerwhere to display the video with setDisplaySurface(). Check out the media demo apps on developer.android.com. On Mar 4, 11:45 pm, Nithin nithin.war...@gmail.com wrote: hi, I tried a simplemediaplayerapplication, just to run a .3gp file. First, i put the .3gp file in Raw folder and tried to run, but nothing is displaying, just blank screen only please guide me, where i am going wrong. I dont have any xml file, is it needed ?? heres the code, which i am trying import android.app.Activity; import android.media.MediaPlayer; import android.os.Bundle; public class MonsterEntry extends Activity { public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); MediaPlayermediaplayer=MediaPlayer.create(this, R.raw.monster); mediaplayer.start(); } } Thanks Nithin --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[android-developers] Re: MediaPlayer not running - just blank screen
you must set parameters for playing video see api demos - examples media - video demo player On Thu, Mar 5, 2009 at 1:15 PM, Nithin nithin.war...@gmail.com wrote: hi, I tried a simple mediaplayer application, just to run a .3gp file. First, i put the .3gp file in Raw folder and tried to run, but nothing is displaying, just blank screen only please guide me, where i am going wrong. I dont have any xml file, is it needed ?? heres the code, which i am trying import android.app.Activity; import android.media.MediaPlayer; import android.os.Bundle; public class MonsterEntry extends Activity { public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); MediaPlayer mediaplayer = MediaPlayer.create(this, R.raw.monster); mediaplayer.start(); } } Thanks Nithin -- Dilli Rao. M ARIJASOFT +91 - 9703073540 --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[android-developers] Re: MediaPlayer not running - just blank screen
You need to tell the mediaplayer where to display the video with setDisplaySurface(). Check out the media demo apps on developer.android.com. On Mar 4, 11:45 pm, Nithin nithin.war...@gmail.com wrote: hi, I tried a simple mediaplayer application, just to run a .3gp file. First, i put the .3gp file in Raw folder and tried to run, but nothing is displaying, just blank screen only please guide me, where i am going wrong. I dont have any xml file, is it needed ?? heres the code, which i am trying import android.app.Activity; import android.media.MediaPlayer; import android.os.Bundle; public class MonsterEntry extends Activity { public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); MediaPlayer mediaplayer = MediaPlayer.create(this, R.raw.monster); mediaplayer.start(); } } Thanks Nithin --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---