关于饺子播放器使用

关于饺子播放器使用步骤如下:

  • 1、依赖

compile 'cn.jzvd:jiaozivideoplayer:6.2.12'

  • 2、布局

<cn.jzvd.JZVideoPlayerStandard
    android:id="@+id/videoplayer"
    android:layout_width="match_parent"

    android:layout_height="200dp"/>

  • 3、代码

设置
JZVideoPlayerStandard jzVideoPlayerStandard = (JZVideoPlayerStandard) findViewById(R.id.videoplayer);
jzVideoPlayerStandard.setUp(url, JZVideoPlayerStandard.SCREEN_WINDOW_NORMAL,  "title");
图片
Glide.with(this)
                .load(imgurl)
                .into(videoplayer.thumbImageView);

jzVideoPlayerStandard.thumbImageView.setImage(url1);
返回
@Override
public void onBackPressed() {
    if (JZVideoPlayer.backPress()) {
        return;
    }
    super.onBackPressed();
}
@Override
protected void onPause() {
    super.onPause();
    JZVideoPlayer.releaseAllVideos();
}

  • 4、清单

<activity
    android:name=".MainActivity"
    android:configChanges="orientation|screenSize|keyboardHidden"
    android:screenOrientation="portrait" />
    <!-- or android:screenOrientation="landscape"-->

©️2020 CSDN 皮肤主题: 创作都市 设计师:CSDN官方博客 返回首页