提交 0ff875e6 authored 作者: kongdywang's avatar kongdywang

1. Pre-download supports httpHeader.

2. Supports encrypted playback of MP4. 3. Added support for HEVC playback downgrade. 4. Fix an issue that some API callbacks have no parameters.
上级 4110e143
......@@ -250,4 +250,15 @@ Professional 分支:Android & iOS 端集成TXLiteAVSDK_Professional lastest版
- set iOS TXLiteAVSDK_Professional to 12.1.16597, tag:release_pro_v12.1.0
- Fix the issue of reversed logic in the live streaming mute method.
- iOS adds support for Picture-in-Picture for live streaming, which requires premium permission to use.
- Fix other known issues.
#### Version: 12.2.0 2024.12.04
##### Features:
- set Android TXLiteAVSDK_Professional to 12.2.0.15065,tag:release_pro_v12.2.0
- set iOS TXLiteAVSDK_Professional to 12.2.16945, tag:release_pro_v12.2.0
- Pre-download supports httpHeader
- Supports encrypted playback of MP4
- Added support for HEVC playback downgrade
- Fix other known issues.
\ No newline at end of file
......@@ -5,7 +5,7 @@ buildLog() {
}
inputVersion=$1
export VERSION_NAME="12.1.0"
export VERSION_NAME="12.2.0"
if [ -n "$inputVersion" ]; then
VERSION_NAME=$inputVersion
fi
......
......@@ -4,7 +4,7 @@ rootProject.ext {
supportSdkVersion = "26.0.1"
minSdkVersion = 19
targetSdkVersion = 28
playerVersion = '12.1.0'
playerVersion = '12.2.0'
compat = "androidx.appcompat:appcompat:1.6.1"
/**
......@@ -14,5 +14,5 @@ rootProject.ext {
Professional SDK: liteavSdk="com.tencent.liteav:LiteAVSDK_Professional:latest.release"
If you want to specify the SDK version(eg 11.7.0.13946), use: liteavSdk="com.tencent.liteav:LiteAVSDK_Player:11.7.0.13946"
*/
liteavSdk="com.tencent.liteav:LiteAVSDK_Professional:12.0.0.14689"
liteavSdk="com.tencent.liteav:LiteAVSDK_Professional:12.2.0.15065"
}
\ No newline at end of file
......@@ -316,6 +316,9 @@ public class FTXDownloadManager implements ITXVodDownloadListener, TXFlutterDown
int appId = msg.getAppId() != null ? msg.getAppId().intValue() : 0;
txPlayInfoParams = new TXPlayInfoParams(appId, msg.getFileId(), msg.getPSign());
}
if (msg.getHttpHeader() != null) {
txPlayInfoParams.setHeaders(msg.getHttpHeader());
}
final TXVodPreloadManager downloadManager =
TXVodPreloadManager.getInstance(mFlutterPluginBinding.getApplicationContext());
float preloadSizeMB = msg.getPreloadSizeMB() != null ? msg.getPreloadSizeMB().floatValue() : 0;
......
......@@ -76,6 +76,7 @@ public class FTXTransformation {
playConfig.setPreferredResolution(configPlayerMsg.getPreferredResolution());
}
playConfig.setMediaType(configPlayerMsg.getMediaType().intValue());
playConfig.setEncryptedMp4Level(configPlayerMsg.getEncryptedMp4Level().intValue());
return playConfig;
}
......
......@@ -255,6 +255,12 @@ public class FTXVodPlayer extends FTXBasePlayer implements ITXVodPlayListener,
mVodPlayer.setVodSubtitleDataListener(new ITXVodPlayListener.ITXVodSubtitleDataListener() {
@Override
public void onSubtitleData(TXVodDef.TXVodSubtitleData sub) {
LiteavLog.i(TAG, "callback subtitle"
+ " ,index:" + sub.trackIndex
+ " ,startMs:" + sub.startPositionMs
+ " ,durationMs:" + sub.durationMs
+ " ,content:" + sub.subtitleData
);
Bundle bundle = new Bundle();
bundle.putString(FTXEvent.EXTRA_SUBTITLE_DATA, sub.subtitleData);
bundle.putLong(FTXEvent.EXTRA_SUBTITLE_START_POSITION_MS, sub.startPositionMs);
......
// Copyright (c) 2022 Tencent. All rights reserved.
// Autogenerated from Pigeon (v22.6.0), do not edit directly.
// Autogenerated from Pigeon (v22.6.1), do not edit directly.
// See also: https://pub.dev/packages/pigeon
package com.tencent.vod.flutter.messages;
......@@ -1374,17 +1374,28 @@ public class FtxMessages {
this.mediaType = setterArg;
}
/** MP4 encryption playback: Supported since version 12.2. */
private @Nullable Long encryptedMp4Level;
public @Nullable Long getEncryptedMp4Level() {
return encryptedMp4Level;
}
public void setEncryptedMp4Level(@Nullable Long setterArg) {
this.encryptedMp4Level = setterArg;
}
@Override
public boolean equals(Object o) {
if (this == o) { return true; }
if (o == null || getClass() != o.getClass()) { return false; }
FTXVodPlayConfigPlayerMsg that = (FTXVodPlayConfigPlayerMsg) o;
return Objects.equals(playerId, that.playerId) && Objects.equals(connectRetryCount, that.connectRetryCount) && Objects.equals(connectRetryInterval, that.connectRetryInterval) && Objects.equals(timeout, that.timeout) && Objects.equals(playerType, that.playerType) && Objects.equals(headers, that.headers) && Objects.equals(enableAccurateSeek, that.enableAccurateSeek) && Objects.equals(autoRotate, that.autoRotate) && Objects.equals(smoothSwitchBitrate, that.smoothSwitchBitrate) && Objects.equals(cacheMp4ExtName, that.cacheMp4ExtName) && Objects.equals(progressInterval, that.progressInterval) && Objects.equals(maxBufferSize, that.maxBufferSize) && Objects.equals(maxPreloadSize, that.maxPreloadSize) && Objects.equals(firstStartPlayBufferTime, that.firstStartPlayBufferTime) && Objects.equals(nextStartPlayBufferTime, that.nextStartPlayBufferTime) && Objects.equals(overlayKey, that.overlayKey) && Objects.equals(overlayIv, that.overlayIv) && Objects.equals(extInfoMap, that.extInfoMap) && Objects.equals(enableRenderProcess, that.enableRenderProcess) && Objects.equals(preferredResolution, that.preferredResolution) && Objects.equals(mediaType, that.mediaType);
return Objects.equals(playerId, that.playerId) && Objects.equals(connectRetryCount, that.connectRetryCount) && Objects.equals(connectRetryInterval, that.connectRetryInterval) && Objects.equals(timeout, that.timeout) && Objects.equals(playerType, that.playerType) && Objects.equals(headers, that.headers) && Objects.equals(enableAccurateSeek, that.enableAccurateSeek) && Objects.equals(autoRotate, that.autoRotate) && Objects.equals(smoothSwitchBitrate, that.smoothSwitchBitrate) && Objects.equals(cacheMp4ExtName, that.cacheMp4ExtName) && Objects.equals(progressInterval, that.progressInterval) && Objects.equals(maxBufferSize, that.maxBufferSize) && Objects.equals(maxPreloadSize, that.maxPreloadSize) && Objects.equals(firstStartPlayBufferTime, that.firstStartPlayBufferTime) && Objects.equals(nextStartPlayBufferTime, that.nextStartPlayBufferTime) && Objects.equals(overlayKey, that.overlayKey) && Objects.equals(overlayIv, that.overlayIv) && Objects.equals(extInfoMap, that.extInfoMap) && Objects.equals(enableRenderProcess, that.enableRenderProcess) && Objects.equals(preferredResolution, that.preferredResolution) && Objects.equals(mediaType, that.mediaType) && Objects.equals(encryptedMp4Level, that.encryptedMp4Level);
}
@Override
public int hashCode() {
return Objects.hash(playerId, connectRetryCount, connectRetryInterval, timeout, playerType, headers, enableAccurateSeek, autoRotate, smoothSwitchBitrate, cacheMp4ExtName, progressInterval, maxBufferSize, maxPreloadSize, firstStartPlayBufferTime, nextStartPlayBufferTime, overlayKey, overlayIv, extInfoMap, enableRenderProcess, preferredResolution, mediaType);
return Objects.hash(playerId, connectRetryCount, connectRetryInterval, timeout, playerType, headers, enableAccurateSeek, autoRotate, smoothSwitchBitrate, cacheMp4ExtName, progressInterval, maxBufferSize, maxPreloadSize, firstStartPlayBufferTime, nextStartPlayBufferTime, overlayKey, overlayIv, extInfoMap, enableRenderProcess, preferredResolution, mediaType, encryptedMp4Level);
}
public static final class Builder {
......@@ -1557,6 +1568,14 @@ public class FtxMessages {
return this;
}
private @Nullable Long encryptedMp4Level;
@CanIgnoreReturnValue
public @NonNull Builder setEncryptedMp4Level(@Nullable Long setterArg) {
this.encryptedMp4Level = setterArg;
return this;
}
public @NonNull FTXVodPlayConfigPlayerMsg build() {
FTXVodPlayConfigPlayerMsg pigeonReturn = new FTXVodPlayConfigPlayerMsg();
pigeonReturn.setPlayerId(playerId);
......@@ -1580,13 +1599,14 @@ public class FtxMessages {
pigeonReturn.setEnableRenderProcess(enableRenderProcess);
pigeonReturn.setPreferredResolution(preferredResolution);
pigeonReturn.setMediaType(mediaType);
pigeonReturn.setEncryptedMp4Level(encryptedMp4Level);
return pigeonReturn;
}
}
@NonNull
ArrayList<Object> toList() {
ArrayList<Object> toListResult = new ArrayList<>(21);
ArrayList<Object> toListResult = new ArrayList<>(22);
toListResult.add(playerId);
toListResult.add(connectRetryCount);
toListResult.add(connectRetryInterval);
......@@ -1608,6 +1628,7 @@ public class FtxMessages {
toListResult.add(enableRenderProcess);
toListResult.add(preferredResolution);
toListResult.add(mediaType);
toListResult.add(encryptedMp4Level);
return toListResult;
}
......@@ -1655,6 +1676,8 @@ public class FtxMessages {
pigeonResult.setPreferredResolution((Long) preferredResolution);
Object mediaType = pigeonVar_list.get(20);
pigeonResult.setMediaType((Long) mediaType);
Object encryptedMp4Level = pigeonVar_list.get(21);
pigeonResult.setEncryptedMp4Level((Long) encryptedMp4Level);
return pigeonResult;
}
}
......@@ -3019,17 +3042,27 @@ public class FtxMessages {
this.tmpPreloadTaskId = setterArg;
}
private @Nullable Map<String, String> httpHeader;
public @Nullable Map<String, String> getHttpHeader() {
return httpHeader;
}
public void setHttpHeader(@Nullable Map<String, String> setterArg) {
this.httpHeader = setterArg;
}
@Override
public boolean equals(Object o) {
if (this == o) { return true; }
if (o == null || getClass() != o.getClass()) { return false; }
PreLoadInfoMsg that = (PreLoadInfoMsg) o;
return Objects.equals(appId, that.appId) && Objects.equals(fileId, that.fileId) && Objects.equals(pSign, that.pSign) && Objects.equals(playUrl, that.playUrl) && Objects.equals(preloadSizeMB, that.preloadSizeMB) && Objects.equals(preferredResolution, that.preferredResolution) && Objects.equals(tmpPreloadTaskId, that.tmpPreloadTaskId);
return Objects.equals(appId, that.appId) && Objects.equals(fileId, that.fileId) && Objects.equals(pSign, that.pSign) && Objects.equals(playUrl, that.playUrl) && Objects.equals(preloadSizeMB, that.preloadSizeMB) && Objects.equals(preferredResolution, that.preferredResolution) && Objects.equals(tmpPreloadTaskId, that.tmpPreloadTaskId) && Objects.equals(httpHeader, that.httpHeader);
}
@Override
public int hashCode() {
return Objects.hash(appId, fileId, pSign, playUrl, preloadSizeMB, preferredResolution, tmpPreloadTaskId);
return Objects.hash(appId, fileId, pSign, playUrl, preloadSizeMB, preferredResolution, tmpPreloadTaskId, httpHeader);
}
public static final class Builder {
......@@ -3090,6 +3123,14 @@ public class FtxMessages {
return this;
}
private @Nullable Map<String, String> httpHeader;
@CanIgnoreReturnValue
public @NonNull Builder setHttpHeader(@Nullable Map<String, String> setterArg) {
this.httpHeader = setterArg;
return this;
}
public @NonNull PreLoadInfoMsg build() {
PreLoadInfoMsg pigeonReturn = new PreLoadInfoMsg();
pigeonReturn.setAppId(appId);
......@@ -3099,13 +3140,14 @@ public class FtxMessages {
pigeonReturn.setPreloadSizeMB(preloadSizeMB);
pigeonReturn.setPreferredResolution(preferredResolution);
pigeonReturn.setTmpPreloadTaskId(tmpPreloadTaskId);
pigeonReturn.setHttpHeader(httpHeader);
return pigeonReturn;
}
}
@NonNull
ArrayList<Object> toList() {
ArrayList<Object> toListResult = new ArrayList<>(7);
ArrayList<Object> toListResult = new ArrayList<>(8);
toListResult.add(appId);
toListResult.add(fileId);
toListResult.add(pSign);
......@@ -3113,6 +3155,7 @@ public class FtxMessages {
toListResult.add(preloadSizeMB);
toListResult.add(preferredResolution);
toListResult.add(tmpPreloadTaskId);
toListResult.add(httpHeader);
return toListResult;
}
......@@ -3132,6 +3175,8 @@ public class FtxMessages {
pigeonResult.setPreferredResolution((Long) preferredResolution);
Object tmpPreloadTaskId = pigeonVar_list.get(6);
pigeonResult.setTmpPreloadTaskId((Long) tmpPreloadTaskId);
Object httpHeader = pigeonVar_list.get(7);
pigeonResult.setHttpHeader((Map<String, String>) httpHeader);
return pigeonResult;
}
}
......
......@@ -99,7 +99,9 @@ public class TXCommonUtil {
Set<String> keySet = bundle.keySet();
for (String key : keySet) {
Object val = bundle.get(key);
param.put(key, val);
if (null != val) {
param.put(key, val);
}
}
}
......
......@@ -63,12 +63,16 @@
__block NSMutableDictionary *dict = [NSMutableDictionary dictionary];
[dict setObject:@(tmpTaskId) forKey:@"tmpTaskId"];
[dict setObject:@(taskID) forKey:@"taskId"];
[dict setObject:fileId forKey:@"fileId"];
[dict setObject:url forKey:@"url"];
[dict setObject:param forKey:@"param"];
[self.downloadFlutterApi onPreDownloadEventEvent:[FTXDownloadManager getParamsWithEvent:EVENT_PREDOWNLOAD_ON_START withParams:dict] completion:^(FlutterError * _Nullable error) {
FTXLOGE(@"callback message error:%@", error);
}];
if (fileId) {
[dict setObject:fileId forKey:@"fileId"];
}
if (url) {
[dict setObject:url forKey:@"url"];
}
if (param) {
[dict setObject:param forKey:@"param"];
}
[self onPreloadCallback:[TXCommonUtil getParamsWithEvent:EVENT_PREDOWNLOAD_ON_START withParams:dict]];
}
- (void)onPreLoadErrorEvent:(long)tmpTaskId taskId:(int)taskID url:(NSString *)url error:(NSError *)error {
......@@ -77,15 +81,22 @@
[dict setObject:@(tmpTaskId) forKey:@"tmpTaskId"];
}
[dict setObject:@(taskID) forKey:@"taskId"];
[dict setObject:url forKey:@"url"];
if (url) {
[dict setObject:url forKey:@"url"];
}
[dict setObject:@(error.code) forKey:@"code"];
if (nil != error.userInfo.description) {
[dict setObject:error.userInfo.description forKey:@"msg"];
}
[self.downloadFlutterApi onPreDownloadEventEvent:[FTXDownloadManager getParamsWithEvent:EVENT_PREDOWNLOAD_ON_ERROR withParams:dict] completion:^(FlutterError * _Nullable error) {
FTXLOGE(@"callback message error:%@", error);
}];
[self onPreloadCallback:[TXCommonUtil getParamsWithEvent:EVENT_PREDOWNLOAD_ON_ERROR withParams:dict]];
}
- (void)onPreloadCallback:(NSDictionary<NSString *, id> *)arg_event {
dispatch_async(dispatch_get_main_queue(), ^{
[self.downloadFlutterApi onPreDownloadEventEvent:arg_event completion:^(FlutterError * _Nullable error) {
FTXLOGE(@"callback message error:%@", error);
}];
});
}
- (void)removePreDelegate:(TXPredownloadFileHelperDelegate*)delegate {
......@@ -102,15 +113,6 @@
}
}
+ (NSDictionary *)getParamsWithEvent:(int)EvtID withParams:(NSDictionary *)params
{
__block NSMutableDictionary<NSString*,NSObject*> *dict = [NSMutableDictionary dictionaryWithObject:@(EvtID) forKey:@"event"];
if (params != nil && params.count != 0) {
[dict addEntriesFromDictionary:params];
}
return dict;
}
#pragma mark - TXVodPreloadManager delegate
- (void)onComplete:(int)taskID url:(NSString *)url
......@@ -118,9 +120,7 @@
__block NSMutableDictionary *dict = [NSMutableDictionary dictionary];
[dict setObject:@(taskID) forKey:@"taskId"];
[dict setObject:url forKey:@"url"];
[self.downloadFlutterApi onPreDownloadEventEvent:[FTXDownloadManager getParamsWithEvent:EVENT_PREDOWNLOAD_ON_COMPLETE withParams:dict] completion:^(FlutterError * _Nullable error) {
FTXLOGE(@"callback message error:%@", error);
}];
[self onPreloadCallback:[TXCommonUtil getParamsWithEvent:EVENT_PREDOWNLOAD_ON_COMPLETE withParams:dict]];
}
- (void)onError:(int)taskID url:(NSString *)url error:(NSError *)error
......@@ -214,30 +214,22 @@
/// Download started.
- (void)onDownloadStart:(TXVodDownloadMediaInfo *)mediaInfo {
[self.downloadFlutterApi onDownloadEventEvent:[FTXDownloadManager getParamsWithEvent:EVENT_DOWNLOAD_START withParams:[self buildMapFromDownloadMediaInfo:mediaInfo]] completion:^(FlutterError * _Nullable error) {
FTXLOGE(@"callback message error:%@", error);
}];
[self onDownloadCallback:[TXCommonUtil getParamsWithEvent:EVENT_DOWNLOAD_START withParams:[self buildMapFromDownloadMediaInfo:mediaInfo]]];
}
/// Download progress.
- (void)onDownloadProgress:(TXVodDownloadMediaInfo *)mediaInfo {
[self.downloadFlutterApi onDownloadEventEvent:[FTXDownloadManager getParamsWithEvent:EVENT_DOWNLOAD_PROGRESS withParams:[self buildMapFromDownloadMediaInfo:mediaInfo]] completion:^(FlutterError * _Nullable error) {
FTXLOGE(@"callback message error:%@", error);
}];
[self onDownloadCallback:[TXCommonUtil getParamsWithEvent:EVENT_DOWNLOAD_PROGRESS withParams:[self buildMapFromDownloadMediaInfo:mediaInfo]]];
}
/// Download stopped.
- (void)onDownloadStop:(TXVodDownloadMediaInfo *)mediaInfo {
[self.downloadFlutterApi onDownloadEventEvent:[FTXDownloadManager getParamsWithEvent:EVENT_DOWNLOAD_STOP withParams:[self buildMapFromDownloadMediaInfo:mediaInfo]] completion:^(FlutterError * _Nullable error) {
FTXLOGE(@"callback message error:%@", error);
}];
[self onDownloadCallback:[TXCommonUtil getParamsWithEvent:EVENT_DOWNLOAD_STOP withParams:[self buildMapFromDownloadMediaInfo:mediaInfo]]];
}
/// Download completed.
- (void)onDownloadFinish:(TXVodDownloadMediaInfo *)mediaInfo {
[self.downloadFlutterApi onDownloadEventEvent:[FTXDownloadManager getParamsWithEvent:EVENT_DOWNLOAD_FINISH withParams:[self buildMapFromDownloadMediaInfo:mediaInfo]] completion:^(FlutterError * _Nullable error) {
FTXLOGE(@"callback message error:%@", error);
}];
[self onDownloadCallback:[TXCommonUtil getParamsWithEvent:EVENT_DOWNLOAD_FINISH withParams:[self buildMapFromDownloadMediaInfo:mediaInfo]]];
}
/// Download error.
......@@ -245,9 +237,7 @@
NSMutableDictionary *dict = [self buildMapFromDownloadMediaInfo:mediaInfo];
[dict setValue:@(code) forKey:@"errorCode"];
[dict setValue:msg forKey:@"errorMsg"];
[self.downloadFlutterApi onDownloadEventEvent:[FTXDownloadManager getParamsWithEvent:EVENT_DOWNLOAD_ERROR withParams:dict] completion:^(FlutterError * _Nullable error) {
FTXLOGE(@"callback message error:%@", error);
}];
[self onDownloadCallback:[TXCommonUtil getParamsWithEvent:EVENT_DOWNLOAD_ERROR withParams:dict]];
}
/**
......@@ -266,6 +256,12 @@
return 0;
}
- (void)onDownloadCallback:(NSDictionary<NSString *, id> *)arg_event {
[self.downloadFlutterApi onDownloadEventEvent:arg_event completion:^(FlutterError * _Nullable error) {
FTXLOGE(@"callback message error:%@", error);
}];
}
#pragma mark TXFlutterDownloadApi
- (nullable BoolMsg *)deleteDownloadMediaInfoMsg:(nonnull TXVodDownloadMediaMsg *)msg error:(FlutterError * _Nullable __autoreleasing * _Nonnull)error {
......@@ -359,6 +355,7 @@
params.appId = (msg.appId != nil && [msg.appId isKindOfClass:[NSNumber class]]) ? [msg.appId intValue] : 0;
params.fileId = fileId;
params.sign = (msg.pSign != nil && [msg.pSign isKindOfClass:[NSString class]]) ? msg.pSign : @"";
params.headers = msg.httpHeader != nil ? msg.httpHeader : @{};
__block TXPredownloadFileHelperDelegate *delegate = [[TXPredownloadFileHelperDelegate alloc] initWithBlock:tmpTaskId start:^(long tmpTaskId, int taskID, NSString * _Nonnull fileId, NSString * _Nonnull url, NSDictionary * _Nonnull param) {
[self onPreLoadStartEvent:tmpTaskId taskID:taskID fileId:fileId url:url param:param];
} complete:^(int taskID, NSString * _Nonnull url) {
......
......@@ -374,18 +374,14 @@ static const int uninitialized = -1;
}
}
+ (NSDictionary *)getParamsWithEvent:(int)evtID withParams:(NSDictionary *)params
{
NSMutableDictionary<NSString*,NSObject*> *dict = [NSMutableDictionary dictionaryWithObject:@(evtID) forKey:EVT_KEY_PLAYER_EVENT];
if (params != nil && params.count != 0) {
[dict addEntriesFromDictionary:params];
}
- (NSDictionary *)getLiveParamsWithEvent:(int)evtID withParams:(NSDictionary *)params {
NSMutableDictionary<NSString*,NSObject*> *dict = [TXCommonUtil getParamsWithEvent:evtID withParams:params];
long long timestamp = [self currentMillisecondTime];
[dict setObject:@(timestamp) forKey:EVT_TIME];
return dict;
}
+ (long long)currentMillisecondTime {
- (long long)currentMillisecondTime {
NSDate *now = [NSDate date]; // 获取当前日期时间
NSTimeInterval timeInterval = [now timeIntervalSince1970]; // 获取距离1970年的秒数
long long millisecondTime = (long long)(timeInterval * 1000); // 将秒数转换为毫秒数
......@@ -394,7 +390,7 @@ static const int uninitialized = -1;
- (void)notifyPlayerEvent:(int)evtID withParams:(NSDictionary *)params {
self.lastPlayEvent = evtID;
[self.liveFlutterApi onPlayerEventEvent:[FTXLivePlayer getParamsWithEvent:evtID withParams:params] completion:^(FlutterError * _Nullable error) {
[self.liveFlutterApi onPlayerEventEvent:[self getLiveParamsWithEvent:evtID withParams:params] completion:^(FlutterError * _Nullable error) {
FTXLOGE(@"callback message error:%@", error);
}];
FTXLOGI(@"onLivePlayEvent:%i,%@", evtID, params[EVT_MSG])
......
......@@ -21,6 +21,7 @@
config.enableRenderProcess = msg.enableRenderProcess.boolValue;
config.preferredResolution = msg.preferredResolution.longValue;
config.mediaType = msg.mediaType.intValue;
config.encryptedMp4Level = msg.encryptedMp4Level.intValue;
NSTimeInterval progressInerval = msg.progressInterval.intValue / 1000.0;
if(progressInerval > 0) {
config.progressInterval = progressInerval;
......
......@@ -383,16 +383,6 @@ static const int CODE_ON_RECEIVE_FIRST_FRAME = 2003;
return nil;
}
+ (NSDictionary *)getParamsWithEvent:(int)EvtID withParams:(NSDictionary *)params
{
NSMutableDictionary<NSString*,NSObject*> *dict = [NSMutableDictionary dictionaryWithObject:@(EvtID) forKey:@"event"];
if (params != nil && params.count != 0) {
[dict addEntriesFromDictionary:params];
}
return dict;
}
#pragma mark - FlutterTexture
- (CVPixelBufferRef _Nullable)copyPixelBuffer
......@@ -440,7 +430,7 @@ static const int CODE_ON_RECEIVE_FIRST_FRAME = 2003;
if (evtID != PLAY_EVT_PLAY_PROGRESS) {
FTXLOGI(@"onPlayEvent:%i,%@", evtID, param[EVT_PLAY_DESCRIPTION]);
}
[self.vodFlutterApi onPlayerEventEvent:[FTXVodPlayer getParamsWithEvent:evtID withParams:param] completion:^(FlutterError * _Nullable error) {
[self.vodFlutterApi onPlayerEventEvent:[TXCommonUtil getParamsWithEvent:evtID withParams:param] completion:^(FlutterError * _Nullable error) {
FTXLOGE(@"callback message error:%@", error);
}];
}
......@@ -472,7 +462,7 @@ static const int CODE_ON_RECEIVE_FIRST_FRAME = 2003;
mutableDic[EXTRA_SUBTITLE_START_POSITION_MS] = @(subtitleData.startPositionMs);
mutableDic[EXTRA_SUBTITLE_DURATION_MS] = @(subtitleData.durationMs);
mutableDic[EXTRA_SUBTITLE_TRACK_INDEX] = @(subtitleData.trackIndex);
[self.vodFlutterApi onPlayerEventEvent:[FTXVodPlayer getParamsWithEvent:EVENT_SUBTITLE_DATA withParams:mutableDic] completion:^(FlutterError * _Nullable error) {
[self.vodFlutterApi onPlayerEventEvent:[TXCommonUtil getParamsWithEvent:EVENT_SUBTITLE_DATA withParams:mutableDic] completion:^(FlutterError * _Nullable error) {
FTXLOGE(@"callback message error:%@", error);
}];
}
......@@ -1055,9 +1045,19 @@ static const int CODE_ON_RECEIVE_FIRST_FRAME = 2003;
if (nil != _txVodPlayer) {
if (playerMsg.value && [playerMsg.value count] != 0) {
id value = playerMsg.value[0];
[_txVodPlayer setExtentOptionInfo:@{
playerMsg.key : value
}];
NSString *key = playerMsg.key;
// HEVC 降级播放参数进行特殊判断,保证 flutter 层接口一致
if ([key isEqualToString:VOD_KEY_VIDEO_CODEC_TYPE] && [value isKindOfClass:[NSString class]]) {
if ([(NSString *) value isEqualToString:@"video/hevc"]) {
[_txVodPlayer setExtentOptionInfo:@{
VOD_KEY_VIDEO_CODEC_TYPE : @(kCMVideoCodecType_HEVC)
}];
}
} else {
[_txVodPlayer setExtentOptionInfo:@{
key : value
}];
}
}
}
}
......
......@@ -78,20 +78,11 @@ SuperPlayerPlugin* instance;
- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary<NSKeyValueChangeKey,id> *)change context:(void *)context
{
[self.pluginFlutterApi onNativeEventEvent:[SuperPlayerPlugin getParamsWithEvent:EVENT_VOLUME_CHANGED withParams:@{}] completion:^(FlutterError * _Nullable error) {
[self.pluginFlutterApi onNativeEventEvent:[TXCommonUtil getParamsWithEvent:EVENT_VOLUME_CHANGED withParams:@{}] completion:^(FlutterError * _Nullable error) {
FTXLOGE(@"callback message error:%@", error);
}];
}
+ (NSDictionary *)getParamsWithEvent:(int)EvtID withParams:(NSDictionary *)params
{
NSMutableDictionary<NSString*,NSObject*> *dict = [NSMutableDictionary dictionaryWithObject:@(EvtID) forKey:@"event"];
if (params != nil && params.count != 0) {
[dict addEntriesFromDictionary:params];
}
return dict;
}
-(void) destory
{
[self.audioManager destory:self];
......@@ -134,7 +125,7 @@ SuperPlayerPlugin* instance;
*/
- (void)brightnessDidChange:(NSNotification *)notification
{
[self.pluginFlutterApi onNativeEventEvent:[SuperPlayerPlugin getParamsWithEvent:EVENT_BRIGHTNESS_CHANGED withParams:@{}] completion:^(FlutterError * _Nullable error) {
[self.pluginFlutterApi onNativeEventEvent:[TXCommonUtil getParamsWithEvent:EVENT_BRIGHTNESS_CHANGED withParams:@{}] completion:^(FlutterError * _Nullable error) {
FTXLOGE(@"callback message error:%@", error);
}];
}
......@@ -155,6 +146,8 @@ SuperPlayerPlugin* instance;
}
#pragma mark - FTXVodPlayerDelegate
- (void)onPlayerPipRequestStart {
......@@ -417,7 +410,7 @@ SuperPlayerPlugin* instance;
@(EVENT_RESULT) : @(blockResult),
@(EVENT_REASON) : blockReason,
};
[self.pluginFlutterApi onSDKListenerEvent:[SuperPlayerPlugin getParamsWithEvent:EVENT_ON_LICENCE_LOADED withParams:param] completion:^(FlutterError * _Nullable error) {
[self.pluginFlutterApi onSDKListenerEvent:[TXCommonUtil getParamsWithEvent:EVENT_ON_LICENCE_LOADED withParams:param] completion:^(FlutterError * _Nullable error) {
FTXLOGE(@"callback message error:%@", error);
}];
}
......
// Copyright (c) 2022 Tencent. All rights reserved.
// Autogenerated from Pigeon (v22.6.0), do not edit directly.
// Autogenerated from Pigeon (v22.6.1), do not edit directly.
// See also: https://pub.dev/packages/pigeon
#import <Foundation/Foundation.h>
......@@ -164,7 +164,8 @@ NS_ASSUME_NONNULL_BEGIN
extInfoMap:(nullable NSDictionary<NSString *, id> *)extInfoMap
enableRenderProcess:(nullable NSNumber *)enableRenderProcess
preferredResolution:(nullable NSNumber *)preferredResolution
mediaType:(nullable NSNumber *)mediaType;
mediaType:(nullable NSNumber *)mediaType
encryptedMp4Level:(nullable NSNumber *)encryptedMp4Level;
@property(nonatomic, strong, nullable) NSNumber * playerId;
@property(nonatomic, strong, nullable) NSNumber * connectRetryCount;
@property(nonatomic, strong, nullable) NSNumber * connectRetryInterval;
......@@ -188,6 +189,8 @@ NS_ASSUME_NONNULL_BEGIN
/// Media asset type, default auto type, refer to value see[TXVodPlayEvent]
/// 媒资类型,默认auto类型, 取值参考 see[TXVodPlayEvent]
@property(nonatomic, strong, nullable) NSNumber * mediaType;
/// MP4 encryption playback: Supported since version 12.2.
@property(nonatomic, strong, nullable) NSNumber * encryptedMp4Level;
@end
@interface FTXLivePlayConfigPlayerMsg : NSObject
......@@ -329,7 +332,8 @@ NS_ASSUME_NONNULL_BEGIN
playUrl:(nullable NSString *)playUrl
preloadSizeMB:(nullable NSNumber *)preloadSizeMB
preferredResolution:(nullable NSNumber *)preferredResolution
tmpPreloadTaskId:(nullable NSNumber *)tmpPreloadTaskId;
tmpPreloadTaskId:(nullable NSNumber *)tmpPreloadTaskId
httpHeader:(nullable NSDictionary<NSString *, NSString *> *)httpHeader;
@property(nonatomic, strong, nullable) NSNumber * appId;
@property(nonatomic, copy, nullable) NSString * fileId;
@property(nonatomic, copy, nullable) NSString * pSign;
......@@ -337,6 +341,7 @@ NS_ASSUME_NONNULL_BEGIN
@property(nonatomic, strong, nullable) NSNumber * preloadSizeMB;
@property(nonatomic, strong, nullable) NSNumber * preferredResolution;
@property(nonatomic, strong, nullable) NSNumber * tmpPreloadTaskId;
@property(nonatomic, copy, nullable) NSDictionary<NSString *, NSString *> * httpHeader;
@end
@interface MapMsg : NSObject
......
// Copyright (c) 2022 Tencent. All rights reserved.
// Autogenerated from Pigeon (v22.6.0), do not edit directly.
// Autogenerated from Pigeon (v22.6.1), do not edit directly.
// See also: https://pub.dev/packages/pigeon
#import "FtxMessages.h"
......@@ -532,7 +532,8 @@ static id GetNullableObjectAtIndex(NSArray<id> *array, NSInteger key) {
extInfoMap:(nullable NSDictionary<NSString *, id> *)extInfoMap
enableRenderProcess:(nullable NSNumber *)enableRenderProcess
preferredResolution:(nullable NSNumber *)preferredResolution
mediaType:(nullable NSNumber *)mediaType {
mediaType:(nullable NSNumber *)mediaType
encryptedMp4Level:(nullable NSNumber *)encryptedMp4Level {
FTXVodPlayConfigPlayerMsg* pigeonResult = [[FTXVodPlayConfigPlayerMsg alloc] init];
pigeonResult.playerId = playerId;
pigeonResult.connectRetryCount = connectRetryCount;
......@@ -555,6 +556,7 @@ static id GetNullableObjectAtIndex(NSArray<id> *array, NSInteger key) {
pigeonResult.enableRenderProcess = enableRenderProcess;
pigeonResult.preferredResolution = preferredResolution;
pigeonResult.mediaType = mediaType;
pigeonResult.encryptedMp4Level = encryptedMp4Level;
return pigeonResult;
}
+ (FTXVodPlayConfigPlayerMsg *)fromList:(NSArray<id> *)list {
......@@ -580,6 +582,7 @@ static id GetNullableObjectAtIndex(NSArray<id> *array, NSInteger key) {
pigeonResult.enableRenderProcess = GetNullableObjectAtIndex(list, 18);
pigeonResult.preferredResolution = GetNullableObjectAtIndex(list, 19);
pigeonResult.mediaType = GetNullableObjectAtIndex(list, 20);
pigeonResult.encryptedMp4Level = GetNullableObjectAtIndex(list, 21);
return pigeonResult;
}
+ (nullable FTXVodPlayConfigPlayerMsg *)nullableFromList:(NSArray<id> *)list {
......@@ -608,6 +611,7 @@ static id GetNullableObjectAtIndex(NSArray<id> *array, NSInteger key) {
self.enableRenderProcess ?: [NSNull null],
self.preferredResolution ?: [NSNull null],
self.mediaType ?: [NSNull null],
self.encryptedMp4Level ?: [NSNull null],
];
}
@end
......@@ -966,7 +970,8 @@ static id GetNullableObjectAtIndex(NSArray<id> *array, NSInteger key) {
playUrl:(nullable NSString *)playUrl
preloadSizeMB:(nullable NSNumber *)preloadSizeMB
preferredResolution:(nullable NSNumber *)preferredResolution
tmpPreloadTaskId:(nullable NSNumber *)tmpPreloadTaskId {
tmpPreloadTaskId:(nullable NSNumber *)tmpPreloadTaskId
httpHeader:(nullable NSDictionary<NSString *, NSString *> *)httpHeader {
PreLoadInfoMsg* pigeonResult = [[PreLoadInfoMsg alloc] init];
pigeonResult.appId = appId;
pigeonResult.fileId = fileId;
......@@ -975,6 +980,7 @@ static id GetNullableObjectAtIndex(NSArray<id> *array, NSInteger key) {
pigeonResult.preloadSizeMB = preloadSizeMB;
pigeonResult.preferredResolution = preferredResolution;
pigeonResult.tmpPreloadTaskId = tmpPreloadTaskId;
pigeonResult.httpHeader = httpHeader;
return pigeonResult;
}
+ (PreLoadInfoMsg *)fromList:(NSArray<id> *)list {
......@@ -986,6 +992,7 @@ static id GetNullableObjectAtIndex(NSArray<id> *array, NSInteger key) {
pigeonResult.preloadSizeMB = GetNullableObjectAtIndex(list, 4);
pigeonResult.preferredResolution = GetNullableObjectAtIndex(list, 5);
pigeonResult.tmpPreloadTaskId = GetNullableObjectAtIndex(list, 6);
pigeonResult.httpHeader = GetNullableObjectAtIndex(list, 7);
return pigeonResult;
}
+ (nullable PreLoadInfoMsg *)nullableFromList:(NSArray<id> *)list {
......@@ -1000,6 +1007,7 @@ static id GetNullableObjectAtIndex(NSArray<id> *array, NSInteger key) {
self.preloadSizeMB ?: [NSNull null],
self.preferredResolution ?: [NSNull null],
self.tmpPreloadTaskId ?: [NSNull null],
self.httpHeader ?: [NSNull null],
];
}
@end
......
......@@ -22,4 +22,6 @@
+(ListMsg*)listMsgWith:(NSArray*)value;
+ (NSMutableDictionary *)getParamsWithEvent:(int)EvtID withParams:(NSDictionary *)params;
@end
......@@ -86,4 +86,20 @@
return msg;
}
+ (NSMutableDictionary *)getParamsWithEvent:(int)EvtID withParams:(NSDictionary *)params
{
NSMutableDictionary<NSString*,NSObject*> *dict = [NSMutableDictionary dictionaryWithObject:@(EvtID) forKey:EVT_KEY_PLAYER_EVENT];
if (params != nil && params.count != 0) {
// Iterate over each key-value pair in the original dictionary
[params enumerateKeysAndObjectsUsingBlock:^(id key, id value, BOOL *stop) {
// Check if the value is NSNull
if (![value isKindOfClass:[NSNull class]] && value != nil) {
// If it is not NSNull, then add it to the new dictionary
[dict setObject:value forKey:key];
}
}];
}
return dict;
}
@end
......@@ -4,7 +4,7 @@
#
Pod::Spec.new do |s|
s.name = 'super_player'
s.version = '12.1.0'
s.version = '12.2.0'
s.summary = 'player plugin.'
s.description = <<-DESC
player plugin.
......@@ -26,7 +26,7 @@ player plugin.
# Player_Premium SDK: s.dependency 'TXLiteAVSDK_Player_Premium'
# Professional SDK: s.dependency 'TXLiteAVSDK_Professional'
# If you want to specify the SDK version(eg 11.6.15041), use: s.dependency 'TXLiteAVSDK_Player','11.6.15041'
s.dependency 'TXLiteAVSDK_Professional', '12.1.16597'
s.dependency 'LiteAVSDK_Professional','12.2.16945'
# Flutter.framework does not contain a i386 slice.
s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES', 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'i386' }
......
......@@ -2,5 +2,5 @@
part of SuperPlayer;
abstract class FPlayerPckInfo {
static const String PLAYER_VERSION = "12.1.0";
static const String PLAYER_VERSION = "12.2.0";
}
\ No newline at end of file
......@@ -149,6 +149,9 @@ class FTXVodPlayConfigPlayerMsg {
/// Media asset type, default auto type, refer to value see[TXVodPlayEvent]
/// 媒资类型,默认auto类型, 取值参考 see[TXVodPlayEvent]
int? mediaType;
/// MP4 encryption playback: Supported since version 12.2.
int? encryptedMp4Level;
}
class FTXLivePlayConfigPlayerMsg {
......@@ -293,6 +296,7 @@ class PreLoadInfoMsg {
double? preloadSizeMB;
int? preferredResolution;
int? tmpPreloadTaskId;
Map<String?, String?>? httpHeader;
}
class MapMsg {
......
......@@ -435,6 +435,25 @@ abstract class TXVodPlayEvent {
static const EXTRA_SUBTITLE_START_POSITION_MS = "startPositionMs";
static const EXTRA_SUBTITLE_DURATION_MS = "durationMs";
static const EXTRA_SUBTITLE_TRACK_INDEX = "trackIndex";
/// Alternative playback URL for HEVC downgrade playback, supported by the Advanced Player 12.0
/// HEVC 降级播放时备选播放 URL, 播放器高级版 12.0 版本开始支持
static const VOD_KEY_BACKUP_URL = "VOD_KEY_BACKUP_URL";
/// When HEVC is downgraded, the main video encoding type
/// HEVC 降级播放时,主播放的视频编码类型
static const VOD_KEY_VIDEO_CODEC_TYPE = "VOD_KEY_VIDEO_CODEC_TYPE";
/// MediaType of alternative playback URL resource during HEVC downgrade playback, supported by the Advanced Player 12.0
/// HEVC 降级播放时备选播放 URL 资源的 MediaType, 播放器高级版 12.0 版本开始支持
static const VOD_KEY_BACKUP_URL_MEDIA_TYPE = "VOD_KEY_BACKUP_URL_MEDIA_TYPE";
/// HEVC format, supported by the player advanced version 12.0
/// HEVC 格式, 播放器高级版 12.0 版本开始支持
static const VOD_PLAY_MIMETYPE_H265 = "video/hevc";
/// mp4加密播放:不加密。 12.2 版本开始支持。
/// MP4 encryption playback: No encryption. Supported since version 12.2.
static const MP4_ENCRYPTION_LEVEL_NONE = 0;
/// mp4加密播放: mp4本地加密播放。12.2 版本开始支持。
/// MP4 encrypted playback: MP4 local encrypted playback. Supported since version 12.2.
static const MP4_ENCRYPTION_LEVEL_L2 = 2;
}
abstract class TXVodNetEvent {
......@@ -618,8 +637,9 @@ class TXPlayInfoParams {
// video url, only applicable for preloading. When using it, you only need to fill in either the url or fileId.
// The priority of the url is higher than that of the fileId.
final String? url;
const TXPlayInfoParams({required this.appId, required this.fileId, this.psign = "", this.url = ""});
// Custom httpHeader
final Map<String, String>? httpHeader;
const TXPlayInfoParams({required this.appId, required this.fileId, this.psign = "", this.url = "", this.httpHeader});
Map<String, dynamic> toJson() {
Map<String, dynamic> json = {};
......@@ -627,6 +647,7 @@ class TXPlayInfoParams {
json["fileId"] = fileId;
json["psign"] = psign;
json["url"] = url;
json["httpHeader"] = httpHeader;
return json;
}
}
......
......@@ -381,6 +381,7 @@ class FTXVodPlayConfigPlayerMsg {
this.enableRenderProcess,
this.preferredResolution,
this.mediaType,
this.encryptedMp4Level,
});
int? playerId;
......@@ -427,6 +428,9 @@ class FTXVodPlayConfigPlayerMsg {
/// 媒资类型,默认auto类型, 取值参考 see[TXVodPlayEvent]
int? mediaType;
/// MP4 encryption playback: Supported since version 12.2.
int? encryptedMp4Level;
Object encode() {
return <Object?>[
playerId,
......@@ -450,6 +454,7 @@ class FTXVodPlayConfigPlayerMsg {
enableRenderProcess,
preferredResolution,
mediaType,
encryptedMp4Level,
];
}
......@@ -477,6 +482,7 @@ class FTXVodPlayConfigPlayerMsg {
enableRenderProcess: result[18] as bool?,
preferredResolution: result[19] as int?,
mediaType: result[20] as int?,
encryptedMp4Level: result[21] as int?,
);
}
}
......@@ -885,6 +891,7 @@ class PreLoadInfoMsg {
this.preloadSizeMB,
this.preferredResolution,
this.tmpPreloadTaskId,
this.httpHeader,
});
int? appId;
......@@ -901,6 +908,8 @@ class PreLoadInfoMsg {
int? tmpPreloadTaskId;
Map<String?, String?>? httpHeader;
Object encode() {
return <Object?>[
appId,
......@@ -910,6 +919,7 @@ class PreLoadInfoMsg {
preloadSizeMB,
preferredResolution,
tmpPreloadTaskId,
httpHeader,
];
}
......@@ -923,6 +933,7 @@ class PreLoadInfoMsg {
preloadSizeMB: result[4] as double?,
preferredResolution: result[5] as int?,
tmpPreloadTaskId: result[6] as int?,
httpHeader: (result[7] as Map<Object?, Object?>?)?.cast<String?, String?>(),
);
}
}
......
......@@ -82,7 +82,8 @@ class TXVodDownloadController implements TXDownloadFlutterAPI {
..appId = txPlayInfoParams.appId
..pSign = txPlayInfoParams.psign
..preloadSizeMB = preloadSizeMB
..preferredResolution = preferredResolution);
..preferredResolution = preferredResolution
..httpHeader = txPlayInfoParams.httpHeader);
_fileIdBeforeStartListeners[tmpPreloadTaskId] = _PreloadListener()
..onCompleteListener = onCompleteListener
..onErrorListener = onErrorListener
......@@ -232,8 +233,8 @@ class TXVodDownloadController implements TXDownloadFlutterAPI {
}
@override
void onDownloadEvent(Map<dynamic, dynamic> event) {
LogUtils.d(TAG, 'onPreDownloadEvent _eventHandler, event= $event');
void onDownloadEvent(Map<String, Object> event) {
LogUtils.d(TAG, 'onDownloadEvent _eventHandler, event= $event');
final Map<dynamic, dynamic> map = event;
int eventCode = map["event"];
switch (eventCode) {
......@@ -255,9 +256,8 @@ class TXVodDownloadController implements TXDownloadFlutterAPI {
}
@override
void onPreDownloadEvent(Map<dynamic, dynamic> event) {
LogUtils.d(TAG, 'onDownloadEvent _eventHandler, event= $event');
void onPreDownloadEvent(Map<String, Object> event) {
LogUtils.d(TAG, 'onPreDownloadEvent _eventHandler, event= $event');
final Map<dynamic, dynamic> map = event;
int eventCode = map["event"];
switch (eventCode) {
......
......@@ -92,6 +92,8 @@ class FTXVodPlayConfig {
/// 媒资类型,默认auto类型, 取值参考 see[TXVodPlayEvent]
int mediaType = TXVodPlayEvent.MEDIA_TYPE_AUTO;
int encryptedMp4Level = TXVodPlayEvent.MP4_ENCRYPTION_LEVEL_NONE;
Map<String, dynamic> toJson() {
Map<String, dynamic> json = {};
json["connectRetryCount"] = connectRetryCount;
......@@ -114,6 +116,7 @@ class FTXVodPlayConfig {
json["enableRenderProcess"] = enableRenderProcess;
json["preferredResolution"] = preferredResolution.toString();
json["mediaType"] = mediaType.toString();
json["encryptedMp4Level"] = encryptedMp4Level.toString();
return json;
}
......@@ -139,6 +142,7 @@ class FTXVodPlayConfig {
enableRenderProcess: enableRenderProcess,
preferredResolution: preferredResolution,
mediaType: mediaType,
encryptedMp4Level: encryptedMp4Level,
);
}
}
......
name: super_player
description: player plugin.
version: 12.1.0
version: 12.2.0
author:
homepage:
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论