Skip to content
This repository has been archived by the owner on Aug 9, 2022. It is now read-only.

Commit

Permalink
Merge branch 'release/v1.8'
Browse files Browse the repository at this point in the history
  • Loading branch information
Nathen committed Mar 14, 2016
2 parents 7818bd9 + 06d3cb3 commit 69f84ff
Show file tree
Hide file tree
Showing 27 changed files with 269 additions and 179 deletions.
120 changes: 120 additions & 0 deletions README-ZH.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
#节操视频播放器

[![Platform](https://img.shields.io/badge/platform-android-green.svg)](http://developer.android.com/index.html)
[![Maven Central](https://img.shields.io/badge/Maven%20Central-1.7-green.svg)](http://search.maven.org/#artifactdetails%7Cfm.jiecao%7Cjiecaovideoplayer%7C1.7%7Caar)
[![Licenses](https://img.shields.io/badge/license-MIT-green.svg)](http://choosealicense.com/licenses/mit/)
[![GitHub stars](https://img.shields.io/github/stars/lipangit/jiecaovideoplayer.svg?style=social&label=Star)]()
[![Android Arsenal](https://img.shields.io/badge/Android%20Arsenal-jiecaovideoplayer-green.svg?style=true)](https://android-arsenal.com/details/1/3269)

真正实现Android的全屏功能,立志成为Android平台使用最广泛的视频播放控件,GitFlow流程开发develop分支是最新版本

##主要特点
1. 全屏时启动新`Activity`实现播放器真正的全屏功能
2. 能在`ListView``ViewPager``ListView``ViewPager``Fragment`等多重嵌套模式下全屏工作
3. `ListView`的拖拽和`ViewPager`的滑动时如果划出屏幕会自动重置视频
4. 视频大小的屏幕适配,宽或长至少有两个对边是充满屏幕的,另外两个方向居中
5. 可以在加载、暂停、播放等各种状态中正常进入全屏和退出全屏
6. 根据自己应用的颜色风格换肤
7. 播放MP3时显示缩略图片

##效果

![Demo Screenshot][1]

视频演示 : http://v.youku.com/v_show/id_XMTQ2NzUwOTcyNA==.html?firsttime=0&from=y1.4-2


##使用
1.引入类库
```gradle
compile 'fm.jiecao:jiecaovideoplayer:1.7'
```

2.添加布局
```xml
<fm.jiecao.jcvideoplayer_lib.JCVideoPlayer
android:id="@+id/videocontroller1"
android:layout_width="match_parent"
android:layout_height="200dp" />
```

3.设置视频地址、缩略图地址、标题
```java
JCVideoPlayer videoController = (JCVideoPlayer) findViewById(R.id.videocontroller);
videoController.setUp("http://2449.vod.myqcloud.com/2449_43b6f696980311e59ed467f22794e792.f20.mp4",
"http://p.qpic.cn/videoyun/0/2449_43b6f696980311e59ed467f22794e792_1/640",
"嫂子别摸我");
```
4.在包含播放器的`Fragment``Activity``onPause()`方法中调用`JCVideoPlayer.releaseAllVideos();`

####其他接口

设置皮肤,可以指定某个播放器的皮肤,也可以设置全局皮肤,优先级:某个播放器皮肤>全局皮肤>默认皮肤
```java
JCVideoPlayer.setGlobleSkin();//设置全局皮肤
videoController.setSkin();//设置这一个播放器的皮肤
```

修改缩略图的scalType,默认的缩略图的scaleType是fitCenter,这时候图片如果和屏幕尺寸不同的话左右或上下会有黑边,可以根据客户端需要改成fitXY或者其他模式
```java
JCVideoPlayer.setThumbImageViewScalType(ImageView.ScaleType.FIT_XY);
```

直接进入全屏,比如在webview中视频播放的适配很难做,调用此接口直接全屏播放
```java
FullScreenActivity.toActivity(this,
"http://2449.vod.myqcloud.com/2449_43b6f696980311e59ed467f22794e792.f20.mp4",
"http://p.qpic.cn/videoyun/0/2449_43b6f696980311e59ed467f22794e792_1/640",//此时的缩略图地址可以为空
"嫂子别摸我");
```

在ListView和ViewPager中将视频移除屏幕外,会在onDetachedFromWindow时重置视频。
目标是在库外只需要添加布局,添加配置,其他的问题都在库内判断和操作。

混淆
```
##Eventbus混淆
-keepclassmembers class ** {
public void onEvent*(***);
}
# Only required if you use AsyncExecutor
-keepclassmembers class * extends de.greenrobot.event.util.ThrowableFailureEvent {
public <init>(java.lang.Throwable);
}
# Don't warn for missing support classes
-dontwarn de.greenrobot.event.util.*$Support
-dontwarn de.greenrobot.event.util.*$SupportManagerFragment
```

##下载
* **[jiecaovideoplayer-1.7-demo.apk](https://raw.githubusercontent.com/lipangit/jiecaovideoplayer/develop/downloads/jiecaovideoplayer-1.7-demo.apk)**
* **[jiecaovideoplayer-1.7.aar](https://raw.githubusercontent.com/lipangit/jiecaovideoplayer/develop/downloads/jiecaovideoplayer-1.7.aar)**
* **[jiecaovideoplayer-1.7-javadoc.jar](https://raw.githubusercontent.com/lipangit/jiecaovideoplayer/develop/downloads/jiecaovideoplayer-1.7-javadoc.jar)**
* **[jiecaovideoplayer-1.7-sources.jar](https://raw.githubusercontent.com/lipangit/jiecaovideoplayer/develop/downloads/jiecaovideoplayer-1.7-sources.jar)**

## License

The MIT License (MIT)

Copyright (c) 2015-2016 jiecao.fm:Nathen

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.


[1]: ./screenshots/j1.png
102 changes: 46 additions & 56 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,65 +1,77 @@
#节操视频播放器 [![Platform](https://img.shields.io/badge/platform-android-green.svg)](http://developer.android.com/index.html) [![Maven Central](https://img.shields.io/badge/Maven%20Central-1.6-green.svg)](http://search.maven.org/#artifactdetails%7Cfm.jiecao%7Cjiecaovideoplayer%7C1.6%7Caar) [![Licenses](https://img.shields.io/badge/license-MIT-green.svg)](http://choosealicense.com/licenses/mit/) [![GitHub stars](https://img.shields.io/github/stars/lipangit/jiecaovideoplayer.svg?style=social&label=Star)]()
# Jiecao Video Player

真正实现Android的全屏功能,励志成为Android平台使用最广泛的视频播放控件,GitFlow流程开发develop分支是最新版本
[![Platform](https://img.shields.io/badge/platform-android-green.svg)](http://developer.android.com/index.html)
[![Maven Central](https://img.shields.io/badge/Maven%20Central-1.8-green.svg)](http://search.maven.org/#artifactdetails%7Cfm.jiecao%7Cjiecaovideoplayer%7C1.8%7Caar)
[![Licenses](https://img.shields.io/badge/license-MIT-green.svg)](http://choosealicense.com/licenses/mit/)
[![GitHub stars](https://img.shields.io/github/stars/lipangit/jiecaovideoplayer.svg?style=social&label=Star)]()
[![Android Arsenal](https://img.shields.io/badge/Android%20Arsenal-jiecaovideoplayer-green.svg?style=true)](https://android-arsenal.com/details/1/3269)

##主要特点
1. 全屏时启动新`Activity`实现播放器真正的全屏功能
2. 可以在加载、暂停、播放等各种状态中正常进入全屏和退出全屏
3. 播放MP3时现实缩略图片
4. 能在`ListView``ViewPager``ListView``ViewPager``Fragment`的多重嵌套模式下全屏工作
5. `ListView`的拖拽和`ViewPager`的滑动时如果划出屏幕会自动重置视频
6. 根据自己应用的颜色风格换肤
7. 视频大小的屏幕适配,宽或长至少有两个对边是充满屏幕的,另外两个方向居中
This is the real android video player view with fullscreen function, we are dedicated to make it to be the most popular video play widget on android. Branch develop is the latest version, although it is not stable for now.

##效果
[中文文档](README-ZH.md)

## Features
1. Launching new Fullscreen Activity when playing video in fullscreen mode
2. Even in `ListView``ViewPager` and `ListView``ViewPager` and `Fragment` and other nested fragments and views situation, it works well
3. Video will be reset(pause) when it's scrolled out of the screen in `ListView` and `ViewPager`
4. It will not disturb or change the playing state when entering or exiting fullscreen
5. Support to custom view controller's skin
6. Support to display the thumb when playing mp3 audio

## Demo Screenshot

![Demo Screenshot][1]

视频演示 : http://v.youku.com/v_show/id_XMTQ2NzUwOTcyNA==.html?firsttime=0&from=y1.4-2
Demo video : http://v.youku.com/v_show/id_XMTQ2NzUwOTcyNA==.html?firsttime=0&from=y1.4-2


##使用
1.引入类库
## Usage
1.Add the library in build.gradle
```gradle
compile 'fm.jiecao:jiecaovideoplayer:1.6'
compile 'fm.jiecao:jiecaovideoplayer:1.8'
```

2.添加布局
2.Add JCVideoPlayer in your layout
```xml
<fm.jiecao.jcvideoplayer_lib.JCVideoPlayer
android:id="@+id/videocontroller1"
android:layout_width="match_parent"
android:layout_height="200dp" />
```

3.设置视频地址、缩略图地址、标题
3.Set the video uri, video thumb url and video title
```java
JCVideoPlayer videoController = (JCVideoPlayer) findViewById(R.id.videocontroller);
videoController.setUp("http://2449.vod.myqcloud.com/2449_43b6f696980311e59ed467f22794e792.f20.mp4",
"http://p.qpic.cn/videoyun/0/2449_43b6f696980311e59ed467f22794e792_1/640",
"嫂子别摸我");
```
4.在包含播放器的`Fragment``Activity``onPause()`方法中调用`JCVideoPlayer.releaseAllVideos();`
4.Remember to invoke `JCVideoPlayer.releaseAllVideos();` in `onPause()` of `Fragment` or `Activity`

####其他接口
#### Other APIs

设置皮肤,可以指定某个播放器的皮肤,也可以设置全局皮肤,优先级:某个播放器皮肤>全局皮肤>默认皮肤
Set up the video player appearance, you can set the current video player's skin or set the global skin. Priority: some video player instance skin > global skin > default skin
```java
JCVideoPlayer.setGlobleSkin();//设置全局皮肤
videoController.setSkin();//设置这一个播放器的皮肤
JCVideoPlayer.setGlobleSkin();//set up global skin
videoController.setSkin();//set up some video player instance skin
```

修改缩略图的scalType,默认的缩略图的scaleType是fitCenter,这时候图片如果和屏幕尺寸不同的话左右或上下会有黑边,可以根据客户端需要改成fitXY或者其他模式
Modify the thumb image view's scaleType property, default value is fitCenter. There will be black padding if the size of thumb is not compatible with screen size, try to use fitXY or other scaleType.
```java
JCVideoPlayer.setThumbImageViewScalType(ImageView.ScaleType.FIT_XY);
```

在ListView和ViewPager中将视频移除屏幕外,会在onDetachedFromWindow时重置视频。
目标是在库外只需要添加布局,添加配置,其他的问题都在库内判断和操作。
Invoke `FullScreenActivity.toActivity(...)` to enter fullscreen directly.
```java
FullScreenActivity.toActivity(this,
"http://2449.vod.myqcloud.com/2449_43b6f696980311e59ed467f22794e792.f20.mp4",
"http://p.qpic.cn/videoyun/0/2449_43b6f696980311e59ed467f22794e792_1/640",//此时的缩略图地址可以为空
"嫂子别摸我");
```

混淆
ProGuard
```
##Eventbus混淆
##Eventbus
-keepclassmembers class ** {
public void onEvent*(***);
}
Expand All @@ -72,35 +84,13 @@ JCVideoPlayer.setThumbImageViewScalType(ImageView.ScaleType.FIT_XY);
-dontwarn de.greenrobot.event.util.*$SupportManagerFragment
```

##下载
* **[jiecaovideoplayer-1.6-demo.apk](https://raw.githubusercontent.com/lipangit/jiecaovideoplayer/develop/downloads/jiecaovideoplayer-1.6-demo.apk)**
* **[jiecaovideoplayer-1.6.aar](https://raw.githubusercontent.com/lipangit/jiecaovideoplayer/develop/downloads/jiecaovideoplayer-1.6.aar)**
* **[jiecaovideoplayer-1.6-javadoc.jar](https://raw.githubusercontent.com/lipangit/jiecaovideoplayer/develop/downloads/jiecaovideoplayer-1.6-javadoc.jar)**
* **[jiecaovideoplayer-1.6-sources.jar](https://raw.githubusercontent.com/lipangit/jiecaovideoplayer/develop/downloads/jiecaovideoplayer-1.6-sources.jar)**

## License

The MIT License (MIT)

Copyright (c) 2015-2016 jiecao.fm:Nathen

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.
## Downloads
* **[jiecaovideoplayer-1.8-demo.apk](https://raw.githubusercontent.com/lipangit/jiecaovideoplayer/develop/downloads/jiecaovideoplayer-1.8-demo.apk)**
* **[jiecaovideoplayer-1.8.aar](https://raw.githubusercontent.com/lipangit/jiecaovideoplayer/develop/downloads/jiecaovideoplayer-1.8.aar)**
* **[jiecaovideoplayer-1.8-javadoc.jar](https://raw.githubusercontent.com/lipangit/jiecaovideoplayer/develop/downloads/jiecaovideoplayer-1.8-javadoc.jar)**
* **[jiecaovideoplayer-1.8-sources.jar](https://raw.githubusercontent.com/lipangit/jiecaovideoplayer/develop/downloads/jiecaovideoplayer-1.8-sources.jar)**



[1]: ./screenshots/j1.png

5 changes: 3 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ android {
applicationId "fm.jiecao.jiecaovideoplayer"
minSdkVersion 16
targetSdkVersion 23
versionCode 18
versionName "1.7"
versionCode 19
versionName "1.8"
}
buildTypes {
release {
Expand All @@ -28,4 +28,5 @@ dependencies {
compile project(':jcvideoplayer-lib')
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.nostra13.universalimageloader:universal-image-loader:1.9.4'
compile 'com.zhy:percent-support-extends:1.1.1'
}
19 changes: 7 additions & 12 deletions app/src/main/java/fm/jiecao/jiecaovideoplayer/DemoApplication.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,10 @@
* On 2015/12/01 11:29
*/
public class DemoApplication extends Application {
private static DemoApplication application;

@Override
public void onCreate() {
super.onCreate();
application = this;
initUniversalImageLoader();
//这里将会设置所有播放器的皮肤 | Here the player will set all the skin
// JCVideoPlayer.setGlobleSkin(R.color.colorPrimary, R.color.colorAccent, R.drawable.skin_seek_progress,
Expand All @@ -56,22 +54,19 @@ private void initUniversalImageLoader() {

File cacheDir = new File(Environment.getExternalStorageDirectory().getPath() + "/jiecao/cache");
ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(this)
.threadPoolSize(3) // default 线程池内加载的数量
.threadPriority(Thread.NORM_PRIORITY - 2) // default 设置当前线程的优先级
.threadPoolSize(3)
.threadPriority(Thread.NORM_PRIORITY - 2)
.denyCacheImageMultipleSizesInMemory()
.diskCacheFileNameGenerator(new Md5FileNameGenerator())
.memoryCache(new UsingFreqLimitedMemoryCache(memCacheSize)) // You can pass your own memory cache implementation/
.memoryCacheSize(memCacheSize) // 内存缓存的最大值
.diskCacheSize(50 * 1024 * 1024) // 50 Mb
.memoryCache(new UsingFreqLimitedMemoryCache(memCacheSize))
.memoryCacheSize(memCacheSize)
.diskCacheSize(50 * 1024 * 1024)
.tasksProcessingOrder(QueueProcessingType.LIFO)
.diskCache(new UnlimitedDiskCache(cacheDir))//自定义缓存路径
.imageDownloader(new BaseImageDownloader(this, 5 * 1000, 30 * 1000)) // connectTimeout (5 s), readTimeout (30 s)超时时间
.diskCache(new UnlimitedDiskCache(cacheDir))
.imageDownloader(new BaseImageDownloader(this, 5 * 1000, 30 * 1000))
.defaultDisplayImageOptions(options)
.build();
ImageLoader.getInstance().init(config);
}

public static DemoApplication instance() {
return application;
}
}
Loading

0 comments on commit 69f84ff

Please sign in to comment.