Thank u so much for the reply but The program does Not execute at
all.. Can u please help....

On Feb 9, 2:53 am, Dilli <[email protected]> wrote:
>  Hi
>
>  i think you fixed the size ofvideodisplay
>
>     >>>>>>>>>>>>>>  mHolder.setFixedSize(176, 144);
>
>   it may cause the problem of  videodisplaying
>
>  use  >>>>>>>>>>>> mHolder.setFixedSize(mp.getVideoWidth(),
> mp.getVideoHeight());
>
>  Regards
>
> On Feb 9, 3:58 am, Ash <[email protected]> wrote:
>
> > Playvideoonandroid
> > -------------------------------------
>
> > I'm trying toplayvideofiles onandroid...can anyone please help
> > me...
> > I'm not able to see thevideobut audio works fine... here is the code
>
> > PLEASE HELP ME... BY GUIDING ME.. BY CORRECTING THE CODE
> > OR WITH ANY NEW CODE
>
> > package com.vi3;
>
> > import java.io.IOException;
> > importandroid.app.Activity;
> > importandroid.os.Bundle;
> > importandroid.content.Context;
> > importandroid.graphics.PixelFormat;
> > importandroid.media.MediaPlayer;
> > importandroid.media.MediaPlayer.OnBufferingUpdateListener;
> > importandroid.media.MediaPlayer.OnCompletionListener;
> > importandroid.media.MediaPlayer.OnErrorListener;
> > importandroid.util.Log;
> > importandroid.view.Menu;
> > importandroid.view.SurfaceHolder;
> > importandroid.view.SurfaceView;
> > importandroid.view.Surface;
> > importandroid.view.Window;
> > //importandroid.view.Menu.Item;
>
> > public class vi3 extends Activity
> > {
> >    private static final String LOG_TAG = "|||||||||||||||||";
> >    private MediaPlayer mp;
>
> >    private Preview mPreview;
> >    //private myAcListener myListener = new myAcListener()this;
> >    /** Called when the activity is first created. */
> >   �...@override
> >    public void onCreate(Bundle icicle)
> >    {
> >       super.onCreate(icicle);
> >       Log.i(LOG_TAG, "CameraApp.onCreate");
> >       mPreview = new Preview(this);
> >       //requestWindowFeature(W);
>
> >     //  stopMedia();
> >        //     releaseMedia();
> >       setContentView(R.layout.main);
>
> >       //setContentView(mPreview);
> >       playMedia("");
>
> >    }
>
> >    private void playMedia(String s_filePath)
> >    {
> >       setContentView(mPreview);
> >       //s_filePath = "/tmp/mp4.mp4";
> >       s_filePath =  "/data/local/video/test_qcif_200_aac_64.mp4";
> >       //s_filePath = "/tmp/test.mpg";
> >       //s_filePath = "/tmp/3.3gp";
> >       Log.i(LOG_TAG, "CameraApp.playMedia");
> >       mp = new MediaPlayer();
> >       try
> >       {
> >          mp.setDataSource(s_filePath);
> >       }
> >       catch (IllegalArgumentException e)
> >       {
> >          // TODO Auto-generated catch block
> >          Log.v(LOG_TAG,
> > "CameraApp.playMedia:IllegalArgumentException");
> >          e.printStackTrace();
> >       }
> >       catch (IOException e)
> >       {
> >          Log.v(LOG_TAG, "CameraApp.playMedia:IOException");
> >          // TODO Auto-generated catch block
> >          e.printStackTrace();
> >       }
> >       try
> >       {
>
> >          //mp.setDisplay(mPreview.getHolder().getSurface());
> >          mp.prepare();
> >          int i = mp.getDuration();
> >          Log.i(LOG_TAG, "Duration:" + String.valueOf(i));
> >          mp.start();
> >       }
> >       catch (Exception e)
> >       {
> >          Log.v(LOG_TAG, e.toString());
> >          mp.stop();
> >          mp.release();
> >       }
> >       //setContentView(mPreview);
> >    }
>
> >    private void pauseMedia()
> >    {
> >       Log.i(LOG_TAG, "CameraApp.pauseMedia");
> >       if (null != mp)
> >       {
> >          mp.pause();
> >       }
> >    }
>
> >    private void stopMedia()
> >    {
> >       Log.i(LOG_TAG, "CameraApp.stopMedia");
> >       if (null != mp)
> >       {
> >          mp.stop();
> >       }
> >    }
> >    private void releaseMedia()
> >    {
> >       Log.i(LOG_TAG, "CameraApp.releaseMedia");
> >       if (null != mp)
> >       {
> >          mp.release();
> >       }
> >    }
> >    class Preview extends SurfaceView implements
> > SurfaceHolder.Callback
> >    {
> >        SurfaceHolder   mHolder;
> >        private boolean         mHasSurface;
> >        Preview(Context context) {
> >            super(context);
>
> >            mHolder = getHolder();
> >            mHolder.addCallback(this);
> >            mHasSurface = false;
>
> >            //mHolder.setFixedSize(320, 240);
> >            mHolder.setFixedSize(176, 144);
> >            //mHolder.setFixedSize(192, 242);
> >        }
>
> >        public void surfaceCreated(SurfaceHolder holder) {
> >            // The Surface has been created, start our main acquisition
> > thread.
> >            mHasSurface = true;
> >        }
>
> >        public void surfaceDestroyed(SurfaceHolder holder) {
> >            // Surface will be destroyed when we return. Stop the
> > preview.
> >            mHasSurface = false;
> >        }
>
> >        public void surfaceChanged(SurfaceHolder holder, int format,int
> > w, int h) {
> >            // Surface size or format has changed. This should not
> > happen   in this
> >            // example.
> >        }
> >    }
>
> > }
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to