本项目内置JZVideo播放器,以及其基于Banner V1.4.10和ZBanner进行修改。
再次感谢各位开源作者的无私奉献!
1.修复了初版本双击会进入JzVideo控制界面的问题
2.去除了DEBUG界面相关无用调试LOG
1.包含Banner V1.4.10全功能
2.内置了JzVideo的自定义功能,使用时需包含JzVideo包
3.特支持了图片视频轮播,以及视频轮播的自动播放功能
4.支持JzVideo的播放控制器的开启关闭
5.支持视频缓存的加载,详情使用请下载DEMO查看
dependencies{
implementation 'com.github.MBronsom:bbanner:1.0.1'
}
<!-- if you want to load images from the internet -->
<uses-permission android:name="android.permission.INTERNET" />
<!-- if you want to load images from a file OR from the internet -->
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<com.bronson.banner.Banner
android:id="@+id/banner"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
Banner banner = findViewById(R.id.banner);
ArrayList<String> list_path = new ArrayList<>();
list_path.add("https://pic3.zhimg.com/80/v2-66c7c457af6d8881eb8da632958f92d4_720w.jpg?source=1940ef5c");
list_path.add("http://vfx.mtime.cn/Video/2019/03/19/mp4/190319212559089721.mp4" );
list_path.add("http://vfx.mtime.cn/Video/2019/03/21/mp4/190321153853126488.mp4");
//banner样式
banner.setBannerStyle(BannerConfig.NOT_INDICATOR);
//图片加载
banner.setImageLoader(new ImageLoader() {
@Override
public void displayView(Context context, Object path, ImageView view, OnVideoStateListener listener) {
Glide.with(context)
.load(path)
.into(view);
}
});
//设置是否为自动轮播。
banner.isAutoPlay(true);
//设置视频自动播放
banner.isVideoAutoPlay(true);
banner.setVideoLoader(new VideoLoader() {
@Override
public void displayView(Context context, Object path, View view, OnVideoStateListener listener) {
MyJzvdStd jzVideo = (MyJzvdStd)view;
//设置地址
jzVideo.setUp((String) path,"");
//设置是否可以支持控制
jzVideo.setCanControl(false);
RequestOptions options = new RequestOptions()
.centerCrop()
.fitCenter()
.diskCacheStrategy(DiskCacheStrategy.NONE);
//设置背景图片
//Glide.with(context).load(R.drawable.videobg).apply(options).into(jzVideo.thumbImageView);
jzVideo.setOnVideoStateListener(listener);
}
});
//设置图片地址或网址
banner.setDataList(list_path);
//动画效果
banner.setBannerAnimation(Transformer.Default);
//设置间隔时间
banner.setDelayTime(10000);
//设置指示器的位置,小圆点。
banner.start();
JZVideo开源许可
Copyright © 2015-2020 李盼
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.