NurVideoPlayer 视频播放器,使用特别简单
支持屏幕滑动–滑动时间,亮度,声音,支持全屏-单屏,双击暂停–继续,锁定屏幕
截屏2019-12-2620.35.46.png
使用
1.不要不记得项目的根build.gradle配置
allprojects { repositories { ... maven { url 'https://jitpack.io' } } }2.使用前需要先在项目中增加OkHttp的依赖库
implementation 'com.gitee.nurApplication:NurVideoPlayer:1.0.9'使用最新版本
1.0.6-以上的importimport com.nurmemet.nur.nurvideoplayer.NurVideoPlayer;
1.0.6-以下的importimport com.example.nur.nurvideoplayer.NurVideoPlayer;
3.增加网络权限
<uses-permission android:name="android.permission.INTERNET"/>xml
.... <com.nurmemet.nur.nurvideoplayer.NurVideoPlayer android:id="@+id/videoView" android:layout_width="match_parent" android:layout_height="match_parent" app:video_height="200dp" />....android:layout_height=肯定要"match_parent"
参数xml中只有一个app:video_height也就是视频播放器的高度,默认值"match_parent"
Screenshot_1577360112.png
Screenshot_1577360218.png
第一张图app:video_height="200dp"
第二张图-默认
java
初始化
String url = "http://10.60.14.51:81/2Q2W0B784101358FBBB74AA6D6641E382A4F80BC556F_unknown_0DF0CD678166EE1AE245967E71317516F1FE97C1_2/clips.vorwaerts-gmbh.de/big_buck_bunny.mp4"; nurVideoPlayer = findViewById(R.id.videoView); nurVideoPlayer.setUp(this, url, "this is video name"); 需要在onPause() & onResume () & onKeyDown()中调用
@Override protected void onPause() { nurVideoPlayer.pause(); super.onPause(); } @Override protected void onResume() { nurVideoPlayer.resume(); super.onResume(); } @Override public boolean onKeyDown(int keyCode, KeyEvent event) { boolean b = nurVideoPlayer.setOnKeyDown(keyCode); return b || super.onKeyDown(keyCode, event); }参数
| return | 方法 | 注释 | 作用 |
|---|---|---|---|
void | setUp(Activity activity, String url, String videoName) | url视频的地址,videoName | 初始化 |
void | start(); | 开始播放 | |
void | pause(); | 暂停 | |
void | resume(); | 继续 | |
void | setChangeScreen(boolean fullScreen) | fullScreen=true>全屏 | 更改-(全屏-单屏) |
void | setOnBackPress(OnBackPressListener onBackPressListener) | 没有调用就不会显示(??) | 点击返回按钮 |
void | setMonoMode(@NonNull MonoMode mode) | NORMAL LEFT_CHANNEL RIGHT_CHANNEL | 单声道模式 |
void | seekTo(int msec); | msec—time | 进度 |
ImageView | getThumbImageView(); | 你可以用把返回的imageView设置视频的封面 | 封面 |
说明
1. 本站所有资源来源于用户上传和网络,如有侵权请邮件联系站长!
2. 分享目的仅供大家学习和交流,您必须在下载后24小时内删除!
3. 不得使用于非法商业用途,不得违反国家法律。否则后果自负!
4. 本站提供的源码、模板、插件等等其他资源,都不包含技术服务请大家谅解!
5. 如有链接无法下载、失效或广告,请联系管理员处理!
6. 本站资源售价只是摆设,本站源码仅提供给会员学习使用!
7. 如遇到加密压缩包,请使用360解压,如遇到无法解压的请联系管理员
开心源码网 » NurVideoPlayer 视频播放器,使用特别简单
1. 本站所有资源来源于用户上传和网络,如有侵权请邮件联系站长!
2. 分享目的仅供大家学习和交流,您必须在下载后24小时内删除!
3. 不得使用于非法商业用途,不得违反国家法律。否则后果自负!
4. 本站提供的源码、模板、插件等等其他资源,都不包含技术服务请大家谅解!
5. 如有链接无法下载、失效或广告,请联系管理员处理!
6. 本站资源售价只是摆设,本站源码仅提供给会员学习使用!
7. 如遇到加密压缩包,请使用360解压,如遇到无法解压的请联系管理员
开心源码网 » NurVideoPlayer 视频播放器,使用特别简单