diff --git a/README-ZH.md b/README-ZH.md new file mode 100644 index 000000000..a62e29c60 --- /dev/null +++ b/README-ZH.md @@ -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 + +``` + +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 (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 diff --git a/README.md b/README.md index e69aac359..ff711e55f 100644 --- a/README.md +++ b/README.md @@ -1,30 +1,37 @@ -#节操视频播放器 [![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 ``` -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*(***); } @@ -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 + diff --git a/app/build.gradle b/app/build.gradle index 7ba15652a..3a05b95f5 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -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 { @@ -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' } diff --git a/app/src/main/java/fm/jiecao/jiecaovideoplayer/DemoApplication.java b/app/src/main/java/fm/jiecao/jiecaovideoplayer/DemoApplication.java index 3e218785b..922a05c77 100644 --- a/app/src/main/java/fm/jiecao/jiecaovideoplayer/DemoApplication.java +++ b/app/src/main/java/fm/jiecao/jiecaovideoplayer/DemoApplication.java @@ -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, @@ -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; - } } diff --git a/app/src/main/java/fm/jiecao/jiecaovideoplayer/MainActivity.java b/app/src/main/java/fm/jiecao/jiecaovideoplayer/MainActivity.java index 54ddf125c..ae5f8a3b5 100644 --- a/app/src/main/java/fm/jiecao/jiecaovideoplayer/MainActivity.java +++ b/app/src/main/java/fm/jiecao/jiecaovideoplayer/MainActivity.java @@ -8,7 +8,6 @@ import android.widget.Button; import de.greenrobot.event.EventBus; -import fm.jiecao.jcvideoplayer_lib.FullScreenActivity; import fm.jiecao.jcvideoplayer_lib.JCVideoPlayer; import fm.jiecao.jcvideoplayer_lib.VideoEvents; @@ -21,6 +20,11 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); + /** + * 如果没有埋点需求,可以不用注册eventbus + *
+ * if you do not want to get Buried Point , you do not need regist eventbus here + */ EventBus.getDefault().register(this); videoController1 = (JCVideoPlayer) findViewById(R.id.videocontroller1); @@ -56,50 +60,41 @@ protected void onPause() { JCVideoPlayer.releaseAllVideos(); } - @Override - protected void onDestroy() { - super.onDestroy(); - EventBus.getDefault().unregister(this); - } - /** - * 如果没有埋点需求,可以不用注册eventbus - */ public void onEventMainThread(VideoEvents event) { if (event.type == VideoEvents.POINT_START_ICON) { - Log.i("Video Event", "POINT_START_ICON"); + Log.i("Video Event", "POINT_START_ICON" + " title is : " + event.obj + " url is : " + event.obj1); } else if (event.type == VideoEvents.POINT_START_THUMB) { - Log.i("Video Event", "POINT_START_THUMB"); + Log.i("Video Event", "POINT_START_THUMB" + " title is : " + event.obj + " url is : " + event.obj1); } else if (event.type == VideoEvents.POINT_STOP) { - Log.i("Video Event", "POINT_STOP"); + Log.i("Video Event", "POINT_STOP" + " title is : " + event.obj + " url is : " + event.obj1); } else if (event.type == VideoEvents.POINT_STOP_FULLSCREEN) { - Log.i("Video Event", "POINT_STOP_FULLSCREEN"); + Log.i("Video Event", "POINT_STOP_FULLSCREEN" + " title is : " + event.obj + " url is : " + event.obj1); } else if (event.type == VideoEvents.POINT_RESUME) { - Log.i("Video Event", "POINT_RESUME"); + Log.i("Video Event", "POINT_RESUME" + " title is : " + event.obj + " url is : " + event.obj1); } else if (event.type == VideoEvents.POINT_RESUME_FULLSCREEN) { - Log.i("Video Event", "POINT_RESUME_FULLSCREEN"); + Log.i("Video Event", "POINT_RESUME_FULLSCREEN" + " title is : " + event.obj + " url is : " + event.obj1); } else if (event.type == VideoEvents.POINT_CLICK_BLANK) { - Log.i("Video Event", "POINT_CLICK_BLANK"); + Log.i("Video Event", "POINT_CLICK_BLANK" + " title is : " + event.obj + " url is : " + event.obj1); } else if (event.type == VideoEvents.POINT_CLICK_BLANK_FULLSCREEN) { - Log.i("Video Event", "POINT_CLICK_BLANK_FULLSCREEN"); + Log.i("Video Event", "POINT_CLICK_BLANK_FULLSCREEN" + " title is : " + event.obj + " url is : " + event.obj1); } else if (event.type == VideoEvents.POINT_CLICK_SEEKBAR) { - Log.i("Video Event", "POINT_CLICK_SEEKBAR"); + Log.i("Video Event", "POINT_CLICK_SEEKBAR" + " title is : " + event.obj + " url is : " + event.obj1); } else if (event.type == VideoEvents.POINT_CLICK_SEEKBAR_FULLSCREEN) { - Log.i("Video Event", "POINT_CLICK_SEEKBAR_FULLSCREEN"); + Log.i("Video Event", "POINT_CLICK_SEEKBAR_FULLSCREEN" + " title is : " + event.obj + " url is : " + event.obj1); } else if (event.type == VideoEvents.POINT_AUTO_COMPLETE) { - Log.i("Video Event", "POINT_AUTO_COMPLETE"); + Log.i("Video Event", "POINT_AUTO_COMPLETE" + " title is : " + event.obj + " url is : " + event.obj1); } else if (event.type == VideoEvents.POINT_AUTO_COMPLETE_FULLSCREEN) { - Log.i("Video Event", "POINT_AUTO_COMPLETE_FULLSCREEN"); + Log.i("Video Event", "POINT_AUTO_COMPLETE_FULLSCREEN" + " title is : " + event.obj + " url is : " + event.obj1); } else if (event.type == VideoEvents.POINT_ENTER_FULLSCREEN) { - Log.i("Video Event", "POINT_ENTER_FULLSCREEN"); + Log.i("Video Event", "POINT_ENTER_FULLSCREEN" + " title is : " + event.obj + " url is : " + event.obj1); } else if (event.type == VideoEvents.POINT_QUIT_FULLSCREEN) { - Log.i("Video Event", "POINT_QUIT_FULLSCREEN"); + Log.i("Video Event", "POINT_QUIT_FULLSCREEN" + " title is : " + event.obj + " url is : " + event.obj1); } } @Override public void onClick(View v) { - JCVideoPlayer.releaseAllVideos(); switch (v.getId()) { case R.id.to_list_activity: startActivity(new Intent(MainActivity.this, ListActivity.class)); @@ -108,7 +103,7 @@ public void onClick(View v) { startActivity(new Intent(MainActivity.this, ListViewpagerActivity.class)); break; case R.id.to_fullscreen: - FullScreenActivity.toActivity(this, + JCVideoPlayer.toFullscreenActivity(this, "http://2449.vod.myqcloud.com/2449_43b6f696980311e59ed467f22794e792.f20.mp4", "http://p.qpic.cn/videoyun/0/2449_43b6f696980311e59ed467f22794e792_1/640", "嫂子别摸我"); @@ -118,4 +113,11 @@ public void onClick(View v) { break; } } + + + @Override + protected void onDestroy() { + super.onDestroy(); + EventBus.getDefault().unregister(this); + } } diff --git a/app/src/main/res/layout/activity_setskin.xml b/app/src/main/res/layout/activity_setskin.xml index 52039142e..3136458a1 100644 --- a/app/src/main/res/layout/activity_setskin.xml +++ b/app/src/main/res/layout/activity_setskin.xml @@ -1,13 +1,20 @@ - + android:orientation="vertical" + + > + android:layout_height="0dp" + app:layout_heightPercent="60%h" + + /> - + diff --git a/app/src/main/res/values-zh/strings.xml b/app/src/main/res/values-zh/strings.xml new file mode 100644 index 000000000..92397456e --- /dev/null +++ b/app/src/main/res/values-zh/strings.xml @@ -0,0 +1,4 @@ + + + 节操视频播放器 + diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index c532badb8..7c5e508e5 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -1,3 +1,3 @@ - 节操视频播放器 + JiecaoVideoPlayer diff --git a/build.gradle b/build.gradle index 9ba597255..cb24306f3 100644 --- a/build.gradle +++ b/build.gradle @@ -5,7 +5,7 @@ buildscript { jcenter() } dependencies { - classpath 'com.android.tools.build:gradle:2.0.0-beta6' + classpath 'com.android.tools.build:gradle:2.1.0-alpha1' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files diff --git a/downloads/jiecaovideoplayer-1.6-demo.apk b/downloads/jiecaovideoplayer-1.6-demo.apk deleted file mode 100644 index b20a6235e..000000000 Binary files a/downloads/jiecaovideoplayer-1.6-demo.apk and /dev/null differ diff --git a/downloads/jiecaovideoplayer-1.6-javadoc.jar b/downloads/jiecaovideoplayer-1.6-javadoc.jar deleted file mode 100644 index 11d2ebe95..000000000 Binary files a/downloads/jiecaovideoplayer-1.6-javadoc.jar and /dev/null differ diff --git a/downloads/jiecaovideoplayer-1.6-sources.jar b/downloads/jiecaovideoplayer-1.6-sources.jar deleted file mode 100644 index 746c444e4..000000000 Binary files a/downloads/jiecaovideoplayer-1.6-sources.jar and /dev/null differ diff --git a/downloads/jiecaovideoplayer-1.6.aar b/downloads/jiecaovideoplayer-1.6.aar deleted file mode 100644 index 9f80c7294..000000000 Binary files a/downloads/jiecaovideoplayer-1.6.aar and /dev/null differ diff --git a/downloads/jiecaovideoplayer-1.8-demo.apk b/downloads/jiecaovideoplayer-1.8-demo.apk new file mode 100644 index 000000000..692ae478c Binary files /dev/null and b/downloads/jiecaovideoplayer-1.8-demo.apk differ diff --git a/downloads/jiecaovideoplayer-1.8-javadoc.jar b/downloads/jiecaovideoplayer-1.8-javadoc.jar new file mode 100644 index 000000000..a3913d2e3 Binary files /dev/null and b/downloads/jiecaovideoplayer-1.8-javadoc.jar differ diff --git a/downloads/jiecaovideoplayer-1.8-sources.jar b/downloads/jiecaovideoplayer-1.8-sources.jar new file mode 100644 index 000000000..b3893c9bc Binary files /dev/null and b/downloads/jiecaovideoplayer-1.8-sources.jar differ diff --git a/downloads/jiecaovideoplayer-1.8.aar b/downloads/jiecaovideoplayer-1.8.aar new file mode 100644 index 000000000..e4bd51e1a Binary files /dev/null and b/downloads/jiecaovideoplayer-1.8.aar differ diff --git a/gradle/maven_push.gradle b/gradle/maven_push.gradle index bd6df8360..0a9f965d5 100644 --- a/gradle/maven_push.gradle +++ b/gradle/maven_push.gradle @@ -22,7 +22,7 @@ signing { group = "fm.jiecao" archivesBaseName = "jiecaovideoplayer" -version = "1.6" +version = "1.8" uploadArchives { repositories { diff --git a/jcvideoplayer-lib/build.gradle b/jcvideoplayer-lib/build.gradle index a78d82847..7b4f7bae6 100644 --- a/jcvideoplayer-lib/build.gradle +++ b/jcvideoplayer-lib/build.gradle @@ -7,8 +7,8 @@ android { defaultConfig { minSdkVersion 14 targetSdkVersion 23 - versionCode 18 - versionName "1.7" + versionCode 19 + versionName "1.8" } buildTypes { release { diff --git a/jcvideoplayer-lib/src/main/java/fm/jiecao/jcvideoplayer_lib/FullScreenActivity.java b/jcvideoplayer-lib/src/main/java/fm/jiecao/jcvideoplayer_lib/FullScreenActivity.java index 2501c76eb..cb8e1e1b1 100644 --- a/jcvideoplayer-lib/src/main/java/fm/jiecao/jcvideoplayer_lib/FullScreenActivity.java +++ b/jcvideoplayer-lib/src/main/java/fm/jiecao/jcvideoplayer_lib/FullScreenActivity.java @@ -12,11 +12,12 @@ import de.greenrobot.event.EventBus; /** - * 可能会有直接全屏显示的需求 + *

全屏的activity

+ *

fullscreen activity

* Created by Nathen * On 2015/12/01 11:17 */ -public class FullScreenActivity extends Activity { +class FullScreenActivity extends Activity { static void toActivityFromNormal(Context context, int state, String url, String thumb, String title) { STATE = state; diff --git a/jcvideoplayer-lib/src/main/java/fm/jiecao/jcvideoplayer_lib/JCMediaManager.java b/jcvideoplayer-lib/src/main/java/fm/jiecao/jcvideoplayer_lib/JCMediaManager.java index 3477f1d66..f55b785ee 100644 --- a/jcvideoplayer-lib/src/main/java/fm/jiecao/jcvideoplayer_lib/JCMediaManager.java +++ b/jcvideoplayer-lib/src/main/java/fm/jiecao/jcvideoplayer_lib/JCMediaManager.java @@ -5,7 +5,6 @@ import android.media.MediaPlayer; import android.net.Uri; import android.text.TextUtils; -import android.util.Log; import java.io.IOException; @@ -26,7 +25,6 @@ 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) { @@ -86,10 +84,7 @@ public boolean onError(MediaPlayer mp, int what, int extra) { } public void setUuid(String uuid) { - Log.i(TAG, "0 " + uuid + " prevuuid " + prev_uuid); -// backUpUuid(); this.uuid = uuid; - Log.i(TAG, "1 " + uuid + " prevuuid " + prev_uuid); } public void backUpUuid() { @@ -99,7 +94,6 @@ public void backUpUuid() { public void revertUuid() { this.uuid = this.prev_uuid; this.prev_uuid = ""; - Log.i(TAG, "2 " + uuid + " prevuuid " + prev_uuid); } @Override diff --git a/jcvideoplayer-lib/src/main/java/fm/jiecao/jcvideoplayer_lib/JCVideoPlayer.java b/jcvideoplayer-lib/src/main/java/fm/jiecao/jcvideoplayer_lib/JCVideoPlayer.java index 663b88ddd..2fec36d5a 100644 --- a/jcvideoplayer-lib/src/main/java/fm/jiecao/jcvideoplayer_lib/JCVideoPlayer.java +++ b/jcvideoplayer-lib/src/main/java/fm/jiecao/jcvideoplayer_lib/JCVideoPlayer.java @@ -336,7 +336,6 @@ public void onEventMainThread(VideoEvents videoEvents) { } } else if (videoEvents.type == VideoEvents.VE_MEDIAPLAYER_SEEKCOMPLETE) { pbLoading.setVisibility(View.INVISIBLE); - Log.i("JCVideoPlayer", "seek compile"); } } @@ -362,6 +361,7 @@ public void onClick(View v) { setProgressBuffered(0); JCMediaManager.intance().prepareToPlay(getContext(), url); JCMediaManager.intance().setUuid(uuid); + Log.i("JCVideoPlayer", "play video"); VideoEvents videoEvents = new VideoEvents().setType(VideoEvents.VE_START); videoEvents.obj = uuid; @@ -377,6 +377,8 @@ public void onClick(View v) { ivCover.setVisibility(View.INVISIBLE); } JCMediaManager.intance().mediaPlayer.pause(); + Log.i("JCVideoPlayer", "pause video"); + updateStartImage(); setKeepScreenOn(false); cancelDismissControlViewTimer(); @@ -388,6 +390,8 @@ public void onClick(View v) { ivCover.setVisibility(View.INVISIBLE); } JCMediaManager.intance().mediaPlayer.start(); + Log.i("JCVideoPlayer", "go on video"); + updateStartImage(); setKeepScreenOn(true); startDismissControlViewTimer(); @@ -513,14 +517,12 @@ public void run() { } } }, 0, 300); - Log.i("update buffer", "updatebuffer:: start"); } private void cancelProgressTimer() { if (uuid.equals(JCMediaManager.intance().uuid)) { if (mUpdateProgressTimer != null) { mUpdateProgressTimer.cancel(); - Log.i("update buffer", "updatebuffer:: cancel"); } } } @@ -708,6 +710,7 @@ private void sendPointEvent(int type) { VideoEvents videoEvents = new VideoEvents(); videoEvents.setType(type); videoEvents.obj = title; + videoEvents.obj1 = url; EventBus.getDefault().post(videoEvents); } @@ -782,6 +785,10 @@ public static void setGlobleSkin(int titleColor, int timeColor, int seekDrawable enlargRecId, shrinkRecId); } + public static void toFullscreenActivity(Context context, String url, String thumb, String title) { + FullScreenActivity.toActivity(context, url, thumb, title); + } + private void setSkin() { if (skin != null) { setSkin(skin); diff --git a/jcvideoplayer-lib/src/main/res/drawable/biz_video_progressbar.xml b/jcvideoplayer-lib/src/main/res/drawable/biz_video_progressbar.xml deleted file mode 100644 index 3fb0479c3..000000000 --- a/jcvideoplayer-lib/src/main/res/drawable/biz_video_progressbar.xml +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - diff --git a/jcvideoplayer-lib/src/main/res/drawable/seek_progress.xml b/jcvideoplayer-lib/src/main/res/drawable/seek_progress.xml index 8a7770d32..35364609e 100644 --- a/jcvideoplayer-lib/src/main/res/drawable/seek_progress.xml +++ b/jcvideoplayer-lib/src/main/res/drawable/seek_progress.xml @@ -3,16 +3,16 @@ - - + + - - + + @@ -20,8 +20,8 @@ - - + + diff --git a/jcvideoplayer-lib/src/main/res/layout/video_control_view.xml b/jcvideoplayer-lib/src/main/res/layout/video_control_view.xml index 66049906d..4f9b7f427 100644 --- a/jcvideoplayer-lib/src/main/res/layout/video_control_view.xml +++ b/jcvideoplayer-lib/src/main/res/layout/video_control_view.xml @@ -19,7 +19,7 @@ android:id="@+id/bottom_progressbar" style="?android:attr/progressBarStyleHorizontal" android:layout_width="match_parent" - android:layout_height="1.5dip" + android:layout_height="1.5dp" android:layout_alignParentBottom="true" android:max="100" android:progressDrawable="@drawable/video_progress" /> @@ -35,7 +35,7 @@ android:layout_alignParentRight="true" android:layout_alignParentStart="true" android:layout_alignParentTop="true" - android:background="#000000" /> + android:background="#222222" /> @@ -73,23 +71,20 @@ android:layout_height="wrap_content" android:layout_gravity="center_vertical" android:layout_weight="1.0" + android:background="@null" android:max="100" android:maxHeight="4dp" android:minHeight="4dp" android:paddingBottom="8dp" - android:paddingLeft="0dp" - android:paddingRight="0dp" android:paddingTop="8dp" android:progressDrawable="@drawable/seek_progress" android:thumb="@drawable/seek_thumb" - android:thumbOffset="0dp" /> + /> @@ -97,26 +92,12 @@ android:id="@+id/fullscreen" android:layout_width="wrap_content" android:layout_height="fill_parent" - android:paddingLeft="16.0dip" - android:paddingRight="16.0dip" + android:paddingLeft="16dp" + android:paddingRight="16dp" android:scaleType="center" android:src="@drawable/enlarge_video" /> - - - + + - diff --git a/jcvideoplayer-lib/src/main/res/values-zh/strings.xml b/jcvideoplayer-lib/src/main/res/values-zh/strings.xml new file mode 100644 index 000000000..92397456e --- /dev/null +++ b/jcvideoplayer-lib/src/main/res/values-zh/strings.xml @@ -0,0 +1,4 @@ + + + 节操视频播放器 + diff --git a/jcvideoplayer-lib/src/main/res/values/strings.xml b/jcvideoplayer-lib/src/main/res/values/strings.xml index c532badb8..7c5e508e5 100644 --- a/jcvideoplayer-lib/src/main/res/values/strings.xml +++ b/jcvideoplayer-lib/src/main/res/values/strings.xml @@ -1,3 +1,3 @@ - 节操视频播放器 + JiecaoVideoPlayer