LunarView extends SurfaceView implements SurfaceHolder.Callback{ *** }
为SurfaceView的SurfaceHolder设置SurfaceHolder.Callback; 获取Canvas对象mSurfaceHolder.lockCanvas(null); 子线程中进行绘制; 子线程内部同步;
mDrawable.getIntrinsicHeight() Return the intrinsic height of the underlying drawable object. 固有的
audio: Equalizer --> AudioEffect --> Object; Visualizer --> Object; VisualizerView --> View; MediaPlayer --> Object;
vidio: VideoView --> SurfaceView --> View.
MediaPlayer的new和reset后是Idle状态;区别是调用getXXX()/setXXX()/pause()/prepare()/prepareAsync()等方法后,不会调用OnErrorListener.onError();而在reset会,则会调用。
MediaPlayer的状态:Idle/Initialized/Preparing/Prepared/Started/Paused/PlaybackCompleted/Stropped
SurfaceView是Z ordered;内嵌SurfaceHolder对象;SurfaceHolder.Callback接口,surfaceCreated(),surfaceChanged(),surfaceDestroyed();SurfaceView创建后调surfaceCreated(),销毁/隐藏后调surfaceDestroyed();
SurfaceView用于显示,SurfaceHolder就是用于用来管理这个SurfaceView对象,SurfaceHolder.Callback用于管理或者说是用于监听SurfaceView。
MediaPlayer与SurfaceView配合使用:mSurfaceHolder=mSurfaceView.getHolder();mSurfaceHolder.addCallback(**);mMediaPlayer.setDisplay(mSurfaceHolder);
使用步骤:1)创建MediaPlayer对象,并设置加载的视频文件(setDataSource()) 2)在界面布局文件中定义SurfaceView控件 3)通过MediaPlayer.setDisplay(SurfaceHolder sh)来指定视频画面输出到SurfaceView之上 4)通过MediaPlayer的其他一些方法用于播放视频。