import android.net.Uri;
import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.view.Menu;
import android.view.Window;
import android.widget.MediaController;
import android.widget.RelativeLayout;
import android.widget.VideoView;

public class QuanPingActivity extends Activity {

    private VideoView video_quanping;
    private String shipinUrl="http://101.200.142.201:8080/VideoPlay/video";

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        requestWindowFeature(Window.FEATURE_NO_TITLE);//去掉标题栏
        setContentView(R.layout.activity_quan_ping);
        //获得传来的值
        Intent intent=getIntent();
        String videourl=intent.getStringExtra("videourl");
        //找到VideoView控件
        video_quanping = (VideoView) findViewById(R.id.video_quanping);
        
        //视频的播放        媒体控制器
                MediaController mediaController=new MediaController(this);
                video_quanping.setMediaController(mediaController);//设置一个控制条  
                Uri uri=Uri.parse(shipinUrl+videourl);
                //设置视频的URL
                video_quanping.setVideoURI(uri);
                //请求焦点
                video_quanping.requestFocus();
                //开始播放
                video_quanping.start();
                
                
                
                //String path = getIntent().getStringExtra("path");
               // mVideoView02.setVideoURI(Uri.parse(path));
                //相对布局         的布局参数
                RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(
                        //设置为填充父窗体
                        RelativeLayout.LayoutParams.FILL_PARENT,
                        RelativeLayout.LayoutParams.FILL_PARENT);
                //添加管理
                layoutParams.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
                layoutParams.addRule(RelativeLayout.ALIGN_PARENT_TOP);
                layoutParams.addRule(RelativeLayout.ALIGN_PARENT_LEFT);
                layoutParams.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
                //设置布局
                video_quanping.setLayoutParams(layoutParams);
                video_quanping.start();

    }

 

 

//----------xml布局文件-----------------------

<RelativeLayout xmlns:andro/>

   

</RelativeLayout>

相关文章:

  • 2021-09-12
  • 2021-05-16
  • 2021-06-28
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-08-26
猜你喜欢
  • 2022-02-06
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-07-24
  • 2022-02-18
相关资源
相似解决方案