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/v6.2.5'
Browse files Browse the repository at this point in the history
  • Loading branch information
Nathen committed Jan 21, 2018
2 parents 7431112 + b74a954 commit 3bedfc1
Show file tree
Hide file tree
Showing 20 changed files with 166 additions and 44 deletions.
9 changes: 5 additions & 4 deletions README-ZH.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
--
<p align="center">
<a href="http://developer.android.com/index.html"><img src="https://img.shields.io/badge/platform-android-green.svg"></a>
<a href="http://search.maven.org/#artifactdetails%7Ccn.jzvd%7Cjiaozivideoplayer%7C5.8.2%7Caar"><img src="https://img.shields.io/badge/Maven%20Central-6.2.4-green.svg"></a>
<a href="http://search.maven.org/#artifactdetails%7Ccn.jzvd%7Cjiaozivideoplayer%7C5.8.2%7Caar"><img src="https://img.shields.io/badge/Maven%20Central-6.2.5-green.svg"></a>
<a href="http://choosealicense.com/licenses/mit/"><img src="https://img.shields.io/badge/license-MIT-green.svg"></a>
<a href="https://android-arsenal.com/details/1/3269"><img src="https://img.shields.io/badge/Android%20Arsenal-jiaozivideoplayer-green.svg?style=true"></a>
</p>
Expand All @@ -20,10 +20,11 @@
9. 全屏后手势修改进度和音量
10. Home键退出界面暂停播放,返回界面继续播放
11. WebView嵌套本地视频控件
12. demo中添加视频缓存的例子

## 效果

