Skip to content

Commit

Permalink
Merge branch 'feature/new_video_server' into develop
Browse files Browse the repository at this point in the history
# Conflicts:
#	demo/src/main/java/cn/jzvd/demo/Tab_2_Custom/AGVideo/AGVideoActivity.java
  • Loading branch information
lipangit committed Dec 26, 2020
2 parents 5022ed0 + 1a9e632 commit 5725b67
Show file tree
Hide file tree
Showing 31 changed files with 399 additions and 438 deletions.
3 changes: 2 additions & 1 deletion demo/build.gradle
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'

android {
compileSdkVersion 30
buildToolsVersion "30.0.2"
buildToolsVersion "30.0.3"

defaultConfig {
applicationId "cn.jzvd.demo"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@
import android.content.Context;
import android.util.AttributeSet;

import cn.jzvd.JzvdStd;
import cn.jzvd.demo.R;

public class MyJzvdStdNoTitleNoClarity extends MyJzvdStd {
public class MyJzvdStdNoTitleNoClarity extends JzvdStd {

public MyJzvdStdNoTitleNoClarity(Context context) {
super(context);
Expand Down
28 changes: 22 additions & 6 deletions demo/src/main/java/cn/jzvd/demo/Fragment_1_Base.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,15 @@
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.Toast;

import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;

import com.bumptech.glide.Glide;

import org.jzvd.jzvideo.UrlsKt;

import java.util.LinkedHashMap;

import cn.jzvd.JZDataSource;
Expand All @@ -37,25 +40,30 @@ public class Fragment_1_Base extends Fragment implements View.OnClickListener {
private JzvdStd mJzvdStd;
private Button mOrientation,
mRotationAndVideoSize, mCustomMediaPlayer, mPreLoading, mScreenRotate;
private Button serverCn, serverUs;
private Jzvd.JZAutoFullscreenListener mSensorEventListener;
private SensorManager mSensorManager;

@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = View.inflate(getContext(), R.layout.fragment_api, null);
View view = View.inflate(getContext(), R.layout.fragment_base, null);
mJzvdStd = view.findViewById(R.id.jz_video);
mOrientation = view.findViewById(R.id.orientation);
mRotationAndVideoSize = view.findViewById(R.id.rotation_and_videosize);
mCustomMediaPlayer = view.findViewById(R.id.custom_mediaplayer);
mPreLoading = view.findViewById(R.id.preloading);
mScreenRotate = view.findViewById(R.id.screen_rotate);
serverCn = view.findViewById(R.id.server_cn);
serverUs = view.findViewById(R.id.server_us);

mOrientation.setOnClickListener(this);
mRotationAndVideoSize.setOnClickListener(this);
mCustomMediaPlayer.setOnClickListener(this);
mPreLoading.setOnClickListener(this);
mScreenRotate.setOnClickListener(this);
serverCn.setOnClickListener(this);
serverUs.setOnClickListener(this);

mSensorManager = (SensorManager) getContext().getSystemService(SENSOR_SERVICE);
mSensorEventListener = new Jzvd.JZAutoFullscreenListener();
Expand All @@ -68,18 +76,18 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle sa
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
LinkedHashMap map = new LinkedHashMap();
String proxyUrl = ApplicationDemo.getProxy(getContext()).getProxyUrl(Urls.clarities[0]);
String proxyUrl = ApplicationDemo.getProxy(getContext()).getProxyUrl(UrlsKt.getCndVideos()[0]);
map.put("高清", proxyUrl);
map.put("标清", "http://videos.jzvd.org/ldj/01-ldj.mp4");
map.put("普清", "http://videos.jzvd.org/ldj/04-ldj.mp4");
JZDataSource jzDataSource = new JZDataSource(map, "饺子不信");
map.put("标清", UrlsKt.getCndVideos()[1]);
map.put("普清", UrlsKt.getCndVideos()[2]);
JZDataSource jzDataSource = new JZDataSource(map, "饺子起立");
jzDataSource.looping = true;
jzDataSource.currentUrlIndex = 2;
jzDataSource.headerMap.put("key", "value");//header
mJzvdStd.setUp(jzDataSource
, JzvdStd.SCREEN_NORMAL);
Jzvd.PROGRESS_DRAG_RATE = 2f;//设置播放进度条手势滑动阻尼系数
Glide.with(this).load(Urls.videoPosterList[0]).into(mJzvdStd.posterImageView);
Glide.with(this).load(UrlsKt.getCndThumbnail()[0]).into(mJzvdStd.posterImageView);
}


Expand Down Expand Up @@ -119,6 +127,14 @@ public void onClick(View view) {
case R.id.screen_rotate:
startActivity(new Intent(getContext(), ScreenRotateActivity.class));
break;
case R.id.server_cn:
UrlsKt.setServer_name(UrlsKt.getCn());
Toast.makeText(getContext(), "change server to: " + UrlsKt.getCn(), Toast.LENGTH_SHORT).show();
break;
case R.id.server_us:
UrlsKt.setServer_name(UrlsKt.getUs());
Toast.makeText(getContext(), "change server to: " + UrlsKt.getUs(), Toast.LENGTH_SHORT).show();
break;
}
}
}
85 changes: 30 additions & 55 deletions demo/src/main/java/cn/jzvd/demo/Fragment_2_Custom.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@

import com.bumptech.glide.Glide;

import org.jzvd.jzvideo.UrlsKt;

import cn.jzvd.Jzvd;
import cn.jzvd.JzvdStd;
import cn.jzvd.demo.CustomJzvd.JzvdStdAutoOrizental;
Expand Down Expand Up @@ -78,83 +80,56 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle sa
@Override
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
jzvdStdAutoOrizental.setUp("http://jzvd.nathen.cn/384d341e000145fb82295bdc54ecef88/103eab5afca34baebc970378dd484942-5287d2089db37e62345123a1be272f8b.mp4"
, "饺子大小任意");
Glide.with(this).load("http://jzvd-pic.nathen.cn/jzvd-pic/1bb2ebbe-140d-4e2e-abd2-9e7e564f71ac.png").into(jzvdStdAutoOrizental.posterImageView);
jzvdStdAutoOrizental.setUp(UrlsKt.getVideos()[0], UrlsKt.getTitles()[0]);
Glide.with(this).load(UrlsKt.getThumbnails()[0]).into(jzvdStdAutoOrizental.posterImageView);

jzvdStdRound.setUp("http://jzvd.nathen.cn/342a5f7ef6124a4a8faf00e738b8bee4/cf6d9db0bd4d41f59d09ea0a81e918fd-5287d2089db37e62345123a1be272f8b.mp4"
, "饺子圆角");
Glide.with(this).load("http://jzvd-pic.nathen.cn/jzvd-pic/1bb2ebbe-140d-4e2e-abd2-9e7e564f71ac.png").into(jzvdStdRound.posterImageView);
jzvdStdRound.setUp(UrlsKt.getVideos()[1], UrlsKt.getTitles()[1]);
Glide.with(this).load(UrlsKt.getThumbnails()[1]).into(jzvdStdRound.posterImageView);


jzNoTitle.setUp("http://jzvd.nathen.cn/342a5f7ef6124a4a8faf00e738b8bee4/cf6d9db0bd4d41f59d09ea0a81e918fd-5287d2089db37e62345123a1be272f8b.mp4"
, "饺子叫啥也显示不出来啊");
Glide.with(this).load("http://jzvd-pic.nathen.cn/jzvd-pic/1bb2ebbe-140d-4e2e-abd2-9e7e564f71ac.png").into(jzNoTitle.posterImageView);
jzNoTitle.setUp(UrlsKt.getVideos()[2], UrlsKt.getTitles()[2]);
Glide.with(this).load(UrlsKt.getThumbnails()[2]).into(jzNoTitle.posterImageView);

lockScreen.setUp("http://jzvd.nathen.cn/342a5f7ef6124a4a8faf00e738b8bee4/cf6d9db0bd4d41f59d09ea0a81e918fd-5287d2089db37e62345123a1be272f8b.mp4"
, "饺子定身");
Glide.with(this).load("http://jzvd-pic.nathen.cn/jzvd-pic/1bb2ebbe-140d-4e2e-abd2-9e7e564f71ac.png").into(lockScreen.posterImageView);
lockScreen.setUp(UrlsKt.getVideos()[3], UrlsKt.getTitles()[3]);
Glide.with(this).load(UrlsKt.getThumbnails()[3]).into(lockScreen.posterImageView);


jzvdStdWithShareButton.setUp(Urls.videoUrlList[3], "饺子想呼吸", Jzvd.SCREEN_NORMAL);
Glide.with(this)
.load(Urls.videoPosterList[3])
.into(jzvdStdWithShareButton.posterImageView);
jzvdStdWithShareButton.setUp(UrlsKt.getVideos()[4], UrlsKt.getTitles()[4], Jzvd.SCREEN_NORMAL);
Glide.with(this).load(UrlsKt.getThumbnails()[4]).into(jzvdStdWithShareButton.posterImageView);


jzvdStdShowTitleAfterFullscreen.setUp(Urls.videoUrlList[4], "饺子想摇头", Jzvd.SCREEN_NORMAL);
Glide.with(this)
.load(Urls.videoPosterList[4])
.into(jzvdStdShowTitleAfterFullscreen.posterImageView);
jzvdStdShowTitleAfterFullscreen.setUp(UrlsKt.getVideos()[5], UrlsKt.getTitles()[5], Jzvd.SCREEN_NORMAL);
Glide.with(this).load(UrlsKt.getThumbnails()[5]).into(jzvdStdShowTitleAfterFullscreen.posterImageView);

jzvdStdShowTextureViewAfterAutoComplete.setUp(Urls.videoUrlList[5], "饺子想旅行", Jzvd.SCREEN_NORMAL);
Glide.with(this)
.load(Urls.videoPosterList[5])
.into(jzvdStdShowTextureViewAfterAutoComplete.posterImageView);
jzvdStdShowTextureViewAfterAutoComplete.setUp(UrlsKt.getVideos()[6], UrlsKt.getTitles()[6], Jzvd.SCREEN_NORMAL);
Glide.with(this).load(UrlsKt.getThumbnails()[6]).into(jzvdStdShowTextureViewAfterAutoComplete.posterImageView);

jzvdStdAutoCompleteAfterFullscreen.setUp(Urls.videoUrls[0][1], "饺子没来", Jzvd.SCREEN_NORMAL);
Glide.with(this)
.load(Urls.videoPosters[0][1])
.into(jzvdStdAutoCompleteAfterFullscreen.posterImageView);
jzvdStdAutoCompleteAfterFullscreen.setUp(UrlsKt.getVideos()[7], UrlsKt.getTitles()[7], Jzvd.SCREEN_NORMAL);
Glide.with(this).load(UrlsKt.getThumbnails()[7]).into(jzvdStdAutoCompleteAfterFullscreen.posterImageView);

jzvdStd_1_1.setUp(Urls.videoUrls[0][1], "饺子有事吗", Jzvd.SCREEN_NORMAL);
Glide.with(this)
.load(Urls.videoPosters[0][1])
.into(jzvdStd_1_1.posterImageView);
jzvdStd_1_1.setUp(UrlsKt.getVideos()[8], UrlsKt.getTitles()[8], Jzvd.SCREEN_NORMAL);
Glide.with(this).load(UrlsKt.getThumbnails()[8]).into(jzvdStd_1_1.posterImageView);
jzvdStd_1_1.widthRatio = 1;
jzvdStd_1_1.heightRatio = 1;

jzvdStd_16_9.setUp(Urls.videoUrls[0][1], "饺子来不了", Jzvd.SCREEN_NORMAL);
Glide.with(this)
.load(Urls.videoPosters[0][1])
.into(jzvdStd_16_9.posterImageView);
jzvdStd_16_9.setUp(UrlsKt.getVideos()[9], UrlsKt.getTitles()[9], Jzvd.SCREEN_NORMAL);
Glide.with(this).load(UrlsKt.getThumbnails()[9]).into(jzvdStd_16_9.posterImageView);
jzvdStd_16_9.widthRatio = 16;
jzvdStd_16_9.heightRatio = 9;

jzvdStdVolumeAfterFullscreen.setUp(Urls.videoUrls[0][1], "饺子摇摆", Jzvd.SCREEN_NORMAL);
Glide.with(this)
.load(Urls.videoPosters[0][1])
.into(jzvdStdVolumeAfterFullscreen.posterImageView);
jzvdStdVolumeAfterFullscreen.setUp(UrlsKt.getVideos()[10], UrlsKt.getTitles()[10], Jzvd.SCREEN_NORMAL);
Glide.with(this).load(UrlsKt.getThumbnails()[10]).into(jzvdStdVolumeAfterFullscreen.posterImageView);

jzvdStdMp3.setUp(Urls.videoUrls[0][1],
"饺子你听", Jzvd.SCREEN_NORMAL);
Glide.with(this)
.load(Urls.videoPosters[0][1])
.into(jzvdStdMp3.posterImageView);
jzvdStdMp3.setUp(UrlsKt.getVideos()[11], UrlsKt.getTitles()[11], Jzvd.SCREEN_NORMAL);
Glide.with(this).load(UrlsKt.getThumbnails()[11]).into(jzvdStdMp3.posterImageView);


jzvdStdSpeed.setUp(Urls.videoUrls[0][1],
"饺子快点", Jzvd.SCREEN_NORMAL);
Glide.with(this)
.load(Urls.videoPosters[0][1])
.into(jzvdStdSpeed.posterImageView);
jzvdStdSpeed.setUp(UrlsKt.getVideos()[12], UrlsKt.getTitles()[12], Jzvd.SCREEN_NORMAL);
Glide.with(this).load(UrlsKt.getThumbnails()[12]).into(jzvdStdSpeed.posterImageView);


jzvdStdVolume.setUp(Urls.videoUrls[0][1],
"饺子吃莽莽", Jzvd.SCREEN_NORMAL);
Glide.with(this)
.load(Urls.videoPosters[0][1])
.into(jzvdStdVolume.posterImageView);
jzvdStdVolume.setUp(UrlsKt.getVideos()[13], UrlsKt.getTitles()[13], Jzvd.SCREEN_NORMAL);
Glide.with(this).load(UrlsKt.getThumbnails()[13]).into(jzvdStdVolume.posterImageView);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@

import com.bumptech.glide.Glide;

import org.jzvd.jzvideo.UrlsKt;

import cn.jzvd.JZMediaSystem;
import cn.jzvd.Jzvd;
import cn.jzvd.JzvdStd;
Expand Down Expand Up @@ -37,44 +39,42 @@ protected void onCreate(@Nullable Bundle savedInstanceState) {

jzvdStd = findViewById(R.id.videoplayer);

jzvdStd.setUp("http://jzvd.nathen.cn/342a5f7ef6124a4a8faf00e738b8bee4/cf6d9db0bd4d41f59d09ea0a81e918fd-5287d2089db37e62345123a1be272f8b.mp4"
, "饺子很保守", JzvdStd.SCREEN_NORMAL);
jzvdStd.setUp(UrlsKt.getVideos()[9]
, UrlsKt.getTitles()[9], JzvdStd.SCREEN_NORMAL);

Glide.with(this)
.load("http://jzvd-pic.nathen.cn/jzvd-pic/1bb2ebbe-140d-4e2e-abd2-9e7e564f71ac.png")
.load(UrlsKt.getThumbnails()[9])
.into(jzvdStd.posterImageView);

}


public void clickChangeToIjkplayer(View view) {
Jzvd.releaseAllVideos();
jzvdStd.setUp("http://jzvd.nathen.cn/342a5f7ef6124a4a8faf00e738b8bee4/cf6d9db0bd4d41f59d09ea0a81e918fd-5287d2089db37e62345123a1be272f8b.mp4"
, "饺子变心", JzvdStd.SCREEN_NORMAL, JZMediaIjk.class);
jzvdStd.setUp(UrlsKt.getVideos()[1]
, UrlsKt.getTitles()[1], JzvdStd.SCREEN_NORMAL, JZMediaIjk.class);
jzvdStd.startVideo();
Toast.makeText(this, "Change to Ijkplayer", Toast.LENGTH_SHORT).show();
}

public void clickChangeToSystem(View view) {
Jzvd.releaseAllVideos();
jzvdStd.setUp("http://jzvd.nathen.cn/342a5f7ef6124a4a8faf00e738b8bee4/cf6d9db0bd4d41f59d09ea0a81e918fd-5287d2089db37e62345123a1be272f8b.mp4"
, "饺子回来了", JzvdStd.SCREEN_NORMAL, JZMediaSystem.class);
jzvdStd.setUp(UrlsKt.getVideos()[1]
, UrlsKt.getTitles()[1], JzvdStd.SCREEN_NORMAL, JZMediaSystem.class);
jzvdStd.startVideo();
Toast.makeText(this, "Change to MediaPlayer", Toast.LENGTH_SHORT).show();
}

public void clickChangeToExo(View view) {
Jzvd.releaseAllVideos();
jzvdStd.setUp("http://jzvd.nathen.cn/342a5f7ef6124a4a8faf00e738b8bee4/cf6d9db0bd4d41f59d09ea0a81e918fd-5287d2089db37e62345123a1be272f8b.mp4"
, "饺子追星", JzvdStd.SCREEN_NORMAL, JZMediaExo.class);
jzvdStd.setUp(UrlsKt.getVideos()[1]
, UrlsKt.getTitles()[1], JzvdStd.SCREEN_NORMAL, JZMediaExo.class);
jzvdStd.startVideo();
Toast.makeText(this, "Change to ExoPlayer", Toast.LENGTH_SHORT).show();
}

public void clickChangeToAliyun(View view) {
Jzvd.releaseAllVideos();
// jzvdStd.setUp("http://jzvd.nathen.cn/342a5f7ef6124a4a8faf00e738b8bee4/cf6d9db0bd4d41f59d09ea0a81e918fd-5287d2089db37e62345123a1be272f8b.mp4"
// , "饺子梭哈", JzvdStd.SCREEN_NORMAL, JZMediaAliyun.class);
jzvdStd.setMediaInterface(JZMediaAliyun.class);
jzvdStd.startVideo();
Toast.makeText(this, "Change to AliyunPlayer", Toast.LENGTH_SHORT).show();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@

import com.bumptech.glide.Glide;

import org.jzvd.jzvideo.UrlsKt;

import cn.jzvd.Jzvd;
import cn.jzvd.JzvdStd;
import cn.jzvd.demo.R;
import cn.jzvd.demo.Urls;

/**
* Created by Nathen on 2016/12/30.
Expand All @@ -30,10 +31,10 @@ protected void onCreate(@Nullable Bundle savedInstanceState) {
getSupportActionBar().setTitle(getString(R.string.orientation));
setContentView(R.layout.activity_orientation);
mJzvdStd = findViewById(R.id.jz_video);
mJzvdStd.setUp(Urls.videoUrlList[0], "饺子会旋转"
mJzvdStd.setUp(UrlsKt.getVideos()[25], UrlsKt.getTitles()[25]
, JzvdStd.SCREEN_NORMAL);
Glide.with(this)
.load(Urls.videoPosterList[0])
.load(UrlsKt.getThumbnails()[25])
.into(mJzvdStd.posterImageView);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@

import com.bumptech.glide.Glide;

import org.jzvd.jzvideo.UrlsKt;

import cn.jzvd.Jzvd;
import cn.jzvd.JzvdStd;
import cn.jzvd.demo.CustomMedia.JZMediaIjk;
Expand All @@ -28,17 +30,10 @@ protected void onCreate(@Nullable Bundle savedInstanceState) {
setContentView(R.layout.activity_preloading);
jzvdStd = findViewById(R.id.jz_video);

// jzvdStd.setUp("http://jzvd.nathen.cn/342a5f7ef6124a4a8faf00e738b8bee4/cf6d9db0bd4d41f59d09ea0a81e918fd-5287d2089db37e62345123a1be272f8b.mp4"
// , "饺子快长大", Jzvd.SCREEN_NORMAL, JZMediaIjk.class);
jzvdStd.setUp("http://jzvd.nathen.cn/4f965ad507ef4194a60a943a34cfe147/32af151ea132471f92c9ced2cff785ea-5287d2089db37e62345123a1be272f8b.mp4"
, "饺子存钱", Jzvd.SCREEN_NORMAL, JZMediaIjk.class);


// jzvdStd.setUp("http://jzvd.nathen.cn/342a5f7ef6124a4a8faf00e738b8bee4/cf6d9db0bd4d41f59d09ea0a81e918fd-5287d2089db37e62345123a1be272f8b.mp4"
// , "饺子快长大");
// jzvdStd.setUp("http://jzvd.nathen.cn/4f965ad507ef4194a60a943a34cfe147/32af151ea132471f92c9ced2cff785ea-5287d2089db37e62345123a1be272f8b.mp4"
// , "饺子快长大");
Glide.with(this).load("http://jzvd-pic.nathen.cn/jzvd-pic/1bb2ebbe-140d-4e2e-abd2-9e7e564f71ac.png").into(jzvdStd.posterImageView);
jzvdStd.setUp(UrlsKt.getTitles()[7]
, UrlsKt.getTitles()[7], Jzvd.SCREEN_NORMAL, JZMediaIjk.class);

Glide.with(this).load(UrlsKt.getTitles()[7]).into(jzvdStd.posterImageView);

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@

import com.bumptech.glide.Glide;

import org.jzvd.jzvideo.UrlsKt;

import cn.jzvd.Jzvd;
import cn.jzvd.JzvdStd;
import cn.jzvd.demo.R;
import cn.jzvd.demo.Urls;

/**
* Created by Nathen on 2017/11/2.
Expand All @@ -33,10 +34,10 @@ protected void onCreate(@Nullable Bundle savedInstanceState) {
setContentView(R.layout.activity_api_rotation_videosize);

myJzvdStd = findViewById(R.id.jz_video);
myJzvdStd.setUp(Urls.videoUrls[0][7], Urls.videoTitles[0][7]
myJzvdStd.setUp(UrlsKt.getVideos()[30], UrlsKt.getTitles()[30]
, JzvdStd.SCREEN_NORMAL);
Glide.with(this)
.load(Urls.videoPosters[0][7])
.load(UrlsKt.getThumbnails()[30])
.into(myJzvdStd.posterImageView);
// The Point IS 或者这样写也可以
// myJzvdStd.videoRotation = 180;
Expand Down
Loading

0 comments on commit 5725b67

Please sign in to comment.