surfaceview

public class example extends Activity iplements SufaceHolder.Callback{

public void onCreate(){
SurfaceView mSurfaceView = findViewById(*);
SufaceHolder mSufaceHolder=mSurfaceView.getHolder();
mSufaceHolder.addCallback(this);

mSufaceHolder.setFixedSize(176,144);
mSufaceHolder.setType(SufaceHolder.SURFACE_TYPE_PUSH_BUFFER);
}

public void surfaceChaged(SurfaceHolder surfaceholder, int format, int w,int h){
}

public void surfaceCreated(SurfaceHolder surfaceholder){
        mMediaPlayer.setOnPreparedListener(mPreparedListener);
            mMediaPlayer.setOnErrorListener(mErrorListener);
            mMediaPlayer.setDataSource(this,mUri);
            mMediaPlayer.setDisplay(mSurfaceHolder);
            mMediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);
            mMediaPlayer.setScreenOnWhilePlaying(true);
            mMediaPlayer.prepareAsync();

}

public void surfaceDestroyed(SurfaceHolder surfaceholder){
}


你可能感兴趣的:(Class,buffer)