pull/617/head 3.7.2
laoyuyu 5 years ago
parent a575e885a9
commit 39c485b157
  1. 5
      HttpComponent/src/main/java/com/arialyy/aria/http/HttpTaskOption.java
  2. 4
      M3U8Component/src/main/java/com/arialyy/aria/m3u8/M3U8TaskOption.java
  3. 2
      M3U8Component/src/main/java/com/arialyy/aria/m3u8/vod/M3U8VodLoader.java
  4. 2
      M3U8Component/src/main/java/com/arialyy/aria/m3u8/vod/M3U8VodUtil.java
  5. 26
      PublicComponent/src/main/java/com/arialyy/aria/core/TaskOptionParams.java
  6. 3
      PublicComponent/src/main/java/com/arialyy/aria/util/ComponentUtil.java
  7. 16
      README.md
  8. 2
      app/src/main/java/com/arialyy/simple/core/download/m3u8/M3U8VodDLoadActivity.java
  9. 11
      app/src/main/java/com/arialyy/simple/core/download/m3u8/VideoPlayerFragment.java
  10. 4
      build.gradle

@ -16,9 +16,10 @@
package com.arialyy.aria.http;
import android.text.TextUtils;
import com.arialyy.aria.core.common.RequestEnum;
import com.arialyy.aria.core.processor.IHttpFileLenAdapter;
import com.arialyy.aria.core.inf.ITaskOption;
import com.arialyy.aria.core.processor.IHttpFileLenAdapter;
import java.lang.ref.SoftReference;
import java.net.CookieManager;
import java.net.Proxy;
@ -140,7 +141,7 @@ public class HttpTaskOption implements ITaskOption {
}
public String getCharSet() {
return charSet;
return TextUtils.isEmpty(charSet) ? "utf-8" : charSet;
}
public void setCharSet(String charSet) {

@ -120,7 +120,7 @@ public class M3U8TaskOption implements ITaskOption {
}
public int getMaxTsQueueNum() {
return maxTsQueueNum;
return maxTsQueueNum == 0 ? 4 : maxTsQueueNum;
}
public void setMaxTsQueueNum(int maxTsQueueNum) {
@ -128,7 +128,7 @@ public class M3U8TaskOption implements ITaskOption {
}
public long getLiveUpdateInterval() {
return liveUpdateInterval;
return liveUpdateInterval == 0 ? 10 * 1000 : liveUpdateInterval;
}
public void setLiveUpdateInterval(long liveUpdateInterval) {

@ -334,7 +334,7 @@ public class M3U8VodLoader extends BaseM3U8Loader {
}
/**
* 指定位置恢复任务
* 指定位置恢复任务
*/
private synchronized void resumeTask() {
if (isBreak()) {

@ -82,7 +82,7 @@ public class M3U8VodUtil extends AbsNormalLoaderUtil {
fail(new M3U8Exception(TAG, "获取地址失败"), false);
return;
} else if (!mUrls.get(0).startsWith("http")) {
fail(new M3U8Exception(TAG, "地址错误,请使用IM3U8UrlExtInfHandler处理你的url信息"), false);
fail(new M3U8Exception(TAG, "地址错误,请使用IVodTsUrlConverter处理你的url信息"), false);
return;
}
mM3U8Option.setUrls(mUrls);

@ -18,10 +18,19 @@ package com.arialyy.aria.core;
import com.arialyy.aria.core.common.BaseOption;
import com.arialyy.aria.core.inf.IEventHandler;
import com.arialyy.aria.core.inf.IOptionConstant;
import com.arialyy.aria.core.processor.FtpInterceptHandler;
import com.arialyy.aria.core.processor.IBandWidthUrlConverter;
import com.arialyy.aria.core.processor.IFtpUploadInterceptor;
import com.arialyy.aria.core.processor.IHttpFileLenAdapter;
import com.arialyy.aria.core.processor.ILiveTsUrlConverter;
import com.arialyy.aria.core.processor.ITsMergeHandler;
import com.arialyy.aria.core.processor.IVodTsUrlConverter;
import com.arialyy.aria.util.ALog;
import com.arialyy.aria.util.CommonUtil;
import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
@ -32,6 +41,8 @@ import java.util.Map;
*/
public class TaskOptionParams {
private static List<Class> PROCESSORES = new ArrayList<>();
/**
* 普通参数
*/
@ -42,18 +53,29 @@ public class TaskOptionParams {
*/
private Map<String, IEventHandler> handler = new HashMap<>();
static {
PROCESSORES.add(FtpInterceptHandler.class);
PROCESSORES.add(IBandWidthUrlConverter.class);
PROCESSORES.add(IFtpUploadInterceptor.class);
PROCESSORES.add(IHttpFileLenAdapter.class);
PROCESSORES.add(ILiveTsUrlConverter.class);
PROCESSORES.add(ITsMergeHandler.class);
PROCESSORES.add(IVodTsUrlConverter.class);
}
/**
* 设置任务参数
*
* @param option 任务配置
*/
public void setParams(BaseOption option) {
Field[] fields = CommonUtil.getFields(option.getClass());
List<Field> fields = CommonUtil.getAllFields(option.getClass());
for (Field field : fields) {
field.setAccessible(true);
try {
if (field.getType() == IEventHandler.class) {
if (PROCESSORES.contains(field.getType())) {
Object eventHandler = field.get(option);
if (eventHandler != null) {
setObjs(field.getName(), (IEventHandler) eventHandler);

@ -28,6 +28,7 @@ import java.lang.ref.SoftReference;
import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.util.List;
/**
* 组件工具用于跨组件创建对应的工具类
@ -210,7 +211,7 @@ public class ComponentUtil {
* @return 构建失败返回null
*/
public <T extends ITaskOption> T buildTaskOption(Class<T> clazz, TaskOptionParams params) {
Field[] fields = CommonUtil.getFields(clazz);
List<Field> fields = CommonUtil.getAllFields(clazz);
T taskOption = null;
try {
taskOption = clazz.newInstance();

@ -44,16 +44,16 @@ Aria有以下特点:
## 引入库
[![license](http://img.shields.io/badge/license-Apache2.0-brightgreen.svg?style=flat)](https://github.com/AriaLyy/Aria/blob/master/LICENSE)
[![Core](https://img.shields.io/badge/Core-3.7.1-blue)](https://github.com/AriaLyy/Aria)
[![Compiler](https://img.shields.io/badge/Compiler-3.7.1-blue)](https://github.com/AriaLyy/Aria)
[![FtpComponent](https://img.shields.io/badge/FtpComponent-3.7.1-orange)](https://github.com/AriaLyy/Aria)
[![M3U8Component](https://img.shields.io/badge/M3U8Component-3.7.1-orange)](https://github.com/AriaLyy/Aria)
[![Core](https://img.shields.io/badge/Core-3.7.2-blue)](https://github.com/AriaLyy/Aria)
[![Compiler](https://img.shields.io/badge/Compiler-3.7.2-blue)](https://github.com/AriaLyy/Aria)
[![FtpComponent](https://img.shields.io/badge/FtpComponent-3.7.2-orange)](https://github.com/AriaLyy/Aria)
[![M3U8Component](https://img.shields.io/badge/M3U8Component-3.7.2-orange)](https://github.com/AriaLyy/Aria)
```java
implementation 'com.arialyy.aria:core:3.7.1'
annotationProcessor 'com.arialyy.aria:compiler:3.7.1'
implementation 'com.arialyy.aria:ftpComponent:3.7.1' # 如果需要使用ftp,请增加该组件
implementation 'com.arialyy.aria:m3u8Component:3.7.1' # 如果需要使用m3u8下载功能,请增加该组件
implementation 'com.arialyy.aria:core:3.7.2'
annotationProcessor 'com.arialyy.aria:compiler:3.7.2'
implementation 'com.arialyy.aria:ftpComponent:3.7.2' # 如果需要使用ftp,请增加该组件
implementation 'com.arialyy.aria:m3u8Component:3.7.2' # 如果需要使用m3u8下载功能,请增加该组件
```
如果出现android support依赖错误,请将 `compile 'com.arialyy.aria:aria-core:<last-version>'`替换为
```

@ -310,8 +310,6 @@ public class M3U8VodDLoadActivity extends BaseActivity<ActivityM3u8VodBinding> {
return option;
}
private Class<BuilderController> c = BuilderController.class;
@Override protected void dataCallback(int result, Object data) {
super.dataCallback(result, data);
if (result == ModifyUrlDialog.MODIFY_URL_DIALOG_RESULT) {

@ -1,6 +1,8 @@
package com.arialyy.simple.core.download.m3u8;
import android.annotation.SuppressLint;
import android.graphics.Canvas;
import android.graphics.Color;
import android.media.AudioManager;
import android.media.MediaPlayer;
import android.os.Build;
@ -37,6 +39,7 @@ public class VideoPlayerFragment extends BaseFragment<FragmentVideoPlayerBinding
private MediaPlayer mCurrentPlayer;
private LoadingDialog mLoadingDialog;
private int mJumpIndex = -1;
private boolean needPaint= true;
VideoPlayerFragment(int peerIndex, DownloadEntity entity) {
mEntity = entity;
@ -59,6 +62,12 @@ public class VideoPlayerFragment extends BaseFragment<FragmentVideoPlayerBinding
getBinding().surfaceView.getHolder().addCallback(new SurfaceHolder.Callback() {
@Override public void surfaceCreated(SurfaceHolder holder) {
mSurfaceHolder = holder;
//if (needPaint){
// needPaint = false;
// Canvas canvas = holder.lockCanvas();
// canvas.drawColor(Color.BLACK);
// holder.unlockCanvasAndPost(canvas);
//}
startNewPlayer(mPlayers.valueAt(0));
}
@ -91,6 +100,7 @@ public class VideoPlayerFragment extends BaseFragment<FragmentVideoPlayerBinding
@Override public void onStopTrackingTouch(SeekBar seekBar) {
PeerIndex index = new PeerIndex();
index.index = seekBar.getProgress();
mJumpIndex = index.index;
EventBus.getDefault().post(index);
if (mCurrentPlayer != null && mCurrentPlayer.isPlaying()) {
mCurrentPlayer.stop();
@ -98,7 +108,6 @@ public class VideoPlayerFragment extends BaseFragment<FragmentVideoPlayerBinding
mCurrentPlayer.release();
}
showLoadingDialog();
mJumpIndex = seekBar.getProgress();
}
});

@ -44,8 +44,8 @@ task clean(type: Delete) {
}
ext {
versionCode = 371
versionName = '3.7.1'
versionCode = 372
versionName = '3.7.2'
userOrg = 'arialyy'
groupId = 'com.arialyy.aria'
publishVersion = versionName

Loading…
Cancel
Save