Skip to content

Commit

Permalink
更新 7.2 SDK 和 Demo
Browse files Browse the repository at this point in the history
  • Loading branch information
carolsuo committed Apr 17, 2020
1 parent a64687d commit 237f323
Show file tree
Hide file tree
Showing 151 changed files with 6,278 additions and 5,789 deletions.
4 changes: 4 additions & 0 deletions Demo/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ android {

packagingOptions {
pickFirst '**/libc++_shared.so'
doNotStrip "*/armeabi/libYTCommon.so"
doNotStrip "*/armeabi-v7a/libYTCommon.so"
doNotStrip "*/x86/libYTCommon.so"
doNotStrip "*/arm64-v8a/libYTCommon.so"
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -489,8 +489,8 @@ public void clear() {
mBeautyParams = new BeautyParams();
if (mProxy != null) {
mProxy.setFilter(mBeautyParams.mFilterBmp, mBeautyParams.mFilterIndex);
mProxy.setSpecialRatio(mBeautyParams.mFilterMixLevel);
mProxy.setGreenScreenFile(mBeautyParams.mGreenFile, true);
mProxy.setFilterStrength(mBeautyParams.mFilterStrength);
mProxy.setGreenScreenFile(mBeautyParams.mGreenFile);
mProxy.setBeautyStyle(mBeautyParams.mBeautyStyle);
mProxy.setBeautyLevel(mBeautyParams.mBeautyLevel);
mProxy.setWhitenessLevel(mBeautyParams.mWhiteLevel);
Expand Down Expand Up @@ -654,7 +654,7 @@ private void setGreenScreen(int index) {
}
mBeautyParams.mGreenFile = file;
if (mProxy != null) {
mProxy.setGreenScreenFile(file, true);
mProxy.setGreenScreenFile(file);
}
}

Expand Down Expand Up @@ -831,7 +831,7 @@ public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
}
} else if (mSencodGradleType == ITEM_TYPE_FILTTER) {
if (mProxy != null) {
mProxy.setSpecialRatio(progress);
mProxy.setFilterStrength(progress);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public class BeautyParams {
// 滑动滤镜索引
public int mFilterIndex;
// 滤镜程度
public int mFilterMixLevel = 0;
public int mFilterStrength = 0;
// 大眼
public int mBigEyeLevel;
// 瘦脸
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,22 +15,19 @@ public interface IBeautyKit {
/**
* 设置滤镜效果程度
*
* @param specialRatio : 从0到1,越大滤镜效果越明显,默认取值0.5
* @param strength : 从0到1,越大滤镜效果越明显,默认取值0.5
*/
void setSpecialRatio(float specialRatio);
void setFilterStrength(float strength);

/**
* 设置绿幕文件 [仅支持企业版Pro]
* <p>目前图片支持jpg/png,视频支持mp4/3gp等Android系统支持的格式
* API要求18
* 设置绿幕文件(企业版有效,其它版本设置此参数无效)[API >= 18]
* <p>
* 此处的绿幕功能并非智能抠背,它需要被拍摄者的背后有一块绿色的幕布来辅助产生特效。
*
* @param path :绿幕文件位置,支持两种方式:
* 1.资源文件放在assets目录,path直接取文件名
* 2.path取文件绝对路径
* @param isLoop :图片文件忽略,视频文件设置是否循环播放
* @param path 视频文件路径。支持 MP4;null 表示关闭特效。
*/
@TargetApi(18)
void setGreenScreenFile(String path, boolean isLoop);
void setGreenScreenFile(String path);

/**
* 设置美颜类型
Expand Down
2 changes: 1 addition & 1 deletion Demo/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ ext {
noffmpeg = false
noijkplay = false
useASAN = true
aekit_version = '1.0.12-cloud'
aekit_version = '1.0.20-cloud'
liteavsdk_version = 'latest.release'
//kotlin_version = "1.3.21"
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

/**
* Created by yuejiaoli on 2018/7/3.
*
* 超级播放器常量
*/

public class SuperPlayerConst {
Expand All @@ -12,8 +14,10 @@ public class SuperPlayerConst {
public static final int PLAYMODE_FLOAT = 3; // 悬浮窗

// 播放状态
public static final int PLAYSTATE_PLAY = 1;
public static final int PLAYSTATE_PLAYING = 1;
public static final int PLAYSTATE_PAUSE = 2;
public static final int PLAYSTATE_LOADING = 3;
public static final int PLAYSTATE_END = 4;

// 屏幕方向
public static final int ORIENTATION_LANDSCAPE = 1; // 横屏
Expand All @@ -23,4 +27,6 @@ public class SuperPlayerConst {
public static final int PLAYTYPE_VOD = 1; // 点播
public static final int PLAYTYPE_LIVE = 2; // 直播
public static final int PLAYTYPE_LIVE_SHIFT = 3; // 直播回看

public static final int MAX_SHIFT_TIME = 7200; // demo演示直播时移是MAX_SHIFT_TIMEs,即2小时
}
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ public static SuperPlayerGlobalConfig getInstance() {
* 播放器最大缓存个数 ( 默认缓存 5 )
*/
public int maxCacheItem = 5;

/**
* 时移域名 (修改为自己app的时移域名)
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,58 +1,57 @@
package com.tencent.liteav.demo.play;


import com.tencent.liteav.demo.play.v3.SuperPlayerVideoId;

import java.util.List;


/**
* Created by hans on 2019/3/25.
*
* 使用点播SDK有以下三种方式:
* 1. 使用腾讯云FileId播放模式,仅需填写appid以及fileId即可简单进行播放。(更多高级用法,详见{@link SuperPlayerVideoId} 以及腾讯云官网文档
*
* 2. 使用传统URL模式播放,仅需填写URL即可进行播放。
*
* 3. 多码率视频播放模式。
* 超级播放器支持三种方式播放视频:
* 1. 视频 URL
* 填写视频 URL, 如需使用直播时移功能,还需填写appId
* 2. 腾讯云点播 File ID 播放
* 填写 appId 及 videoId (如果使用旧版本V2, 请填写videoIdV2)
* 3. 多码率视频播放
* 是URL播放方式扩展,可同时传入多条URL,用于进行码率切换
*/
public class SuperPlayerModel {
/** ------------------------------------------------------------------
* 公共字段
* ------------------------------------------------------------------
*/
public int appId; // 【腾讯云服务专用】appid 播放方式1必填;播放方式2、3只有需要使用腾讯云直播时移功能时候填写

// public String token; // 【腾讯云服务专用】加密视频的Token.需要保证是经过URLEncode的
// // 1.使用VideoId(FileId)模式播放加密视频时,需要指定
// // 2.使用URL【腾讯云URL】播放SampleAES加密的HLS流或WideVine加密DASH流时需要指定

public String title = ""; // 视频文件名 (用于显示在UI层)
// 播放方式1:若未指定title,则使用FileId返回的Title
// 播放方式2、3:需要指定,否则title显示为空
public int appId; // AppId 用于腾讯云点播 File ID 播放及腾讯云直播时移功能

/** ------------------------------------------------------------------
* 播放方式1: 腾讯云存储对象VideoId(FileId)播放模式 1.appId必填 2.使用V3协议注意填写Token用于播放加密视频
* 直接使用URL播放
*
* 支持 RTMP、FLV、MP4、HLS 封装格式
* 使用腾讯云直播时移功能则需要填写appId
* ------------------------------------------------------------------
*/
public SuperPlayerVideoId videoId;
public String url = ""; // 视频URL


/** ------------------------------------------------------------------
* 播放方式2: 直接使用URL播放 支持直播:RTMP、FLV封装格式 点播:MP4、Dash等常见封装格式 使用腾讯云直播时移功能则需要填写appId
* 多码率视频 URL
*
* 用于拥有多个播放地址的多清晰度视频播放
* ------------------------------------------------------------------
*/
public String url = ""; // 视频URL
public String qualityName = "原画"; // 码率名称(用于显示在UI层)
public List<SuperPlayerURL> multiURLs;

public int playDefaultIndex; // 指定多码率情况下,默认播放的连接Index


/** ------------------------------------------------------------------
* 播放方式3: 多码率URL播放 播放方式3是播放方式2的扩展,可同时传入多条URL,用于进行码率切换
* 腾讯云点播 File ID 播放参数
* ------------------------------------------------------------------
*/
public List<SuperPlayerURL> multiURLs;
public SuperPlayerVideoId videoId;

public int playDefaultIndex; // 指定多码率情况下,默认播放的连接Index
/*
* 用于兼容旧版本(V2)腾讯云点播 File ID 播放参数(即将废弃,不推荐使用)
*/
@Deprecated
public SuperPlayerVideoIdV2 videoIdV2;


public String title = ""; // 视频文件名 (用于显示在UI层);使用file id播放,若未指定title,则使用FileId返回的Title;使用url播放需要指定title,否则title显示为空

public static class SuperPlayerURL {
public SuperPlayerURL(String url, String qualityName) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package com.tencent.liteav.demo.play;

import android.util.Log;

import com.tencent.liteav.demo.play.v3.SuperPlayerVideoId;
import android.view.View;

import java.math.BigInteger;
import java.security.MessageDigest;
Expand All @@ -18,63 +16,10 @@
*
* 2. v2需要参数 KEY+appId+fileId+t+exper+us (exper是可选的)
* 3. v3需要参数 KEY+appId+fileId+playDefinition+t+rlimit+us (rlimit是可选的)
* 3. v4需要参数 KEY+appId+fileId+pcfg+t+exper+rlimit+us (pcfg、exper、rlimit、us是可选的)
*/
public class SuperPlayerSignUtils {


public static String generateSign(String key, SuperPlayerModel model) {
if (key != null && model != null && model.videoId != null) {
// V2: https://cloud.tencent.com/document/product/266/14424#key-.E9.98.B2.E7.9B.97.E9.93.BE
// 普通防盗链签名:
// sign = md5(KEY+appId+fileId+t+us)
// 带试看的防盗链签名:
// sign = md5(KEY+appId+fileId+t+exper+us)

StringBuilder sb = new StringBuilder();

// if (model.videoId.version == SuperPlayerVideoId.FILE_ID_V2) {
sb.append(key);
sb.append(model.appId);
sb.append(model.videoId.fileId);
if (model.videoId.timeout != null)
sb.append(model.videoId.timeout);
if (model.videoId.exper != -1)
sb.append(model.videoId.exper);
if (model.videoId.us != null)
sb.append(model.videoId.us);
// }

// V3:https://cloud.tencent.com/document/product/266/34101
// 普通防盗链签名:
//
// sign = md5(KEY+appId+fileId+playDefinition+t+us)
// 带有播放 IP 数限制的防盗链
//
// sign = md5(KEY+appId+fileId+playDefinition+t+rlimit+us)

// if (model.videoId.version == SuperPlayerVideoId.FILE_ID_V3) {
// sb.append(key);
// sb.append(model.appId);
// sb.append(model.videoId.fileId);
// if (model.videoId.playDefinition != null)
// sb.append(model.videoId.playDefinition);
// if (model.videoId.timeout != null)
// sb.append(model.videoId.timeout);
// if (model.videoId.rlimit != -1)
// sb.append(model.videoId.rlimit);
// if (model.videoId.us != null)
// sb.append(model.videoId.us);
// }

String sign = sb.toString();

sign = getMD5(sign);

return sign;
}
return null;
}

private static String getMD5(String str) {
try {
// 生成一个MD5加密计算摘要
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package com.tencent.liteav.demo.play;


/**
* Created by hans on 2019/3/25.
* 使用腾讯云fileId播放
*/
public class SuperPlayerVideoId {
public String fileId; // 腾讯云视频fileId
public String pSign; // v4 开启防盗链必填

@Override
public String toString() {
return "SuperPlayerVideoId{" +
", fileId='" + fileId + '\'' +
", pSign='" + pSign + '\'' +
'}';
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package com.tencent.liteav.demo.play;

public class SuperPlayerVideoIdV2 {
public String fileId; // 腾讯云视频fileId

public String timeout; // 【可选】加密链接超时时间戳,转换为16进制小写字符串,腾讯云 CDN 服务器会根据该时间判断该链接是否有效。
public int exper = -1; // 【V2可选】试看时长,单位:秒。可选
public String us; // 【可选】唯一标识请求,增加链接唯一性
public String sign; // 【可选】防盗链签名

@Override
public String toString() {
return "SuperPlayerVideoId{" +
", fileId='" + fileId + '\'' +
", timeout='" + timeout + '\'' +
", exper=" + exper +
", us='" + us + '\'' +
", sign='" + sign + '\'' +
'}';
}
}
Loading

0 comments on commit 237f323

Please sign in to comment.