JieCaoVideoPlayer,视频播放,极简单

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/qq_40040163/article/details/78856698


依赖:

compile 'fm.jiecao:jiecaovideoplayer:5.5'
项目清单文件:

<activity android:name=".MainActivity"
    android:configChanges="orientation|screenSize|keyboardHidden"
    android:screenOrientation="portrait">


//==============================布局================================
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context="bwie.com.shipin_shipin.MainActivity">

    <fm.jiecao.jcvideoplayer_lib.JCVideoPlayerStandard
        android:id="@+id/JVC"
        android:layout_width="match_parent"
        android:layout_height="400dp">

    </fm.jiecao.jcvideoplayer_lib.JCVideoPlayerStandard>

</android.support.constraint.ConstraintLayout>




===============================MacinActivity============================
package bwie.com.shipin_shipin;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;

import fm.jiecao.jcvideoplayer_lib.JCVideoPlayer;
import fm.jiecao.jcvideoplayer_lib.JCVideoPlayerStandard;

public class MainActivity extends AppCompatActivity {

    private JCVideoPlayerStandard jcVideoPlayerStandard;
    String url = "http://ips.ifeng.com/video19.ifeng.com/video09/2014/06/16/1989823-102-086-0009.mp4";

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);


        //找控件
        jcVideoPlayerStandard = (JCVideoPlayerStandard) findViewById(R.id.JVC);
        //设置视频上显示的文字
        jcVideoPlayerStandard.setUp(url, JCVideoPlayer.CURRENT_STATE_NORMAL,"舌尖上的太阳系");
    }

    @Override
    public void onBackPressed() {//被按下
        if (JCVideoPlayer.backPress()){
            return;
        }
        super.onBackPressed();
    }

    @Override
    protected void onPause() {//暂停
        super.onPause();
        JCVideoPlayer.releaseAllVideos();
    }
}



































展开阅读全文

没有更多推荐了,返回首页