Android VideoView循环播放 Android编程实现VideoView循环播放功能的方法
Jacob-wj 人气:0想了解Android编程实现VideoView循环播放功能的方法的相关内容吗,Jacob-wj在本文为您仔细讲解Android VideoView循环播放的相关知识和一些Code实例,欢迎阅读和指正,我们先划重点:Android,VideoView,循环播放,下面大家一起来学习吧。
本文实例讲述了Android编程实现VideoView循环播放功能的方法。分享给大家供大家参考,具体如下:
package com.hangcheng; import com.example.bdcustomer_demo.R; import com.hangcheng.view.MyVideoView; import android.app.Activity; import android.media.MediaPlayer; import android.os.Bundle; import android.view.Window; public class VideoActivity extends Activity { private MyVideoView myVideoView; private String videopath; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_NO_TITLE); setContentView(R.layout.video); initView(); videopath = VideoActivity.this.getIntent().getStringExtra("videopath"); myVideoView.setVideoPath(videopath); myVideoView.start(); myVideoView.setOnPreparedListener(new MediaPlayer.OnPreparedListener() { @Override public void onPrepared(MediaPlayer mp) { mp.start(); mp.setLooping(true); } }); myVideoView .setOnCompletionListener(new MediaPlayer.OnCompletionListener() { @Override public void onCompletion(MediaPlayer mp) { myVideoView.setVideoPath(videopath); myVideoView.start(); } }); } private void initView() { myVideoView = (MyVideoView) findViewById(R.id.video); } }
希望本文所述对大家Android程序设计有所帮助。
加载全部内容