节操视频播放 -- 简单
程序员文章站
2024-01-16 20:54:16
...
节操视频播放 – 简单
- 最基本的网络权限
<uses-permission android:name="android.permission.INTERNET"/>
- 依赖
//节操
implementation 'fm.jiecao:jiecaovideoplayer:5.5'
implementation 'com.github.bumptech.glide:glide:3.7.0'
- 代码
//节操 视频播放
private void initDate() {
JCVideoPlayerStandard jcVideoPlayerStandard = (JCVideoPlayerStandard) findViewById(R.id.videop_videoplayersas);
jcVideoPlayerStandard.TOOL_BAR_EXIST = false;
//自定义视频大小
jcVideoPlayerStandard.setUp("https://c5.tanfangwang.com/upload/sys/column/media/a0/ec5ba6c617deb2d116df9ae839179b.mp4",
JCVideoPlayerStandard.SCREEN_LAYOUT_NORMAL, "播放视频的标题,可以为空");
//jcVideoPlayerStandard.loop = true;//是否循环播放
Glide.with(getApplicationContext()).load("http://p0.ifengimg.com/pmop/2018/1111/DADAE9383999EDCC5DE84D61B6CA4AB969E2DD80_size35_w440_h274.jpeg")
.into(jcVideoPlayerStandard.thumbImageView);
//直接进入全屏
//JCVideoPlayerStandard.startFullscreen(this, JCVideoPlayerStandard.class, "https://c5.tanfangwang.com/upload/sys/column/media/a0/ec5ba6c617deb2d116df9ae839179b.mp4", "视频标题");
jcVideoPlayerStandard.widthRatio = 4;//播放比例
jcVideoPlayerStandard.heightRatio = 3;
}
- 布局
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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"
android:orientation="vertical"
tools:context=".MainActivity">
<fm.jiecao.jcvideoplayer_lib.JCVideoPlayerStandard
android:id="@+id/videop_videoplayersas"
android:layout_width="match_parent"
android:layout_height="385px" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="123" />
</LinearLayout>
As今天有点问题,没办法调试,改天再细写《先在这备份一下》
上一篇: IjkVideoView的简单实用
下一篇: react踩坑记录