• VideoView的视频的全屏播放


    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:android="http://schemas.android.com/apk/res/android"
        xmlns:tools="http://schemas.android.com/tools"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
         >
         <VideoView android:layout_width="fill_parent"
             android:layout_height="fill_parent"
             android:id="@+id/video_quanping"/>

       

    </RelativeLayout>

  • 相关阅读:
    Oracle数据库配置
    匹配汉字与全角半角括号
    Linux任务调度crontab时间规则介绍
    配置文件方面的总结
    openlayers 4快速渲染管网模型数据
    openlayers 各种图层,持续更新
    简单的js定时器
    mysql client does not support authentication
    java 记录
    创建maven工程
  • 原文地址:https://www.cnblogs.com/changyiqiang/p/5788345.html
Copyright © 2020-2023  润新知