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.7'
Browse files Browse the repository at this point in the history
  • Loading branch information
Nathen committed Mar 9, 2016
2 parents 3dde030 + 02712df commit 7818bd9
Show file tree
Hide file tree
Showing 20 changed files with 198 additions and 89 deletions.
42 changes: 29 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#节操视频播放器 [![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/)
#节操视频播放器 [![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)]()

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

Expand All @@ -19,48 +19,64 @@


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

添加布局
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.releaseAllVideo();
JCVideoPlayer.setThumbImageViewScalType(ImageView.ScaleType.FIT_XY);
```

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

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

Expand Down
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 17
versionName "1.6"
versionCode 18
versionName "1.7"
}
buildTypes {
release {
Expand Down
16 changes: 4 additions & 12 deletions app/src/main/java/fm/jiecao/jiecaovideoplayer/DemoApplication.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,18 +31,15 @@ public class DemoApplication extends Application {
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,
// R.color.bottom_bg, R.drawable.skin_enlarge_video, R.drawable.skin_shrink_video);
initUniversalImageLoader();
//这里将会改变所有缩略图的ScaleType | Here will change all thumbnails ScaleType
// JCVideoPlayer.setThumbImageViewScalType(ImageView.ScaleType.FIT_XY);
}

private void initUniversalImageLoader() {
// This configuration tuning is custom. You can tune every option, you may tune some of them,
// or you can create default configuration by
// ImageLoaderConfiguration.createDefault(this);
// method.

DisplayImageOptions options = new DisplayImageOptions.Builder()
.showImageOnLoading(new ColorDrawable(Color.parseColor("#f0f0f0")))
.resetViewBeforeLoading(true)
Expand All @@ -51,13 +48,10 @@ private void initUniversalImageLoader() {
.considerExifParams(true)
.imageScaleType(ImageScaleType.EXACTLY_STRETCHED)
.bitmapConfig(Bitmap.Config.RGB_565)
// .displayer(new FadeInBitmapDisplayer(1000)) // 设置图片渐显的时间
// .delayBeforeLoading(300) // 下载前的延迟时间
.build();

int memClass = ((ActivityManager) getSystemService(Context.ACTIVITY_SERVICE))
.getMemoryClass();
// Use 1/8th of the available memory for this memory cache.
int memCacheSize = 1024 * 1024 * memClass / 8;

File cacheDir = new File(Environment.getExternalStorageDirectory().getPath() + "/jiecao/cache");
Expand All @@ -73,9 +67,7 @@ private void initUniversalImageLoader() {
.diskCache(new UnlimitedDiskCache(cacheDir))//自定义缓存路径
.imageDownloader(new BaseImageDownloader(this, 5 * 1000, 30 * 1000)) // connectTimeout (5 s), readTimeout (30 s)超时时间
.defaultDisplayImageOptions(options)
// .writeDebugLogs() // Remove for release app
.build();
// Initialize ImageLoader with configuration.
ImageLoader.getInstance().init(config);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
public class ListActivity extends AppCompatActivity {
ListView listView;


@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.Toast;

import de.greenrobot.event.EventBus;
import fm.jiecao.jcvideoplayer_lib.FullScreenActivity;
import fm.jiecao.jcvideoplayer_lib.JCVideoPlayer;
import fm.jiecao.jcvideoplayer_lib.VideoEvents;

Expand Down Expand Up @@ -108,7 +108,10 @@ public void onClick(View v) {
startActivity(new Intent(MainActivity.this, ListViewpagerActivity.class));
break;
case R.id.to_fullscreen:
Toast.makeText(MainActivity.this, "coming soon", Toast.LENGTH_SHORT).show();
FullScreenActivity.toActivity(this,
"http://2449.vod.myqcloud.com/2449_43b6f696980311e59ed467f22794e792.f20.mp4",
"http://p.qpic.cn/videoyun/0/2449_43b6f696980311e59ed467f22794e792_1/640",
"嫂子别摸我");
break;
case R.id.to_changecolor_activity:
startActivity(new Intent(this, SetSkinActivity.class));
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ buildscript {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.0.0-beta5'
classpath 'com.android.tools.build:gradle:2.0.0-beta6'

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
Expand Down
Binary file removed downloads/jiecaovideoplayer-1.5-demo.apk
Binary file not shown.
Binary file removed downloads/jiecaovideoplayer-1.5-javadoc.jar
Binary file not shown.
Binary file added downloads/jiecaovideoplayer-1.6-demo.apk
Binary file not shown.
Binary file added downloads/jiecaovideoplayer-1.6-javadoc.jar
Binary file not shown.
Binary file not shown.
Binary file not shown.
4 changes: 2 additions & 2 deletions jcvideoplayer-lib/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ android {
defaultConfig {
minSdkVersion 14
targetSdkVersion 23
versionCode 17
versionName "1.6"
versionCode 18
versionName "1.7"
}
buildTypes {
release {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import android.content.Intent;
import android.content.pm.ActivityInfo;
import android.os.Bundle;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;

Expand All @@ -17,11 +18,22 @@
*/
public class FullScreenActivity extends Activity {

public static void toActivity(Context context, int state, String url, String thumb, String title) {
static void toActivityFromNormal(Context context, int state, String url, String thumb, String title) {
STATE = state;
URL = url;
THUMB = thumb;
TITLE = title;
start = false;
Intent intent = new Intent(context, FullScreenActivity.class);
context.startActivity(intent);
}

public static void toActivity(Context context, String url, String thumb, String title) {
STATE = JCVideoPlayer.CURRENT_STATE_NORMAL;
URL = url;
THUMB = thumb;
TITLE = title;
start = true;
Intent intent = new Intent(context, FullScreenActivity.class);
context.startActivity(intent);
}
Expand All @@ -36,14 +48,18 @@ public static void toActivity(Context context, int state, String url, String thu
public static String THUMB;
public static boolean manualQuit = false;
protected static Skin skin;
static boolean start = false;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
View decor = this.getWindow().getDecorView();
decor.setSystemUiVisibility(View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY);
setContentView(R.layout.activity_fullscreen);

jcVideoPlayer = (JCVideoPlayer) findViewById(R.id.jcvideoplayer);
if (skin != null) {
jcVideoPlayer.setSkin(skin.titleColor, skin.timeColor, skin.seekDrawable, skin.bottomControlBackground,
Expand All @@ -53,6 +69,9 @@ protected void onCreate(Bundle savedInstanceState) {
jcVideoPlayer.setState(STATE);
JCMediaManager.intance().setUuid(jcVideoPlayer.uuid);
manualQuit = false;
if (start) {
jcVideoPlayer.ivStart.performClick();
}
}

public void onEventMainThread(VideoEvents videoEvents) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@


/**
* 统一管理MediaPlayer,管理视频的暂停播放进度全屏的功能
* <p>统一管理MediaPlayer的地方,只有一个mediaPlayer实例,那么不会有多个视频同时播放,也节省资源。</p>
* <p>Unified management MediaPlayer place, there is only one MediaPlayer instance, then there will be no more video broadcast at the same time, also save resources.</p>
* Created by Nathen
* On 2015/11/30 15:39
*/
Expand All @@ -25,6 +26,7 @@ class JCMediaManager implements MediaPlayer.OnPreparedListener, MediaPlayer.OnCo
private String prev_uuid = "";
public int currentVideoWidth = 0;
public int currentVideoHeight = 0;
private static final String TAG = "JiecaoVideoplayer";

public static JCMediaManager intance() {
if (jcMediaManager == null) {
Expand Down Expand Up @@ -84,10 +86,10 @@ public boolean onError(MediaPlayer mp, int what, int extra) {
}

public void setUuid(String uuid) {
Log.i("uuid::", "0 " + uuid + " prevuuid " + prev_uuid);
Log.i(TAG, "0 " + uuid + " prevuuid " + prev_uuid);
// backUpUuid();
this.uuid = uuid;
Log.i("uuid::", "1 " + uuid + " prevuuid " + prev_uuid);
Log.i(TAG, "1 " + uuid + " prevuuid " + prev_uuid);
}

public void backUpUuid() {
Expand All @@ -97,7 +99,7 @@ public void backUpUuid() {
public void revertUuid() {
this.uuid = this.prev_uuid;
this.prev_uuid = "";
Log.i("uuid::", "2 " + uuid + " prevuuid " + prev_uuid);
Log.i(TAG, "2 " + uuid + " prevuuid " + prev_uuid);
}

@Override
Expand Down
Loading

0 comments on commit 7818bd9

Please sign in to comment.