?? ?? ?? ?? ?? ?? }
?? ?? ?? ?? });
?? ?? ?? ?? if (currentPosition == position) {
?? ?? ?? ?? ?? ?? if (player.isPlaying()) {
?? ?? ?? ?? ?? ?? ?? ?? player.stop();
?? ?? ?? ?? ?? ?? }
// ?? ?? ?? ?? ?? ??说明当前正在被创建的view,应该播放视频
// ?? ?? ?? ?? ?? ??隐藏ImageView,展示SurfaceView
?? ?? ?? ?? ?? ?? holder.mSurfaceView.setVisibility(View.VISIBLE);
?? ?? ?? ?? ?? ?? holder.mThumbIv.setVisibility(View.INVISIBLE);
// ?? ?? ?? ?? ??获取SurfaceHolder对象
?? ?? ?? ?? ?? ?? SurfaceHolder surfaceHolder = holder.mSurfaceView.getHolder();
?? ?? ?? ?? ?? ?? surfaceHolder.addCallback(new SurfaceHolder.Callback() {
?? ?? ?? ?? ?? ?? ?? ?? @Override
?? ?? ?? ?? ?? ?? ?? ?? public void surfaceCreated(SurfaceHolder holder) {
?? ?? ?? ?? ?? ?? ?? ?? ?? ?? player.reset(); ?? //重置媒体播放器
?? ?? ?? ?? ?? ?? ?? ?? ?? ?? player.setDisplay(holder); ?? ?? ??//设置播放器播放的位置
?? ?? ?? ?? ?? ?? ?? ?? ?? ?? try {
?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? player.setDataSource(info.getPath());
?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? player.prepare(); ?? ?? ?? //本地视频使用同步,网络视频使用异步
?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? player.start();
?? ?? ?? ?? ?? ?? ?? ?? ?? ?? } catch (IOException e) {
?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? e.printStackTrace();
?? ?? ?? ?? ?? ?? ?? ?? ?? ?? }
?? ?? ?? ?? ?? ?? ?? ?? }
?? ?? ?? ?? ?? ?? ?? ?? @Override
?? ?? ?? ?? ?? ?? ?? ?? public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) {
?? ?? ?? ?? ?? ?? ?? ?? }
?? ?? ?? ?? ?? ?? ?? ?? @Override
?? ?? ?? ?? ?? ?? ?? ?? public void surfaceDestroyed(SurfaceHolder holder) {
本文来自电脑杂谈,转载请注明本文网址:
http://www.pc-fly.com/a/bofangqi/article-54866-7.html
高铁坐吗
这是要去选择新生的节奏了不是摩
想太多