资 源 简 介
应用背景之前使用surfaceView做视图显示,但是surfaceView无法实现旋转等一些操作,就找到了textureView做视图显示,做的一个简单播放本地视频的例子关键技术public class MainActivity extends Activity implements SurfaceTextureListener, OnBufferingUpdateListener, OnCompletionListener, OnPreparedListener, OnVideoSizeChangedListener{
TextureView textureView;
private MediaPlayer mMediaPlayer;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
textureView=(TextureView) findViewById(R.id.textureview);
textureView.setSurfaceTextureListener(this);
// textureView=new TextureView(this);
// textureView.setSurfaceTextureListener(this);
// setContentView(textureView);
}
@Override
public void onSurfaceTextureAvailable(SurfaceTexture surface, int width,
int height) {
System.out.println("onSurfaceTextureAvailab