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/v3.0_preview'
Browse files Browse the repository at this point in the history
  • Loading branch information
Nathen committed Apr 24, 2016
2 parents 1e67c3e + a2349c2 commit 14129d8
Show file tree
Hide file tree
Showing 69 changed files with 1,231 additions and 1,135 deletions.
53 changes: 21 additions & 32 deletions README-ZH.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#节操视频播放器

[![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-2.0_final-green.svg)](http://search.maven.org/#artifactdetails%7Cfm.jiecao%7Cjiecaovideoplayer%7C2.0_final%7Caar)
[![Maven Central](https://img.shields.io/badge/Maven%20Central-3.0_preview-green.svg)](http://search.maven.org/#artifactdetails%7Cfm.jiecao%7Cjiecaovideoplayer%7C3.0_preview%7Caar)
[![Licenses](https://img.shields.io/badge/license-MIT-green.svg)](http://choosealicense.com/licenses/mit/)
[![Android Arsenal](https://img.shields.io/badge/Android%20Arsenal-jiecaovideoplayer-green.svg?style=true)](https://android-arsenal.com/details/1/3269)
[![GitHub stars](https://img.shields.io/github/stars/lipangit/jiecaovideoplayer.svg?style=social&label=Star)]()
Expand All @@ -14,81 +14,70 @@
3. `ListView`的拖拽和`ViewPager`的滑动时如果划出屏幕会自动重置视频
4. 视频大小的屏幕适配,宽或长至少有两个对边是充满屏幕的,另外两个方向居中
5. 可以在加载、暂停、播放等各种状态中正常进入全屏和退出全屏
6. 根据自己应用的颜色风格换肤
6. 可以完全自定义UI
7. 播放MP3时显示缩略图片
8. 占用空间非常小,不到50k

##效果

**[jiecaovideoplayer-2.0_final-demo.apk](https://raw.githubusercontent.com/lipangit/jiecaovideoplayer/develop/downloads/jiecaovideoplayer-2.0_final-demo.apk)**
**[jiecaovideoplayer-3.0_preview-demo.apk](https://raw.githubusercontent.com/lipangit/jiecaovideoplayer/develop/downloads/jiecaovideoplayer-3.0_preview-demo.apk)**

![Demo Screenshot][1]

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

##使用
1.添加类库
1.添加类库,稳定版是 fm.jiecao:jiecaovideoplayer:2.0_final
```gradle
compile 'fm.jiecao:jiecaovideoplayer:2.0_final'
compile 'fm.jiecao:jiecaovideoplayer:3.0_preview'
```

或直接下载

* [jiecaovideoplayer-2.0_final.aar](https://raw.githubusercontent.com/lipangit/jiecaovideoplayer/develop/downloads/jiecaovideoplayer-2.0_final.aar)
* [jiecaovideoplayer-2.0_final-javadoc.jar](https://raw.githubusercontent.com/lipangit/jiecaovideoplayer/develop/downloads/jiecaovideoplayer-2.0_final-javadoc.jar)
* [jiecaovideoplayer-2.0_final-sources.jar](https://raw.githubusercontent.com/lipangit/jiecaovideoplayer/develop/downloads/jiecaovideoplayer-2.0_final-sources.jar)
* [jiecaovideoplayer-3.0_preview.aar](https://raw.githubusercontent.com/lipangit/jiecaovideoplayer/develop/downloads/jiecaovideoplayer-3.0_preview.aar)
* [jiecaovideoplayer-3.0_preview-javadoc.jar](https://raw.githubusercontent.com/lipangit/jiecaovideoplayer/develop/downloads/jiecaovideoplayer-3.0_preview-javadoc.jar)
* [jiecaovideoplayer-3.0_preview-sources.jar](https://raw.githubusercontent.com/lipangit/jiecaovideoplayer/develop/downloads/jiecaovideoplayer-3.0_preview-sources.jar)

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

3.设置视频地址、缩略图地址、标题
```java
JCVideoPlayer jCVideoPlayer = (JCVideoPlayer) findViewById(R.id.videocontroller);
videoController.setUp("http://2449.vod.myqcloud.com/2449_43b6f696980311e59ed467f22794e792.f20.mp4","嫂子别摸我");
videoController.ivThumb.setThumbInCustomProject("http://p.qpic.cn/videoyun/0/2449_43b6f696980311e59ed467f22794e792_1/640");
JCVideoPlayerStandard jcVideoPlayerStandard = (JCVideoPlayerStandard) findViewById(R.id.custom_videoplayer_standard);
jcVideoPlayerStandard.setUp("http://2449.vod.myqcloud.com/2449_bfbbfa3cea8f11e5aac3db03cda99974.f20.mp4"
, "嫂子想我没");
jcVideoPlayerStandard.ivThumb.setThumbInCustomProject("http://p.qpic.cn/videoyun/0/2449_43b6f696980311e59ed467f22794e792_1/640");
```

4.在包含播放器的`Fragment``Activity``onPause()`方法中调用`JCVideoPlayer.releaseAllVideos();`

####其他接口

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

直接进入全屏,比如在webview中视频播放的适配很麻烦很无头绪,调用此接口直接全屏播放
```java
JCFullScreenActivity.toActivity(this,
"http://2449.vod.myqcloud.com/2449_43b6f696980311e59ed467f22794e792.f20.mp4",
"嫂子别摸我");
```

不显示标题
```java
jCVideoPlayer.setUp("http://2449.vod.myqcloud.com/2449_ded7b566b37911e5942f0b208e48548d.f20.mp4",
"嫂子还摸我", false);
```

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

用代码控制播放按钮的点击,如果是普通状态会播放视频,如果是播放中会暂停视频
```java
jCVideoPlayer.ivStart.performClick();
jcVideoPlayerStandard.ivStart.performClick();
```

混淆
####混淆
```
无需添加
```

####贡献者
##[自定义UI](./README_CUSTOM_UI-ZH.md)

##贡献者

节操精选Android小组([Nathen](https://github.com/lipangit) [Derlio](https://github.com/derlio)) [zhangzzqq](https://github.com/zhangzzqq) [carmelo-ruota](https://github.com/carmelo-ruota)

Expand All @@ -102,4 +91,4 @@ The above copyright notice and this permission notice shall be included in all c

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/j2.jpg
[1]: ./screenshots/j3.jpg
51 changes: 23 additions & 28 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# Jiecao Video Player

[![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-2.0_final-green.svg)](http://search.maven.org/#artifactdetails%7Cfm.jiecao%7Cjiecaovideoplayer%7C2.0_final%7Caar)
[![Maven Central](https://img.shields.io/badge/Maven%20Central-3.0_preview-green.svg)](http://search.maven.org/#artifactdetails%7Cfm.jiecao%7Cjiecaovideoplayer%7C3.0_preview%7Caar)
[![Licenses](https://img.shields.io/badge/license-MIT-green.svg)](http://choosealicense.com/licenses/mit/)
[![Android Arsenal](https://img.shields.io/badge/Android%20Arsenal-jiecaovideoplayer-green.svg?style=true)](https://android-arsenal.com/details/1/3269)
[![GitHub stars](https://img.shields.io/github/stars/lipangit/jiecaovideoplayer.svg?style=social&label=Star)]()

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.
Android truly full-screen capabilities, the Android platform to become the most widely used video playback controls

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

Expand All @@ -16,75 +16,70 @@ This is the real android video player view with fullscreen function, we are dedi
3. Video will be reset(pause) when it's scrolled out of the screen in `ListView` and `ViewPager`
4. Adaptive to the screen size, where at least the width or length of the video is adaptive while the other is centered on the screen
5. It will not disturb or change the playing state when entering or exiting fullscreen
6. Support to customize view controller’s skin
6. Completely custom ui
7. Support to display thumbnails when playing mp3
8. With limited storage, less than 50 kb

## Effect

**[jiecaovideoplayer-2.0_final-demo.apk](https://raw.githubusercontent.com/lipangit/jiecaovideoplayer/develop/downloads/jiecaovideoplayer-2.0_final-demo.apk)**
**[jiecaovideoplayer-3.0_preview-demo.apk](https://raw.githubusercontent.com/lipangit/jiecaovideoplayer/develop/downloads/jiecaovideoplayer-3.0_preview-demo.apk)**

![Demo Screenshot][1]

Demo video : http://v.youku.com/v_show/id_XMTQ2NzUwOTcyNA==.html

## Usage
1.Import library
1.Import library,stable version is fm.jiecao:jiecaovideoplayer:2.0_final
```gradle
compile 'fm.jiecao:jiecaovideoplayer:2.0_final'
compile 'fm.jiecao:jiecaovideoplayer:3.0_preview'
```

Or download lib

* [jiecaovideoplayer-2.0_final.aar](https://raw.githubusercontent.com/lipangit/jiecaovideoplayer/develop/downloads/jiecaovideoplayer-2.0_final.aar)
* [jiecaovideoplayer-2.0_final-javadoc.jar](https://raw.githubusercontent.com/lipangit/jiecaovideoplayer/develop/downloads/jiecaovideoplayer-2.0_final-javadoc.jar)
* [jiecaovideoplayer-2.0_final-sources.jar](https://raw.githubusercontent.com/lipangit/jiecaovideoplayer/develop/downloads/jiecaovideoplayer-2.0_final-sources.jar)
* [jiecaovideoplayer-3.0_preview.aar](https://raw.githubusercontent.com/lipangit/jiecaovideoplayer/develop/downloads/jiecaovideoplayer-3.0_preview.aar)
* [jiecaovideoplayer-3.0_preview-javadoc.jar](https://raw.githubusercontent.com/lipangit/jiecaovideoplayer/develop/downloads/jiecaovideoplayer-3.0_preview-javadoc.jar)
* [jiecaovideoplayer-3.0_preview-sources.jar](https://raw.githubusercontent.com/lipangit/jiecaovideoplayer/develop/downloads/jiecaovideoplayer-3.0_preview-sources.jar)

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

3.Set the video uri, video thumb url and video title
```java
JCVideoPlayer jCVideoPlayer = (JCVideoPlayer) findViewById(R.id.videocontroller);
videoController.setUp("http://2449.vod.myqcloud.com/2449_43b6f696980311e59ed467f22794e792.f20.mp4","嫂子别摸我");
videoController.ivThumb.setThumbInCustomProject("http://p.qpic.cn/videoyun/0/2449_43b6f696980311e59ed467f22794e792_1/640");
JCVideoPlayerStandard jcVideoPlayerStandard = (JCVideoPlayerStandard) findViewById(R.id.custom_videoplayer_standard);
jcVideoPlayerStandard.setUp("http://2449.vod.myqcloud.com/2449_bfbbfa3cea8f11e5aac3db03cda99974.f20.mp4"
, "嫂子想我没");
jcVideoPlayerStandard.ivThumb.setThumbInCustomProject("http://p.qpic.cn/videoyun/0/2449_43b6f696980311e59ed467f22794e792_1/640");
```

4.Remember to invoke `JCVideoPlayer.releaseAllVideos();` in `onPause()` of `Fragment` or `Activity`

#### Other APIs

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);
```

Invoke `JCFullScreenActivity.toActivity(...)` to enter fullscreen directly.
```java
JCFullScreenActivity.toActivity(this,
"http://2449.vod.myqcloud.com/2449_43b6f696980311e59ed467f22794e792.f20.mp4",
"嫂子别摸我");
```
Show title after fullscreen

Control play button,if state is normal it will play, if state is playing it will pause
```java
jCVideoPlayer.setUp("http://2449.vod.myqcloud.com/2449_ded7b566b37911e5942f0b208e48548d.f20.mp4",
"嫂子还摸我", false);
jcVideoPlayerStandard.ivStart.performClick();
```

If videoview move out from screen in ListView or ViewPager,there will onDetachedFromWindow() reset the videoplayer.
The goal is to add just outside the library layout, adding configuration, other problems in judgment and library operations.

ProGuard
```
Need nothing
```

####Contributors
##[Custom UI](./README_CUSTOM_UI.md)

##Contributors

节操精选Android小组([Nathen](https://github.com/lipangit) [Derlio](https://github.com/derlio)) [zhangzzqq](https://github.com/zhangzzqq) [carmelo-ruota](https://github.com/carmelo-ruota)

Expand All @@ -98,5 +93,5 @@ The above copyright notice and this permission notice shall be included in all c

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/j2.jpg
[1]: ./screenshots/j3.jpg

28 changes: 28 additions & 0 deletions README_CUSTOM_UI-ZH.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#自定义UI

参照JCVideoPlayerSimple,JCVideoPlayerStandard,JCVideoPlayerStandardWithShareButton

1. 继承JCVideoPlayer,JCVideoPlayer中包含所有关于播放的代码,不包含任何UI的代码
2. getLayoutId();布局的id
3. Override init(Context context);这里初始化自定义控件
4. Override setStateAndUi(int state);是重点,自定义各个状态的UI,如果在其他地方修改UI应该保持谨慎
5. Override onTouch(),onClick();如果有需要
6. 在自定义UI之后,应该依然按照[README.md](./README-ZH.md)中的4步骤来调用播放器

关于控件id的问题,在Base simple ui example中的所有最基础的id是写死在JCVideoPlayer中的,下面的控件id已经findViewById过了不需要再findViewById

| 控件 | id |
| ------------- |:-------------:|
| 开始按钮 | start |
| 全屏按钮 | fullscreen |
| 进度条 | progress |
| 总共时间 | total |
| 下方layout | layout_bottom |
| 上方layout | layout_top |
| SurfaceView的容器 | surface_container |

如果想快速的集成视频播放功能,建议参照JCVideoPlayerStandardWithShareButton来做,它继承JCVideoPlayerStandard,JCVideoPlayerStandard的目标是和今日头条的细节保持一致

如果想完全自定义UI,参照JCVideoPlayerStandard

如果在JCVideoPlayer之外写任何关于控制视频的代码不是我们的初衷,请提issue
29 changes: 29 additions & 0 deletions README_CUSTOM_UI.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#Custom ui

Referring JCVideoPlayerSimple, JCVideoPlayerStandard JCVideoPlayerStandardWith ShareButton

1. Inheritance JCVideoPlayer, JCVideoPlayer contains all the code on the player and does not contain any UI code
2. getLayoutId (); id layout
3. Override init (Context context); custom initialized here
4. Override setStateAndUi (int state); the focus, customize each state UI, if you modify the UI in other places should remain cautious
5. Override onTouch (), onClick (); if necessary
6. After the custom UI, you should still follow [README.md](./README.md) 4 steps to invoke Player

Control id on the problem, all in the most basic id Base simple ui example of death is written in JCVideoPlayer the following controls id has findViewById past do not need to findViewById

| control | id |
| ------------- |:-------------:|
| start button | start |
| fullscreen button | fullscreen |
| progress | progress |
| current time | current |
| total time | total |
| bottom layout | layout_bottom |
| top layout | layout_top |
| SurfaceView container | surface_container |

If you want to quickly integrate video playback, we recommend referring JCVideoPlayerStandardWithShareButton do, it inherits JCVideoPlayerStandard, JCVideoPlayerStandard goal is and details of today's headlines are consistent

If you want to fully customize the UI, referring JCVideoPlayerStandard

If you write any code on the control of the video outside JCVideoPlayer not our intention, please mention the issue
4 changes: 2 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 22
versionName "2.0_final"
versionCode 23
versionName "3.0_preview"
}
buildTypes {
release {
Expand Down
19 changes: 8 additions & 11 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="fm.jiecao.jiecaovideoplayer">
package="fm.jiecao.jiecaovideoplayer">

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.INTERNET"/>
<application
android:name=".DemoApplication"
android:allowBackup="true"
Expand All @@ -14,27 +14,24 @@
android:configChanges="orientation"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<action android:name="android.intent.action.MAIN"/>

<category android:name="android.intent.category.LAUNCHER" />
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>

<activity
android:name=".ListActivity"
android:screenOrientation="portrait" />
android:screenOrientation="portrait"/>

<activity
android:name=".ListViewpagerActivity"
android:screenOrientation="portrait" />

<activity
android:name=".SetSkinActivity"
android:screenOrientation="portrait" />
android:screenOrientation="portrait"/>

<activity
android:name=".LoadImageActivity"
android:screenOrientation="portrait" />
android:screenOrientation="portrait"/>

</application>

</manifest>
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@ public void onCreate() {
super.onCreate();
initUniversalImageLoader();

//这里将会改变所有缩略图的ScaleType | Here will change all thumbnails ScaleType
// JCVideoPlayer.setThumbImageViewScalType(ImageView.ScaleType.FIT_XY);
}

private void initUniversalImageLoader() {
Expand All @@ -35,7 +33,7 @@ private void initUniversalImageLoader() {
config.diskCacheFileNameGenerator(new Md5FileNameGenerator());
config.diskCacheSize(50 * 1024 * 1024); // 50 MiB
config.tasksProcessingOrder(QueueProcessingType.LIFO);
config.writeDebugLogs(); // Remove for release app
config.writeDebugLogs(); // Remove for releaseAllVideos app
config.defaultDisplayImageOptions(getDefaultDisplayImageOption());
// Initialize ImageLoader with configuration.
ImageLoader.getInstance().init(config.build());
Expand Down
Loading

0 comments on commit 14129d8

Please sign in to comment.