**[jiaozivideoplayer-6.2.4.apk](https://github.com/lipangit/JiaoZiVideoPlayer/releases/download/v6.2.4/jiaozivideoplayer-6.2.4.apk)**
**[jiaozivideoplayer-6.2.5.apk](https://github.com/lipangit/JiaoZiVideoPlayer/releases/download/v6.2.5/jiaozivideoplayer-6.2.5.apk)**

![Demo Screenshot][1]

Expand All @@ -35,10 +36,10 @@

1.添加类库
```gradle
compile 'cn.jzvd:jiaozivideoplayer:6.2.4'
compile 'cn.jzvd:jiaozivideoplayer:6.2.5'
```

或直接下载 [jar包](https://github.com/lipangit/JiaoZiVideoPlayer/releases/tag/v6.2.4) (不建议)
或直接下载 [jar包](https://github.com/lipangit/JiaoZiVideoPlayer/releases/tag/v6.2.5) (不建议)

2.添加布局
```xml
Expand Down
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
--
<p align="center">
<a href="http://developer.android.com/index.html"><img src="https://img.shields.io/badge/platform-android-green.svg"></a>
<a href="http://search.maven.org/#artifactdetails%7Ccn.jzvd%7Cjiaozivideoplayer%7C5.8.2%7Caar"><img src="https://img.shields.io/badge/Maven%20Central-6.2.4-green.svg"></a>
<a href="http://search.maven.org/#artifactdetails%7Ccn.jzvd%7Cjiaozivideoplayer%7C5.8.2%7Caar"><img src="https://img.shields.io/badge/Maven%20Central-6.2.5-green.svg"></a>
<a href="http://choosealicense.com/licenses/mit/"><img src="https://img.shields.io/badge/license-MIT-green.svg"></a>
<a href="https://android-arsenal.com/details/1/3269"><img src="https://img.shields.io/badge/Android%20Arsenal-jiaozivideoplayer-green.svg?style=true"></a>
</p>
Expand Down Expand Up @@ -31,10 +31,11 @@ Q群:490442439 验证信息:jzvd
9. Change progress and volume right from full screen mode
10. Home key to exit the interface to suspend the playback, return to the interface to continue playing
11. WebView Nested Local Video Controls
12. VideoCache in dem,o

## A demo showing available effects

**[jiaozivideoplayer-6.2.4.apk](https://github.com/lipangit/JiaoZiVideoPlayer/releases/download/v6.2.4/jiaozivideoplayer-6.2.4.apk)**
**[jiaozivideoplayer-6.2.5.apk](https://github.com/lipangit/JiaoZiVideoPlayer/releases/download/v6.2.5/jiaozivideoplayer-6.2.5.apk)**

![Demo Screenshot][1]

Expand All @@ -46,10 +47,10 @@ Only five steps to use the player.

1.Import library
```gradle
compile 'cn.jzvd:jiaozivideoplayer:6.2.4'
compile 'cn.jzvd:jiaozivideoplayer:6.2.5'
```

Or download [lib](https://github.com/lipangit/JiaoZiVideoPlayer/releases/tag/v6.2.4) (not recommended)
Or download [lib](https://github.com/lipangit/JiaoZiVideoPlayer/releases/tag/v6.2.5) (not recommended)

2.Add JZVideoPlayer in your layout
```xml
Expand Down
9 changes: 5 additions & 4 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ android {
applicationId "cn.jzvd.demo"
minSdkVersion 16
targetSdkVersion 27
versionCode 75
versionName "6.2.4"
versionCode 76
versionName "6.2.5"
}
signingConfigs {
releaseConfig {
Expand Down Expand Up @@ -38,12 +38,13 @@ dependencies {
implementation project(':jiaozivideoplayer')
implementation 'com.squareup.picasso:picasso:2.5.2'

compile 'tv.danmaku.ijk.media:ijkplayer-java:0.8.4'
compile 'tv.danmaku.ijk.media:ijkplayer-armv7a:0.8.4'
implementation 'tv.danmaku.ijk.media:ijkplayer-java:0.8.4'
implementation 'tv.danmaku.ijk.media:ijkplayer-armv7a:0.8.4'

debugCompile 'com.squareup.leakcanary:leakcanary-android:1.5.4'
releaseCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.5.4'
testCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.5.4'

implementation 'com.android.support:recyclerview-v7:27.0.2'
implementation 'com.danikula:videocache:2.7.0'
}
5 changes: 4 additions & 1 deletion app/src/main/java/cn/jzvd/demo/ActivityApi.java
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,10 @@ protected void onCreate(@Nullable Bundle savedInstanceState) {

mJzVideoPlayerStandard = findViewById(R.id.jz_video);
LinkedHashMap map = new LinkedHashMap();
map.put("高清", VideoConstant.videoUrls[0][9]);

String proxyUrl = ApplicationDemo.getProxy(this).getProxyUrl(VideoConstant.videoUrls[0][9]);

map.put("高清", proxyUrl);
map.put("标清", VideoConstant.videoUrls[0][6]);
map.put("普清", VideoConstant.videoUrlList[0]);
Object[] objects = new Object[3];
Expand Down
14 changes: 12 additions & 2 deletions app/src/main/java/cn/jzvd/demo/ActivityApiUISmallChange.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import cn.jzvd.demo.CustomView.JZVideoPlayerStandardShowShareButtonAfterFullscreen;
import cn.jzvd.demo.CustomView.JZVideoPlayerStandardShowTextureViewAfterAutoComplete;
import cn.jzvd.demo.CustomView.JZVideoPlayerStandardShowTitleAfterFullscreen;
import cn.jzvd.demo.CustomView.JZVideoPlayerStandardVolumeAfterFullscreen;

/**
* Created by Nathen on 16/7/31.
Expand All @@ -22,6 +23,7 @@ public class ActivityApiUISmallChange extends AppCompatActivity {
JZVideoPlayerStandardShowTitleAfterFullscreen jzVideoPlayerStandardShowTitleAfterFullscreen;
JZVideoPlayerStandardShowTextureViewAfterAutoComplete jzVideoPlayerStandardShowTextureViewAfterAutoComplete;
JZVideoPlayerStandardAutoCompleteAfterFullscreen jzVideoPlayerStandardAutoCompleteAfterFullscreen;
JZVideoPlayerStandardVolumeAfterFullscreen jzVideoPlayerStandardVolumeAfterFullscreen;

JZVideoPlayerStandard jzVideoPlayerStandard_1_1, jzVideoPlayerStandard_16_9;

Expand Down Expand Up @@ -64,7 +66,7 @@ protected void onCreate(@Nullable Bundle savedInstanceState) {
.load(VideoConstant.videoThumbs[0][1])
.into(jzVideoPlayerStandardAutoCompleteAfterFullscreen.thumbImageView);

jzVideoPlayerStandard_1_1 = (JZVideoPlayerStandardAutoCompleteAfterFullscreen) findViewById(R.id.jz_videoplayer_1_1);
jzVideoPlayerStandard_1_1 = findViewById(R.id.jz_videoplayer_1_1);
jzVideoPlayerStandard_1_1.setUp(VideoConstant.videoUrls[0][1], JZVideoPlayer.SCREEN_WINDOW_NORMAL
, "饺子有事吗");
Picasso.with(this)
Expand All @@ -73,14 +75,22 @@ protected void onCreate(@Nullable Bundle savedInstanceState) {
jzVideoPlayerStandard_1_1.widthRatio = 1;
jzVideoPlayerStandard_1_1.heightRatio = 1;

jzVideoPlayerStandard_16_9 = (JZVideoPlayerStandardAutoCompleteAfterFullscreen) findViewById(R.id.jz_videoplayer_16_9);
jzVideoPlayerStandard_16_9 = findViewById(R.id.jz_videoplayer_16_9);
jzVideoPlayerStandard_16_9.setUp(VideoConstant.videoUrls[0][1], JZVideoPlayer.SCREEN_WINDOW_NORMAL
, "饺子来不了");
Picasso.with(this)
.load(VideoConstant.videoThumbs[0][1])
.into(jzVideoPlayerStandard_16_9.thumbImageView);
jzVideoPlayerStandard_16_9.widthRatio = 16;
jzVideoPlayerStandard_16_9.heightRatio = 9;

jzVideoPlayerStandardVolumeAfterFullscreen = findViewById(R.id.jz_videoplayer_volume);
jzVideoPlayerStandardVolumeAfterFullscreen.setUp(VideoConstant.videoUrls[0][1], JZVideoPlayer.SCREEN_WINDOW_NORMAL
, "饺子摇摆");
Picasso.with(this)
.load(VideoConstant.videoThumbs[0][1])
.into(jzVideoPlayerStandardVolumeAfterFullscreen.thumbImageView);

}

@Override
Expand Down
1 change: 1 addition & 0 deletions app/src/main/java/cn/jzvd/demo/ActivityMain.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.Toast;

import com.squareup.picasso.Picasso;

Expand Down
13 changes: 13 additions & 0 deletions app/src/main/java/cn/jzvd/demo/ApplicationDemo.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package cn.jzvd.demo;

import android.app.Application;
import android.content.Context;

import com.danikula.videocache.HttpProxyCacheServer;
import com.squareup.leakcanary.LeakCanary;

/**
Expand All @@ -19,4 +21,15 @@ public void onCreate() {
//JZVideoPlayer.TOOL_BAR_EXIST = false;
//JZVideoPlayer.ACTION_BAR_EXIST = false;
}

private HttpProxyCacheServer proxy;

public static HttpProxyCacheServer getProxy(Context context) {
ApplicationDemo app = (ApplicationDemo) context.getApplicationContext();
return app.proxy == null ? (app.proxy = app.newProxy()) : app.proxy;
}

private HttpProxyCacheServer newProxy() {
return new HttpProxyCacheServer(this);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,11 @@ public void setSurface(Surface surface) {
mediaPlayer.setSurface(surface);
}

@Override
public void setVolume(float leftVolume, float rightVolume) {
mediaPlayer.setVolume(leftVolume, rightVolume);
}

@Override
public void onPrepared(MediaPlayer mediaPlayer) {
mediaPlayer.start();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,11 @@ public void setSurface(Surface surface) {
ijkMediaPlayer.setSurface(surface);
}

@Override
public void setVolume(float leftVolume, float rightVolume) {
ijkMediaPlayer.setVolume(leftVolume, rightVolume);
}

@Override
public void onPrepared(IMediaPlayer iMediaPlayer) {
ijkMediaPlayer.start();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
package cn.jzvd.demo.CustomView;

import android.content.Context;
import android.util.AttributeSet;

import cn.jzvd.JZMediaManager;
import cn.jzvd.JZVideoPlayerStandard;

/**
* Created by pc on 2018/1/17.
*/

public class JZVideoPlayerStandardVolumeAfterFullscreen extends JZVideoPlayerStandard {
public JZVideoPlayerStandardVolumeAfterFullscreen(Context context) {
super(context);
}

public JZVideoPlayerStandardVolumeAfterFullscreen(Context context, AttributeSet attrs) {
super(context, attrs);
}

@Override
public void onPrepared() {
super.onPrepared();
if (currentScreen == SCREEN_WINDOW_FULLSCREEN) {
JZMediaManager.instance().jzMediaInterface.setVolume(1f, 1f);
} else {
JZMediaManager.instance().jzMediaInterface.setVolume(0f, 0f);
}
}

/**
* 进入全屏模式的时候关闭静音模式
*/
@Override
public void startWindowFullscreen() {
super.startWindowFullscreen();
JZMediaManager.instance().jzMediaInterface.setVolume(1f, 1f);
}

/**
* 退出全屏模式的时候开启静音模式
*/
@Override
public void playOnThisJzvd() {
super.playOnThisJzvd();
JZMediaManager.instance().jzMediaInterface.setVolume(0f, 0f);
}
}
12 changes: 12 additions & 0 deletions app/src/main/res/layout/activity_ui_small_change.xml
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,18 @@
android:id="@+id/jz_videoplayer_16_9"
android:layout_width="match_parent"
android:layout_height="wrap_content" />

<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="3dp"
android:layout_marginTop="18dp"
android:text="Volume after fullscreen" />

<cn.jzvd.demo.CustomView.JZVideoPlayerStandardVolumeAfterFullscreen
android:id="@+id/jz_videoplayer_volume"
android:layout_width="match_parent"
android:layout_height="200dp" />
</LinearLayout>
</ScrollView>
</LinearLayout>
2 changes: 1 addition & 1 deletion gradle/maven_push.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ signing {

group = "cn.jzvd"
archivesBaseName = "jiaozivideoplayer"
version = "6.2.4"
version = "6.2.5"

uploadArchives {
repositories {
Expand Down
4 changes: 2 additions & 2 deletions jiaozivideoplayer/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ android {
defaultConfig {
minSdkVersion 16
targetSdkVersion 27
versionCode 75
versionName "6.2.4"
versionCode 76
versionName "6.2.5"
}
buildTypes {
release {
Expand Down
2 changes: 2 additions & 0 deletions jiaozivideoplayer/src/main/java/cn/jzvd/JZMediaInterface.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,6 @@ public abstract class JZMediaInterface {
public abstract long getDuration();

public abstract void setSurface(Surface surface);

public abstract void setVolume(float leftVolume, float rightVolume);
}
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ public static boolean isPlaying() {
}

public void releaseMediaPlayer() {
mMediaHandler.removeCallbacksAndMessages(null);
Message msg = new Message();
msg.what = HANDLER_RELEASE;
mMediaHandler.sendMessage(msg);
Expand Down
5 changes: 5 additions & 0 deletions jiaozivideoplayer/src/main/java/cn/jzvd/JZMediaSystem.java
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,11 @@ public void setSurface(Surface surface) {
mediaPlayer.setSurface(surface);
}

@Override
public void setVolume(float leftVolume, float rightVolume) {
mediaPlayer.setVolume(leftVolume, rightVolume);
}

@Override
public void onPrepared(MediaPlayer mediaPlayer) {
mediaPlayer.start();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,11 +147,11 @@ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
parentHeight = tempSize;
}
/**充满剪切**/
if (videoHeight / videoWidth > parentHeight / parentWidth) {
height = parentWidth / width * height;
if (((double) videoHeight / videoWidth) > ((double) parentHeight / parentWidth)) {
height = (int) (((double) parentWidth / (double) width * (double) height));
width = parentWidth;
} else if (videoHeight / videoWidth < parentHeight / parentWidth) {
width = parentHeight / height * width;
} else if (((double) videoHeight / videoWidth) < ((double) parentHeight / parentWidth)) {
width = (int) (((double) parentHeight / (double) height * (double) width));
height = parentHeight;
}
}
Expand Down
9 changes: 4 additions & 5 deletions jiaozivideoplayer/src/main/java/cn/jzvd/JZUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,7 @@ public static void saveProgress(Context context, Object url, long progress) {
SharedPreferences spn = context.getSharedPreferences("JZVD_PROGRESS",
Context.MODE_PRIVATE);
SharedPreferences.Editor editor = spn.edit();
editor.putLong("newVersion:" + url.toString(), progress);
editor.apply();
editor.putLong("newVersion:" + url.toString(), progress).apply();
}

public static long getSavedProgress(Context context, Object url) {
Expand All @@ -136,15 +135,15 @@ public static long getSavedProgress(Context context, Object url) {
* @param context context
* @param url if url!=null clear this url progress
*/
public static void clearSavedProgress(Context context, String url) {
if (TextUtils.isEmpty(url)) {
public static void clearSavedProgress(Context context, Object url) {
if (url == null) {
SharedPreferences spn = context.getSharedPreferences("JZVD_PROGRESS",
Context.MODE_PRIVATE);
spn.edit().clear().apply();
} else {
SharedPreferences spn = context.getSharedPreferences("JZVD_PROGRESS",
Context.MODE_PRIVATE);
spn.edit().putInt(url, 0).apply();
spn.edit().putLong("newVersion:" + url.toString(), 0).apply();
}
}

Expand Down
1 change: 0 additions & 1 deletion jiaozivideoplayer/src/main/java/cn/jzvd/JZVideoPlayer.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import android.hardware.SensorEventListener;
import android.hardware.SensorManager;
import android.media.AudioManager;
import android.os.Handler;
import android.provider.Settings;
import android.support.v7.app.ActionBar;
import android.support.v7.app.AppCompatActivity;
Expand Down
Loading

0 comments on commit 3bedfc1

Please sign in to comment.