Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
T
tx_player_fork
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
蒋俊
tx_player_fork
Commits
f626ddfc
提交
f626ddfc
authored
3月 07, 2024
作者:
kongdywang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
1. Fix file name conflict issues in some cases
2. Add setSDKListener in SuperPlayerPlugin 3. Fix android pip start-up failed in sdk 11.7
上级
28911c12
隐藏空白字符变更
内嵌
并排
正在显示
32 个修改的文件
包含
357 行增加
和
182 行删除
+357
-182
AndroidManifest.xml
Flutter/android/src/main/AndroidManifest.xml
+2
-1
FTXDownloadManager.java
...main/java/com/tencent/vod/flutter/FTXDownloadManager.java
+12
-12
FTXEvent.java
...droid/src/main/java/com/tencent/vod/flutter/FTXEvent.java
+22
-0
FTXLivePlayer.java
.../src/main/java/com/tencent/vod/flutter/FTXLivePlayer.java
+16
-17
FTXPIPManager.java
.../src/main/java/com/tencent/vod/flutter/FTXPIPManager.java
+9
-9
FTXVodPlayer.java
...d/src/main/java/com/tencent/vod/flutter/FTXVodPlayer.java
+30
-30
SuperPlayerPlugin.java
.../main/java/com/tencent/vod/flutter/SuperPlayerPlugin.java
+75
-5
FTXLivePlayerDispatcher.java
...tencent/vod/flutter/messages/FTXLivePlayerDispatcher.java
+2
-2
FTXVodPlayerDispatcher.java
.../tencent/vod/flutter/messages/FTXVodPlayerDispatcher.java
+2
-2
ITXPlayersBridge.java
...va/com/tencent/vod/flutter/messages/ITXPlayersBridge.java
+1
-1
TXPipResult.java
.../main/java/com/tencent/vod/flutter/model/TXPipResult.java
+8
-8
TXVideoModel.java
...main/java/com/tencent/vod/flutter/model/TXVideoModel.java
+8
-8
TXCommonUtil.java
...main/java/com/tencent/vod/flutter/tools/TXCommonUtil.java
+3
-6
FlutterPipImplActivity.java
...va/com/tencent/vod/flutter/ui/FlutterPipImplActivity.java
+9
-6
TXAndroid12BridgeService.java
.../com/tencent/vod/flutter/ui/TXAndroid12BridgeService.java
+3
-3
FTXDownloadManager.m
Flutter/ios/Classes/FTXDownloadManager.m
+9
-9
FTXEvent.h
Flutter/ios/Classes/FTXEvent.h
+21
-0
FTXLivePlayer.m
Flutter/ios/Classes/FTXLivePlayer.m
+7
-7
FTXVodPlayer.m
Flutter/ios/Classes/FTXVodPlayer.m
+16
-16
SuperPlayerPlugin.h
Flutter/ios/Classes/SuperPlayerPlugin.h
+1
-1
SuperPlayerPlugin.m
Flutter/ios/Classes/SuperPlayerPlugin.m
+49
-14
TXCommonUtil.h
Flutter/ios/Classes/TXCommonUtil.h
+1
-1
TXCommonUtil.m
Flutter/ios/Classes/TXCommonUtil.m
+2
-2
TXPredownloadFileHelperDelegate.h
Flutter/ios/Classes/helper/TXPredownloadFileHelperDelegate.h
+4
-4
TXPredownloadFileHelperDelegate.m
Flutter/ios/Classes/helper/TXPredownloadFileHelperDelegate.m
+3
-3
FTXLivePlayerDispatcher.h
Flutter/ios/Classes/messages/FTXLivePlayerDispatcher.h
+3
-3
FTXLivePlayerDispatcher.m
Flutter/ios/Classes/messages/FTXLivePlayerDispatcher.m
+1
-1
FTXVodPlayerDispatcher.h
Flutter/ios/Classes/messages/FTXVodPlayerDispatcher.h
+3
-3
FTXVodPlayerDispatcher.m
Flutter/ios/Classes/messages/FTXVodPlayerDispatcher.m
+1
-1
ITXPlayersBridge.h
Flutter/ios/Classes/messages/ITXPlayersBridge.h
+4
-4
superplayer_plugin.dart
Flutter/lib/Core/superplayer_plugin.dart
+21
-3
txplayer_define.dart
Flutter/lib/Core/txplayer_define.dart
+9
-0
没有找到文件。
Flutter/android/src/main/AndroidManifest.xml
浏览文件 @
f626ddfc
...
...
@@ -23,7 +23,7 @@
</intent-filter>
</activity>
<service
android:name=
"com.tencent.vod.flutter.ui.Android12BridgeService"
/>
<service
android:name=
"com.tencent.vod.flutter.ui.
TX
Android12BridgeService"
/>
</application>
</manifest>
\ No newline at end of file
Flutter/android/src/main/java/com/tencent/vod/flutter/FTXDownloadManager.java
浏览文件 @
f626ddfc
...
...
@@ -24,7 +24,7 @@ import com.tencent.vod.flutter.messages.FtxMessages.PreLoadMsg;
import
com.tencent.vod.flutter.messages.FtxMessages.TXDownloadListMsg
;
import
com.tencent.vod.flutter.messages.FtxMessages.TXFlutterDownloadApi
;
import
com.tencent.vod.flutter.messages.FtxMessages.TXVodDownloadMediaMsg
;
import
com.tencent.vod.flutter.tools.CommonUtil
;
import
com.tencent.vod.flutter.tools.
TX
CommonUtil
;
import
io.flutter.embedding.engine.plugins.FlutterPlugin
;
import
io.flutter.plugin.common.EventChannel
;
...
...
@@ -83,8 +83,8 @@ public class FTXDownloadManager implements ITXVodDownloadListener, TXFlutterDown
bundle
.
putInt
(
"taskId"
,
taskId
);
bundle
.
putString
(
"fileId"
,
fileId
);
bundle
.
putString
(
"url"
,
url
);
Map
<
String
,
Object
>
result
=
CommonUtil
.
getParams
(
FTXEvent
.
EVENT_PREDOWNLOAD_ON_START
,
bundle
);
result
.
put
(
"params"
,
CommonUtil
.
transToMap
(
params
));
Map
<
String
,
Object
>
result
=
TX
CommonUtil
.
getParams
(
FTXEvent
.
EVENT_PREDOWNLOAD_ON_START
,
bundle
);
result
.
put
(
"params"
,
TX
CommonUtil
.
transToMap
(
params
));
sendSuccessEvent
(
result
);
}
...
...
@@ -92,7 +92,7 @@ public class FTXDownloadManager implements ITXVodDownloadListener, TXFlutterDown
Bundle
bundle
=
new
Bundle
();
bundle
.
putInt
(
"taskId"
,
taskId
);
bundle
.
putString
(
"url"
,
url
);
sendSuccessEvent
(
CommonUtil
.
getParams
(
FTXEvent
.
EVENT_PREDOWNLOAD_ON_COMPLETE
,
bundle
));
sendSuccessEvent
(
TX
CommonUtil
.
getParams
(
FTXEvent
.
EVENT_PREDOWNLOAD_ON_COMPLETE
,
bundle
));
}
private
void
onErrorEvent
(
long
tmpTaskId
,
int
taskId
,
String
url
,
int
code
,
String
msg
)
{
...
...
@@ -104,7 +104,7 @@ public class FTXDownloadManager implements ITXVodDownloadListener, TXFlutterDown
bundle
.
putInt
(
"code"
,
code
);
bundle
.
putString
(
"url"
,
url
);
bundle
.
putString
(
"msg"
,
msg
);
sendSuccessEvent
(
CommonUtil
.
getParams
(
FTXEvent
.
EVENT_PREDOWNLOAD_ON_ERROR
,
bundle
));
sendSuccessEvent
(
TX
CommonUtil
.
getParams
(
FTXEvent
.
EVENT_PREDOWNLOAD_ON_ERROR
,
bundle
));
}
private
void
sendSuccessEvent
(
final
Object
event
)
{
...
...
@@ -126,7 +126,7 @@ public class FTXDownloadManager implements ITXVodDownloadListener, TXFlutterDown
TXVodDownloadMediaMsg
msg
=
new
TXVodDownloadMediaMsg
();
if
(
null
!=
mediaInfo
)
{
msg
.
setPlayPath
(
mediaInfo
.
getPlayPath
());
msg
.
setDownloadState
((
long
)
CommonUtil
.
getDownloadEventByState
(
mediaInfo
.
getDownloadState
()));
msg
.
setDownloadState
((
long
)
TX
CommonUtil
.
getDownloadEventByState
(
mediaInfo
.
getDownloadState
()));
msg
.
setUserName
(
mediaInfo
.
getUserName
());
msg
.
setDuration
((
long
)
mediaInfo
.
getDuration
());
msg
.
setPlayableDuration
((
long
)
mediaInfo
.
getPlayableDuration
());
...
...
@@ -166,7 +166,7 @@ public class FTXDownloadManager implements ITXVodDownloadListener, TXFlutterDown
Bundle
bundle
=
new
Bundle
();
bundle
.
putString
(
"playPath"
,
mediaInfo
.
getPlayPath
());
bundle
.
putFloat
(
"progress"
,
mediaInfo
.
getProgress
());
bundle
.
putInt
(
"downloadState"
,
CommonUtil
.
getDownloadEventByState
(
mediaInfo
.
getDownloadState
()));
bundle
.
putInt
(
"downloadState"
,
TX
CommonUtil
.
getDownloadEventByState
(
mediaInfo
.
getDownloadState
()));
bundle
.
putString
(
"userName"
,
mediaInfo
.
getUserName
());
bundle
.
putInt
(
"duration"
,
mediaInfo
.
getDuration
());
bundle
.
putInt
(
"playableDuration"
,
mediaInfo
.
getPlayableDuration
());
...
...
@@ -239,26 +239,26 @@ public class FTXDownloadManager implements ITXVodDownloadListener, TXFlutterDown
@Override
public
void
onDownloadStart
(
TXVodDownloadMediaInfo
txVodDownloadMediaInfo
)
{
Bundle
bundle
=
buildCommonDownloadBundle
(
txVodDownloadMediaInfo
);
sendSuccessEvent
(
CommonUtil
.
getParams
(
FTXEvent
.
EVENT_DOWNLOAD_START
,
bundle
));
sendSuccessEvent
(
TX
CommonUtil
.
getParams
(
FTXEvent
.
EVENT_DOWNLOAD_START
,
bundle
));
}
@Override
public
void
onDownloadProgress
(
TXVodDownloadMediaInfo
txVodDownloadMediaInfo
)
{
Bundle
bundle
=
buildCommonDownloadBundle
(
txVodDownloadMediaInfo
);
sendSuccessEvent
(
CommonUtil
.
getParams
(
FTXEvent
.
EVENT_DOWNLOAD_PROGRESS
,
bundle
));
sendSuccessEvent
(
TX
CommonUtil
.
getParams
(
FTXEvent
.
EVENT_DOWNLOAD_PROGRESS
,
bundle
));
}
@Override
public
void
onDownloadStop
(
TXVodDownloadMediaInfo
txVodDownloadMediaInfo
)
{
Bundle
bundle
=
buildCommonDownloadBundle
(
txVodDownloadMediaInfo
);
sendSuccessEvent
(
CommonUtil
.
getParams
(
FTXEvent
.
EVENT_DOWNLOAD_STOP
,
bundle
));
sendSuccessEvent
(
TX
CommonUtil
.
getParams
(
FTXEvent
.
EVENT_DOWNLOAD_STOP
,
bundle
));
}
@Override
public
void
onDownloadFinish
(
TXVodDownloadMediaInfo
txVodDownloadMediaInfo
)
{
Bundle
bundle
=
buildCommonDownloadBundle
(
txVodDownloadMediaInfo
);
sendSuccessEvent
(
CommonUtil
.
getParams
(
FTXEvent
.
EVENT_DOWNLOAD_FINISH
,
bundle
));
sendSuccessEvent
(
TX
CommonUtil
.
getParams
(
FTXEvent
.
EVENT_DOWNLOAD_FINISH
,
bundle
));
}
@Override
...
...
@@ -266,7 +266,7 @@ public class FTXDownloadManager implements ITXVodDownloadListener, TXFlutterDown
Bundle
bundle
=
buildCommonDownloadBundle
(
txVodDownloadMediaInfo
);
bundle
.
putInt
(
"errorCode"
,
i
);
bundle
.
putString
(
"errorMsg"
,
s
);
sendSuccessEvent
(
CommonUtil
.
getParams
(
FTXEvent
.
EVENT_DOWNLOAD_ERROR
,
bundle
));
sendSuccessEvent
(
TX
CommonUtil
.
getParams
(
FTXEvent
.
EVENT_DOWNLOAD_ERROR
,
bundle
));
}
/**
...
...
Flutter/android/src/main/java/com/tencent/vod/flutter/FTXEvent.java
浏览文件 @
f626ddfc
...
...
@@ -159,4 +159,26 @@ public class FTXEvent {
// 横屏,底部在左
public
static
final
int
ORIENTATION_LANDSCAPE_LEFT
=
414
;
// SDK event
// onLog
public
static
final
int
EVENT_ON_LOG
=
501
;
// onUpdateNetworkTime
public
static
final
int
EVENT_ON_UPDATE_NETWORK_TIME
=
502
;
// onLicenceLoaded
public
static
final
int
EVENT_ON_LICENCE_LOADED
=
503
;
// onCustomHttpDNS
public
static
final
int
EVENT_ON_CUSTOM_HTTP_DNS
=
504
;
// this events may be common,so remove the specific field identifier
public
static
final
String
EVENT_LOG_LEVEL
=
"logLevel"
;
public
static
final
String
EVENT_LOG_MODULE
=
"logModule"
;
public
static
final
String
EVENT_LOG_MSG
=
"logMsg"
;
public
static
final
String
EVENT_ERR_CODE
=
"errCode"
;
public
static
final
String
EVENT_ERR_MSG
=
"errMsg"
;
public
static
final
String
EVENT_RESULT
=
"result"
;
public
static
final
String
EVENT_REASON
=
"reason"
;
public
static
final
String
EVENT_HOST_NAME
=
"hostName"
;
public
static
final
String
EVENT_IPS
=
"ips"
;
}
Flutter/android/src/main/java/com/tencent/vod/flutter/FTXLivePlayer.java
浏览文件 @
f626ddfc
...
...
@@ -15,7 +15,6 @@ import com.tencent.rtmp.TXLivePlayer;
import
com.tencent.rtmp.TXVodConstants
;
import
com.tencent.vod.flutter.messages.FtxMessages.BoolMsg
;
import
com.tencent.vod.flutter.messages.FtxMessages.BoolPlayerMsg
;
import
com.tencent.vod.flutter.messages.FtxMessages.DoublePlayerMsg
;
import
com.tencent.vod.flutter.messages.FtxMessages.FTXLivePlayConfigPlayerMsg
;
import
com.tencent.vod.flutter.messages.FtxMessages.IntMsg
;
import
com.tencent.vod.flutter.messages.FtxMessages.IntPlayerMsg
;
...
...
@@ -24,9 +23,9 @@ import com.tencent.vod.flutter.messages.FtxMessages.PlayerMsg;
import
com.tencent.vod.flutter.messages.FtxMessages.StringIntPlayerMsg
;
import
com.tencent.vod.flutter.messages.FtxMessages.StringPlayerMsg
;
import
com.tencent.vod.flutter.messages.FtxMessages.TXFlutterLivePlayerApi
;
import
com.tencent.vod.flutter.model.PipResult
;
import
com.tencent.vod.flutter.model.VideoModel
;
import
com.tencent.vod.flutter.tools.CommonUtil
;
import
com.tencent.vod.flutter.model.
TX
PipResult
;
import
com.tencent.vod.flutter.model.
TX
VideoModel
;
import
com.tencent.vod.flutter.tools.
TX
CommonUtil
;
import
io.flutter.embedding.engine.plugins.FlutterPlugin
;
import
io.flutter.plugin.common.EventChannel
;
...
...
@@ -60,10 +59,10 @@ public class FTXLivePlayer extends FTXBasePlayer implements ITXLivePlayListener,
private
final
FTXPIPManager
mPipManager
;
private
FTXPIPManager
.
PipParams
mPipParams
;
private
VideoModel
mVideoModel
;
private
TX
VideoModel
mVideoModel
;
private
final
FTXPIPManager
.
PipCallback
pipCallback
=
new
FTXPIPManager
.
PipCallback
()
{
@Override
public
void
onPipResult
(
PipResult
result
)
{
public
void
onPipResult
(
TX
PipResult
result
)
{
// When starting PIP, if the current player is paused and PIP is still playing when exiting,
// the current player will also be set to playing state upon exiting PIP.
boolean
isPipPlaying
=
result
.
isPlaying
();
...
...
@@ -82,7 +81,7 @@ public class FTXLivePlayer extends FTXBasePlayer implements ITXLivePlayListener,
super
();
mFlutterPluginBinding
=
flutterPluginBinding
;
mPipManager
=
pipManager
;
mVideoModel
=
new
VideoModel
();
mVideoModel
=
new
TX
VideoModel
();
mVideoModel
.
setPlayerType
(
FTXEvent
.
PLAYER_LIVE
);
mSurfaceTextureEntry
=
mFlutterPluginBinding
.
getTextureRegistry
().
createSurfaceTexture
();
...
...
@@ -158,12 +157,12 @@ public class FTXLivePlayer extends FTXBasePlayer implements ITXLivePlayListener,
if
(
event
!=
TXVodConstants
.
VOD_PLAY_EVT_PLAY_PROGRESS
)
{
Log
.
e
(
TAG
,
"onLivePlayEvent:"
+
event
+
","
+
bundle
.
getString
(
TXLiveConstants
.
EVT_DESCRIPTION
));
}
mEventSink
.
success
(
CommonUtil
.
getParams
(
event
,
bundle
));
mEventSink
.
success
(
TX
CommonUtil
.
getParams
(
event
,
bundle
));
}
@Override
public
void
onNetStatus
(
Bundle
bundle
)
{
mNetStatusSink
.
success
(
CommonUtil
.
getParams
(
0
,
bundle
));
mNetStatusSink
.
success
(
TX
CommonUtil
.
getParams
(
0
,
bundle
));
}
// The default size of the surface is 1x1. When hardware decoding fails or software decoding is used,
...
...
@@ -338,7 +337,7 @@ public class FTXLivePlayer extends FTXBasePlayer implements ITXLivePlayListener,
@Override
public
IntMsg
initialize
(
@NonNull
BoolPlayerMsg
onlyAudio
)
{
long
textureId
=
init
(
onlyAudio
.
getValue
()
!=
null
?
onlyAudio
.
getValue
()
:
false
);
return
CommonUtil
.
intMsgWith
(
textureId
);
return
TX
CommonUtil
.
intMsgWith
(
textureId
);
}
@NonNull
...
...
@@ -346,20 +345,20 @@ public class FTXLivePlayer extends FTXBasePlayer implements ITXLivePlayListener,
public
BoolMsg
startLivePlay
(
@NonNull
StringIntPlayerMsg
playerMsg
)
{
int
r
=
startPlayerLivePlay
(
playerMsg
.
getStrValue
(),
null
!=
playerMsg
.
getIntValue
()
?
playerMsg
.
getIntValue
().
intValue
()
:
null
);
return
CommonUtil
.
boolMsgWith
(
r
==
1
);
return
TX
CommonUtil
.
boolMsgWith
(
r
==
1
);
}
@NonNull
@Override
public
BoolMsg
stop
(
@NonNull
BoolPlayerMsg
isNeedClear
)
{
boolean
flag
=
null
!=
isNeedClear
.
getValue
()
?
isNeedClear
.
getValue
()
:
false
;
return
CommonUtil
.
boolMsgWith
(
stopPlay
(
flag
)
==
1
);
return
TX
CommonUtil
.
boolMsgWith
(
stopPlay
(
flag
)
==
1
);
}
@NonNull
@Override
public
BoolMsg
isPlaying
(
@NonNull
PlayerMsg
playerMsg
)
{
return
CommonUtil
.
boolMsgWith
(
isPlayerPlaying
());
return
TX
CommonUtil
.
boolMsgWith
(
isPlayerPlaying
());
}
@Override
...
...
@@ -396,7 +395,7 @@ public class FTXLivePlayer extends FTXBasePlayer implements ITXLivePlayListener,
@NonNull
@Override
public
IntMsg
switchStream
(
@NonNull
StringPlayerMsg
url
)
{
return
CommonUtil
.
intMsgWith
((
long
)
switchPlayerStream
(
url
.
getValue
()));
return
TX
CommonUtil
.
intMsgWith
((
long
)
switchPlayerStream
(
url
.
getValue
()));
}
@Override
...
...
@@ -415,9 +414,9 @@ public class FTXLivePlayer extends FTXBasePlayer implements ITXLivePlayListener,
@Override
public
BoolMsg
enableHardwareDecode
(
@NonNull
BoolPlayerMsg
enable
)
{
if
(
null
!=
enable
.
getValue
())
{
return
CommonUtil
.
boolMsgWith
(
enablePlayerHardwareDecode
(
enable
.
getValue
()));
return
TX
CommonUtil
.
boolMsgWith
(
enablePlayerHardwareDecode
(
enable
.
getValue
()));
}
return
CommonUtil
.
boolMsgWith
(
false
);
return
TX
CommonUtil
.
boolMsgWith
(
false
);
}
@NonNull
...
...
@@ -436,7 +435,7 @@ public class FTXLivePlayer extends FTXBasePlayer implements ITXLivePlayListener,
if
(
pipResult
==
FTXEvent
.
NO_ERROR
)
{
pausePlayer
();
}
return
CommonUtil
.
intMsgWith
((
long
)
pipResult
);
return
TX
CommonUtil
.
intMsgWith
((
long
)
pipResult
);
}
@Override
...
...
Flutter/android/src/main/java/com/tencent/vod/flutter/FTXPIPManager.java
浏览文件 @
f626ddfc
...
...
@@ -26,9 +26,9 @@ import android.util.Log;
import
android.util.Rational
;
import
androidx.annotation.RequiresApi
;
import
com.tencent.vod.flutter.model.PipResult
;
import
com.tencent.vod.flutter.model.VideoModel
;
import
com.tencent.vod.flutter.tools.CommonUtil
;
import
com.tencent.vod.flutter.model.
TX
PipResult
;
import
com.tencent.vod.flutter.model.
TX
VideoModel
;
import
com.tencent.vod.flutter.tools.
TX
CommonUtil
;
import
com.tencent.vod.flutter.ui.FlutterPipImplActivity
;
import
io.flutter.embedding.engine.plugins.FlutterPlugin
;
import
io.flutter.embedding.engine.plugins.FlutterPlugin.FlutterPluginBinding
;
...
...
@@ -69,13 +69,13 @@ public class FTXPIPManager {
Bundle
data
=
intent
.
getExtras
();
if
((
pipEventId
==
FTXEvent
.
EVENT_PIP_MODE_ALREADY_EXIT
||
pipEventId
==
FTXEvent
.
EVENT_PIP_MODE_RESTORE_UI
)
&&
null
!=
data
)
{
PipResult
pipResult
=
data
.
getParcelable
(
FTXEvent
.
EXTRA_NAME_RESULT
);
TX
PipResult
pipResult
=
data
.
getParcelable
(
FTXEvent
.
EXTRA_NAME_RESULT
);
if
(
null
!=
pipResult
)
{
callbackData
.
putDouble
(
FTXEvent
.
EVENT_PIP_PLAY_TIME
,
pipResult
.
getPlayTime
());
handlePipResult
(
pipResult
);
}
}
mPipEventSink
.
success
(
CommonUtil
.
getParams
(
pipEventId
,
callbackData
));
mPipEventSink
.
success
(
TX
CommonUtil
.
getParams
(
pipEventId
,
callbackData
));
}
}
};
...
...
@@ -132,7 +132,7 @@ public class FTXPIPManager {
}
}
private
void
handlePipResult
(
PipResult
result
)
{
private
void
handlePipResult
(
TX
PipResult
result
)
{
PipCallback
pipCallback
=
pipCallbacks
.
get
(
result
.
getPlayerId
());
if
(
null
!=
pipCallback
)
{
pipCallback
.
onPipResult
(
result
);
...
...
@@ -146,10 +146,10 @@ public class FTXPIPManager {
*
* @return {@link FTXEvent} ERROR_PIP
*/
public
int
enterPip
(
PipParams
params
,
VideoModel
videoModel
)
{
public
int
enterPip
(
PipParams
params
,
TX
VideoModel
videoModel
)
{
int
pipResult
=
isSupportDevice
();
if
(
pipResult
==
FTXEvent
.
NO_ERROR
)
{
mPipEventSink
.
success
(
CommonUtil
.
getParams
(
FTXEvent
.
EVENT_PIP_MODE_REQUEST_START
,
null
));
mPipEventSink
.
success
(
TX
CommonUtil
.
getParams
(
FTXEvent
.
EVENT_PIP_MODE_REQUEST_START
,
null
));
Intent
intent
=
new
Intent
(
mActivityBinding
.
getActivity
(),
FlutterPipImplActivity
.
class
);
intent
.
setAction
(
FTXEvent
.
PIP_ACTION_START
);
intent
.
putExtra
(
FTXEvent
.
EXTRA_NAME_PARAMS
,
params
);
...
...
@@ -501,6 +501,6 @@ public class FTXPIPManager {
* Close PIP.
* pip关闭
*/
void
onPipResult
(
PipResult
result
);
void
onPipResult
(
TX
PipResult
result
);
}
}
Flutter/android/src/main/java/com/tencent/vod/flutter/FTXVodPlayer.java
浏览文件 @
f626ddfc
...
...
@@ -32,9 +32,9 @@ import com.tencent.vod.flutter.messages.FtxMessages.StringListPlayerMsg;
import
com.tencent.vod.flutter.messages.FtxMessages.StringPlayerMsg
;
import
com.tencent.vod.flutter.messages.FtxMessages.TXPlayInfoParamsPlayerMsg
;
import
com.tencent.vod.flutter.messages.FtxMessages.UInt8ListMsg
;
import
com.tencent.vod.flutter.model.PipResult
;
import
com.tencent.vod.flutter.model.VideoModel
;
import
com.tencent.vod.flutter.tools.CommonUtil
;
import
com.tencent.vod.flutter.model.
TX
PipResult
;
import
com.tencent.vod.flutter.model.
TX
VideoModel
;
import
com.tencent.vod.flutter.tools.
TX
CommonUtil
;
import
io.flutter.embedding.engine.plugins.FlutterPlugin
;
import
io.flutter.plugin.common.EventChannel
;
...
...
@@ -67,7 +67,7 @@ public class FTXVodPlayer extends FTXBasePlayer implements ITXVodPlayListener, F
private
TXVodPlayer
mVodPlayer
;
private
TXImageSprite
mTxImageSprite
;
private
VideoModel
mVideoModel
;
private
TX
VideoModel
mVideoModel
;
private
static
final
int
Uninitialized
=
-
101
;
private
TextureRegistry
.
SurfaceTextureEntry
mSurfaceTextureEntry
;
...
...
@@ -78,7 +78,7 @@ public class FTXVodPlayer extends FTXBasePlayer implements ITXVodPlayListener, F
private
FTXPIPManager
.
PipParams
mPipParams
;
private
final
FTXPIPManager
.
PipCallback
pipCallback
=
new
FTXPIPManager
.
PipCallback
()
{
@Override
public
void
onPipResult
(
PipResult
result
)
{
public
void
onPipResult
(
TX
PipResult
result
)
{
float
playTime
=
result
.
getPlayTime
();
float
duration
=
mVodPlayer
.
getDuration
();
if
(
playTime
>
duration
)
{
...
...
@@ -103,7 +103,7 @@ public class FTXVodPlayer extends FTXBasePlayer implements ITXVodPlayListener, F
super
();
mPipManager
=
pipManager
;
mFlutterPluginBinding
=
flutterPluginBinding
;
mVideoModel
=
new
VideoModel
();
mVideoModel
=
new
TX
VideoModel
();
mVideoModel
.
setPlayerType
(
FTXEvent
.
PLAYER_VOD
);
mEventChannel
=
new
EventChannel
(
flutterPluginBinding
.
getBinaryMessenger
(),
"cloud.tencent"
...
...
@@ -185,7 +185,7 @@ public class FTXVodPlayer extends FTXBasePlayer implements ITXVodPlayListener, F
bundle
.
putInt
(
"videoTop"
,
videoTop
);
bundle
.
putInt
(
"videoRight"
,
videoRight
);
bundle
.
putInt
(
"videoBottom"
,
videoBottom
);
mEventSink
.
success
(
CommonUtil
.
getParams
(
event
,
bundle
));
mEventSink
.
success
(
TX
CommonUtil
.
getParams
(
event
,
bundle
));
return
;
}
}
...
...
@@ -203,7 +203,7 @@ public class FTXVodPlayer extends FTXBasePlayer implements ITXVodPlayListener, F
if
(
event
!=
TXVodConstants
.
VOD_PLAY_EVT_PLAY_PROGRESS
)
{
Log
.
e
(
TAG
,
"onPlayEvent:"
+
event
+
","
+
bundle
.
getString
(
TXLiveConstants
.
EVT_DESCRIPTION
));
}
mEventSink
.
success
(
CommonUtil
.
getParams
(
event
,
bundle
));
mEventSink
.
success
(
TX
CommonUtil
.
getParams
(
event
,
bundle
));
}
// The default size of the surface is 1x1. When hardware decoding fails or software decoding is used,
...
...
@@ -220,7 +220,7 @@ public class FTXVodPlayer extends FTXBasePlayer implements ITXVodPlayListener, F
@Override
public
void
onNetStatus
(
TXVodPlayer
txVodPlayer
,
Bundle
bundle
)
{
mNetStatusSink
.
success
(
CommonUtil
.
getParams
(
0
,
bundle
));
mNetStatusSink
.
success
(
TX
CommonUtil
.
getParams
(
0
,
bundle
));
}
private
byte
[]
getPlayerImageSprite
(
final
Double
time
)
{
...
...
@@ -470,14 +470,14 @@ public class FTXVodPlayer extends FTXBasePlayer implements ITXVodPlayListener, F
@Override
public
IntMsg
initialize
(
@NonNull
BoolPlayerMsg
onlyAudio
)
{
long
textureId
=
init
(
onlyAudio
.
getValue
()
!=
null
?
onlyAudio
.
getValue
()
:
false
);
return
CommonUtil
.
intMsgWith
(
textureId
);
return
TX
CommonUtil
.
intMsgWith
(
textureId
);
}
@NonNull
@Override
public
BoolMsg
startVodPlay
(
@NonNull
StringPlayerMsg
url
)
{
String
urlStr
=
url
.
getValue
();
return
CommonUtil
.
boolMsgWith
(
startPlayerVodPlay
(
urlStr
)
==
1
);
return
TX
CommonUtil
.
boolMsgWith
(
startPlayerVodPlay
(
urlStr
)
==
1
);
}
@Override
...
...
@@ -499,13 +499,13 @@ public class FTXVodPlayer extends FTXBasePlayer implements ITXVodPlayListener, F
@Override
public
BoolMsg
stop
(
@NonNull
BoolPlayerMsg
isNeedClear
)
{
boolean
flag
=
null
!=
isNeedClear
.
getValue
()
?
isNeedClear
.
getValue
()
:
false
;
return
CommonUtil
.
boolMsgWith
(
stopPlay
(
flag
)
==
1
);
return
TX
CommonUtil
.
boolMsgWith
(
stopPlay
(
flag
)
==
1
);
}
@NonNull
@Override
public
BoolMsg
isPlaying
(
@NonNull
PlayerMsg
playerMsg
)
{
return
CommonUtil
.
boolMsgWith
(
isPlayerPlaying
());
return
TX
CommonUtil
.
boolMsgWith
(
isPlayerPlaying
());
}
@Override
...
...
@@ -550,13 +550,13 @@ public class FTXVodPlayer extends FTXBasePlayer implements ITXVodPlayListener, F
@Override
public
ListMsg
getSupportedBitrate
(
@NonNull
PlayerMsg
playerMsg
)
{
//noinspection unchecked
return
CommonUtil
.
listMsgWith
((
List
<
Object
>)
getPlayerSupportedBitrates
());
return
TX
CommonUtil
.
listMsgWith
((
List
<
Object
>)
getPlayerSupportedBitrates
());
}
@NonNull
@Override
public
IntMsg
getBitrateIndex
(
@NonNull
PlayerMsg
playerMsg
)
{
return
CommonUtil
.
intMsgWith
((
long
)
getPlayerBitrateIndex
());
return
TX
CommonUtil
.
intMsgWith
((
long
)
getPlayerBitrateIndex
());
}
@Override
...
...
@@ -584,9 +584,9 @@ public class FTXVodPlayer extends FTXBasePlayer implements ITXVodPlayListener, F
@Override
public
BoolMsg
setRequestAudioFocus
(
@NonNull
BoolPlayerMsg
focus
)
{
if
(
null
!=
focus
.
getValue
())
{
return
CommonUtil
.
boolMsgWith
(
requestPlayerAudioFocus
(
focus
.
getValue
()));
return
TX
CommonUtil
.
boolMsgWith
(
requestPlayerAudioFocus
(
focus
.
getValue
()));
}
return
CommonUtil
.
boolMsgWith
(
false
);
return
TX
CommonUtil
.
boolMsgWith
(
false
);
}
@Override
...
...
@@ -600,7 +600,7 @@ public class FTXVodPlayer extends FTXBasePlayer implements ITXVodPlayListener, F
// Use BigDecimal for conversion to prevent precision issues with decimal
// digits when converting from float to double.
BigDecimal
bigDecimal
=
BigDecimal
.
valueOf
(
getPlayerCurrentPlaybackTime
());
return
CommonUtil
.
doubleMsgWith
(
bigDecimal
.
doubleValue
());
return
TX
CommonUtil
.
doubleMsgWith
(
bigDecimal
.
doubleValue
());
}
@NonNull
...
...
@@ -609,7 +609,7 @@ public class FTXVodPlayer extends FTXBasePlayer implements ITXVodPlayListener, F
// Use BigDecimal for conversion to prevent precision issues with decimal
// digits when converting from float to double.
BigDecimal
bigDecimal
=
BigDecimal
.
valueOf
(
getPlayerBufferDuration
());
return
CommonUtil
.
doubleMsgWith
(
bigDecimal
.
doubleValue
());
return
TX
CommonUtil
.
doubleMsgWith
(
bigDecimal
.
doubleValue
());
}
@NonNull
...
...
@@ -618,19 +618,19 @@ public class FTXVodPlayer extends FTXBasePlayer implements ITXVodPlayListener, F
// Use BigDecimal for conversion to prevent precision issues with decimal
// digits when converting from float to double.
BigDecimal
bigDecimal
=
BigDecimal
.
valueOf
(
getPlayerPlayableDuration
());
return
CommonUtil
.
doubleMsgWith
(
bigDecimal
.
doubleValue
());
return
TX
CommonUtil
.
doubleMsgWith
(
bigDecimal
.
doubleValue
());
}
@NonNull
@Override
public
IntMsg
getWidth
(
@NonNull
PlayerMsg
playerMsg
)
{
return
CommonUtil
.
intMsgWith
((
long
)
getPlayerWidth
());
return
TX
CommonUtil
.
intMsgWith
((
long
)
getPlayerWidth
());
}
@NonNull
@Override
public
IntMsg
getHeight
(
@NonNull
PlayerMsg
playerMsg
)
{
return
CommonUtil
.
intMsgWith
((
long
)
getPlayerHeight
());
return
TX
CommonUtil
.
intMsgWith
((
long
)
getPlayerHeight
());
}
@Override
...
...
@@ -641,16 +641,16 @@ public class FTXVodPlayer extends FTXBasePlayer implements ITXVodPlayListener, F
@NonNull
@Override
public
BoolMsg
isLoop
(
@NonNull
PlayerMsg
playerMsg
)
{
return
CommonUtil
.
boolMsgWith
(
isVodPlayerLoop
());
return
TX
CommonUtil
.
boolMsgWith
(
isVodPlayerLoop
());
}
@NonNull
@Override
public
BoolMsg
enableHardwareDecode
(
@NonNull
BoolPlayerMsg
enable
)
{
if
(
null
!=
enable
.
getValue
())
{
return
CommonUtil
.
boolMsgWith
(
enablePlayerHardwareDecode
(
enable
.
getValue
()));
return
TX
CommonUtil
.
boolMsgWith
(
enablePlayerHardwareDecode
(
enable
.
getValue
()));
}
return
CommonUtil
.
boolMsgWith
(
false
);
return
TX
CommonUtil
.
boolMsgWith
(
false
);
}
@NonNull
...
...
@@ -673,7 +673,7 @@ public class FTXVodPlayer extends FTXBasePlayer implements ITXVodPlayListener, F
if
(
pipResult
==
FTXEvent
.
NO_ERROR
)
{
playerPause
();
}
return
CommonUtil
.
intMsgWith
((
long
)
pipResult
);
return
TX
CommonUtil
.
intMsgWith
((
long
)
pipResult
);
}
@Override
...
...
@@ -692,9 +692,9 @@ public class FTXVodPlayer extends FTXBasePlayer implements ITXVodPlayListener, F
@Override
public
UInt8ListMsg
getImageSprite
(
@NonNull
DoublePlayerMsg
time
)
{
if
(
null
!=
time
.
getValue
())
{
return
CommonUtil
.
uInt8ListMsg
(
getPlayerImageSprite
(
time
.
getValue
()));
return
TX
CommonUtil
.
uInt8ListMsg
(
getPlayerImageSprite
(
time
.
getValue
()));
}
return
CommonUtil
.
uInt8ListMsg
(
new
byte
[
0
]);
return
TX
CommonUtil
.
uInt8ListMsg
(
new
byte
[
0
]);
}
@NonNull
...
...
@@ -704,8 +704,8 @@ public class FTXVodPlayer extends FTXBasePlayer implements ITXVodPlayListener, F
// Use BigDecimal for conversion to prevent precision issues with decimal
// digits when converting from float to double.
BigDecimal
bigDecimal
=
BigDecimal
.
valueOf
(
mVodPlayer
.
getDuration
());
return
CommonUtil
.
doubleMsgWith
(
bigDecimal
.
doubleValue
());
return
TX
CommonUtil
.
doubleMsgWith
(
bigDecimal
.
doubleValue
());
}
return
CommonUtil
.
doubleMsgWith
(
0
D
);
return
TX
CommonUtil
.
doubleMsgWith
(
0
D
);
}
}
Flutter/android/src/main/java/com/tencent/vod/flutter/SuperPlayerPlugin.java
浏览文件 @
f626ddfc
...
...
@@ -25,6 +25,7 @@ import android.view.WindowManager;
import
androidx.annotation.NonNull
;
import
com.tencent.rtmp.TXLiveBase
;
import
com.tencent.rtmp.TXLiveBaseListener
;
import
com.tencent.rtmp.TXPlayerGlobalSetting
;
import
com.tencent.vod.flutter.messages.FTXLivePlayerDispatcher
;
import
com.tencent.vod.flutter.messages.FTXVodPlayerDispatcher
;
...
...
@@ -38,14 +39,16 @@ import com.tencent.vod.flutter.messages.FtxMessages.TXFlutterLivePlayerApi;
import
com.tencent.vod.flutter.messages.FtxMessages.TXFlutterNativeAPI
;
import
com.tencent.vod.flutter.messages.FtxMessages.TXFlutterSuperPlayerPluginAPI
;
import
com.tencent.vod.flutter.messages.FtxMessages.TXFlutterVodPlayerApi
;
import
com.tencent.vod.flutter.tools.CommonUtil
;
import
com.tencent.vod.flutter.tools.
TX
CommonUtil
;
import
com.tencent.vod.flutter.tools.TXFlutterEngineHolder
;
import
com.tencent.vod.flutter.ui.Android12BridgeService
;
import
com.tencent.vod.flutter.ui.
TX
Android12BridgeService
;
import
java.io.File
;
import
java.math.BigDecimal
;
import
java.util.ArrayList
;
import
java.util.Collection
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Set
;
...
...
@@ -84,8 +87,8 @@ public class SuperPlayerPlugin implements FlutterPlugin, ActivityAware,
private
OrientationEventListener
mOrientationManager
;
private
int
mCurrentOrientation
=
FTXEvent
.
ORIENTATION_PORTRAIT_UP
;
private
final
TXFlutterEngineHolder
mEngineHolder
=
new
TXFlutterEngineHolder
();
private
boolean
mIsBrightnessObserverRegistered
=
false
;
private
Handler
mMainHandler
=
new
Handler
(
Looper
.
getMainLooper
());
private
final
FTXAudioManager
.
AudioFocusChangeListener
audioFocusChangeListener
=
new
FTXAudioManager
.
AudioFocusChangeListener
()
{
...
...
@@ -108,6 +111,70 @@ public class SuperPlayerPlugin implements FlutterPlugin, ActivityAware,
}
};
private
final
TXLiveBaseListener
mSDKEvent
=
new
TXLiveBaseListener
()
{
@Override
public
void
onLog
(
int
level
,
String
module
,
String
log
)
{
super
.
onLog
(
level
,
module
,
log
);
// mMainHandler.post(new Runnable() {
// @Override
// public void run() {
// Bundle params = new Bundle();
// params.putInt(FTXEvent.EVENT_LOG_LEVEL, level);
// params.putString(FTXEvent.EVENT_LOG_MODULE, module);
// params.putString(FTXEvent.EVENT_LOG_MSG, log);
// mEventSink.success(getParams(FTXEvent.EVENT_ON_LOG, params));
// }
// });
// this may be too busy, so currently do not throw on the Flutter side
}
@Override
public
void
onUpdateNetworkTime
(
int
errCode
,
String
errMsg
)
{
super
.
onUpdateNetworkTime
(
errCode
,
errMsg
);
// mMainHandler.post(new Runnable() {
// @Override
// public void run() {
// Bundle params = new Bundle();
// params.putInt(FTXEvent.EVENT_ERR_CODE, errCode);
// params.putString(FTXEvent.EVENT_ERR_MSG, errMsg);
// mEventSink.success(getParams(FTXEvent.EVENT_ON_UPDATE_NETWORK_TIME, params));
// }
// });
// This will be opened in a subsequent version
}
@Override
public
void
onLicenceLoaded
(
int
result
,
String
reason
)
{
super
.
onLicenceLoaded
(
result
,
reason
);
mMainHandler
.
post
(
new
Runnable
()
{
@Override
public
void
run
()
{
Bundle
params
=
new
Bundle
();
params
.
putInt
(
FTXEvent
.
EVENT_RESULT
,
result
);
params
.
putString
(
FTXEvent
.
EVENT_REASON
,
reason
);
mEventSink
.
success
(
getParams
(
FTXEvent
.
EVENT_ON_LICENCE_LOADED
,
params
));
}
});
}
@Override
public
void
onCustomHttpDNS
(
String
hostName
,
List
<
String
>
ipList
)
{
super
.
onCustomHttpDNS
(
hostName
,
ipList
);
// mMainHandler.post(new Runnable() {
// @Override
// public void run() {
// Bundle params = new Bundle();
// params.putString(FTXEvent.EVENT_HOST_NAME, hostName);
// ArrayList<String> ipArrayList = new ArrayList<>(ipList);
// params.putStringArrayList(FTXEvent.EVENT_IPS, ipArrayList);
// mEventSink.success(getParams(FTXEvent.EVENT_ON_CUSTOM_HTTP_DNS, params));
// }
// });
// This will be opened in a subsequent version
}
};
@Override
public
void
onAttachedToEngine
(
@NonNull
FlutterPluginBinding
flutterPluginBinding
)
{
Log
.
i
(
TAG
,
"onAttachedToEngine"
);
...
...
@@ -346,7 +413,7 @@ public class SuperPlayerPlugin implements FlutterPlugin, ActivityAware,
if
(
null
!=
mActivityPluginBinding
&&
!
mActivityPluginBinding
.
getActivity
().
isDestroyed
())
{
ContentResolver
resolver
=
mActivityPluginBinding
.
getActivity
().
getContentResolver
();
final
int
brightnessInt
=
Settings
.
System
.
getInt
(
resolver
,
Settings
.
System
.
SCREEN_BRIGHTNESS
);
final
float
maxBrightness
=
CommonUtil
.
getBrightnessMax
();
final
float
maxBrightness
=
TX
CommonUtil
.
getBrightnessMax
();
screenBrightness
=
brightnessInt
/
maxBrightness
;
}
}
catch
(
SettingNotFoundException
e
)
{
...
...
@@ -390,6 +457,8 @@ public class SuperPlayerPlugin implements FlutterPlugin, ActivityAware,
initPipManagerIfNeed
();
registerReceiver
();
mEngineHolder
.
attachBindLife
(
binding
);
TXLiveBase
.
enableCustomHttpDNS
(
true
);
TXLiveBase
.
setListener
(
mSDKEvent
);
}
@Override
...
...
@@ -408,10 +477,11 @@ public class SuperPlayerPlugin implements FlutterPlugin, ActivityAware,
// Close the solution to the problem of the picture-in-picture click restore
// failure on some versions of Android 12.
// 关闭用于解决Android12部分版本上画中画点击还原失灵的问题
Intent
serviceIntent
=
new
Intent
(
mActivityPluginBinding
.
getActivity
(),
Android12BridgeService
.
class
);
Intent
serviceIntent
=
new
Intent
(
mActivityPluginBinding
.
getActivity
(),
TX
Android12BridgeService
.
class
);
mActivityPluginBinding
.
getActivity
().
stopService
(
serviceIntent
);
unregisterReceiver
();
mEngineHolder
.
destroy
(
mActivityPluginBinding
);
TXLiveBase
.
setListener
(
null
);
}
void
onHandleAudioFocusPause
()
{
...
...
Flutter/android/src/main/java/com/tencent/vod/flutter/messages/FTXLivePlayerDispatcher.java
浏览文件 @
f626ddfc
...
...
@@ -19,9 +19,9 @@ import com.tencent.vod.flutter.messages.FtxMessages.TXFlutterLivePlayerApi;
@SuppressWarnings
(
"ConstantConditions"
)
public
class
FTXLivePlayerDispatcher
implements
FtxMessages
.
TXFlutterLivePlayerApi
{
final
IPlayersBridge
bridge
;
final
I
TX
PlayersBridge
bridge
;
public
FTXLivePlayerDispatcher
(
@NonNull
IPlayersBridge
dataBridge
)
{
public
FTXLivePlayerDispatcher
(
@NonNull
I
TX
PlayersBridge
dataBridge
)
{
this
.
bridge
=
dataBridge
;
}
...
...
Flutter/android/src/main/java/com/tencent/vod/flutter/messages/FTXVodPlayerDispatcher.java
浏览文件 @
f626ddfc
...
...
@@ -28,9 +28,9 @@ import com.tencent.vod.flutter.messages.FtxMessages.UInt8ListMsg;
@SuppressWarnings
(
"ConstantConditions"
)
public
class
FTXVodPlayerDispatcher
implements
FtxMessages
.
TXFlutterVodPlayerApi
{
final
IPlayersBridge
bridge
;
final
I
TX
PlayersBridge
bridge
;
public
FTXVodPlayerDispatcher
(
@NonNull
IPlayersBridge
dataBridge
)
{
public
FTXVodPlayerDispatcher
(
@NonNull
I
TX
PlayersBridge
dataBridge
)
{
this
.
bridge
=
dataBridge
;
}
...
...
Flutter/android/src/main/java/com/tencent/vod/flutter/messages/IPlayersBridge.java
→
Flutter/android/src/main/java/com/tencent/vod/flutter/messages/I
TX
PlayersBridge.java
浏览文件 @
f626ddfc
...
...
@@ -5,7 +5,7 @@ package com.tencent.vod.flutter.messages;
import
android.util.SparseArray
;
import
com.tencent.vod.flutter.FTXBasePlayer
;
public
interface
IPlayersBridge
{
public
interface
I
TX
PlayersBridge
{
/**
* Get player list.
...
...
Flutter/android/src/main/java/com/tencent/vod/flutter/model/PipResult.java
→
Flutter/android/src/main/java/com/tencent/vod/flutter/model/
TX
PipResult.java
浏览文件 @
f626ddfc
...
...
@@ -3,14 +3,14 @@ package com.tencent.vod.flutter.model;
import
android.os.Parcel
;
import
android.os.Parcelable
;
public
class
PipResult
implements
Parcelable
{
public
class
TX
PipResult
implements
Parcelable
{
private
Float
mPlayTime
;
private
boolean
mIsPlaying
;
private
int
mPlayerId
;
public
PipResult
(){}
public
TX
PipResult
(){}
protected
PipResult
(
Parcel
in
)
{
protected
TX
PipResult
(
Parcel
in
)
{
if
(
in
.
readByte
()
==
0
)
{
mPlayTime
=
null
;
}
else
{
...
...
@@ -20,15 +20,15 @@ public class PipResult implements Parcelable {
mPlayerId
=
in
.
readInt
();
}
public
static
final
Creator
<
PipResult
>
CREATOR
=
new
Creator
<
PipResult
>()
{
public
static
final
Creator
<
TXPipResult
>
CREATOR
=
new
Creator
<
TX
PipResult
>()
{
@Override
public
PipResult
createFromParcel
(
Parcel
in
)
{
return
new
PipResult
(
in
);
public
TX
PipResult
createFromParcel
(
Parcel
in
)
{
return
new
TX
PipResult
(
in
);
}
@Override
public
PipResult
[]
newArray
(
int
size
)
{
return
new
PipResult
[
size
];
public
TX
PipResult
[]
newArray
(
int
size
)
{
return
new
TX
PipResult
[
size
];
}
};
...
...
Flutter/android/src/main/java/com/tencent/vod/flutter/model/VideoModel.java
→
Flutter/android/src/main/java/com/tencent/vod/flutter/model/
TX
VideoModel.java
浏览文件 @
f626ddfc
...
...
@@ -12,7 +12,7 @@ import com.tencent.vod.flutter.FTXEvent;
*
* 视频model
*/
public
class
VideoModel
implements
Parcelable
{
public
class
TX
VideoModel
implements
Parcelable
{
private
String
videoUrl
;
private
int
appId
;
...
...
@@ -22,9 +22,9 @@ public class VideoModel implements Parcelable {
private
int
mLiveType
=
TXLivePlayer
.
PLAY_TYPE_LIVE_FLV
;
private
String
mToken
;
public
VideoModel
()
{}
public
TX
VideoModel
()
{}
protected
VideoModel
(
Parcel
in
)
{
protected
TX
VideoModel
(
Parcel
in
)
{
videoUrl
=
in
.
readString
();
appId
=
in
.
readInt
();
fileId
=
in
.
readString
();
...
...
@@ -34,15 +34,15 @@ public class VideoModel implements Parcelable {
mToken
=
in
.
readString
();
}
public
static
final
Creator
<
VideoModel
>
CREATOR
=
new
Creator
<
VideoModel
>()
{
public
static
final
Creator
<
TXVideoModel
>
CREATOR
=
new
Creator
<
TX
VideoModel
>()
{
@Override
public
VideoModel
createFromParcel
(
Parcel
in
)
{
return
new
VideoModel
(
in
);
public
TX
VideoModel
createFromParcel
(
Parcel
in
)
{
return
new
TX
VideoModel
(
in
);
}
@Override
public
VideoModel
[]
newArray
(
int
size
)
{
return
new
VideoModel
[
size
];
public
TX
VideoModel
[]
newArray
(
int
size
)
{
return
new
TX
VideoModel
[
size
];
}
};
...
...
Flutter/android/src/main/java/com/tencent/vod/flutter/tools/CommonUtil.java
→
Flutter/android/src/main/java/com/tencent/vod/flutter/tools/
TX
CommonUtil.java
浏览文件 @
f626ddfc
...
...
@@ -18,9 +18,6 @@ import com.tencent.vod.flutter.messages.FtxMessages.PlayerMsg;
import
com.tencent.vod.flutter.messages.FtxMessages.StringMsg
;
import
com.tencent.vod.flutter.messages.FtxMessages.UInt8ListMsg
;
import
java.io.BufferedReader
;
import
java.io.IOException
;
import
java.io.InputStreamReader
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
...
...
@@ -31,9 +28,9 @@ import java.util.Set;
* <p>
* 通用工具类
*/
public
class
CommonUtil
{
public
class
TX
CommonUtil
{
private
static
final
String
TAG
=
"CommonUtil"
;
private
static
final
String
TAG
=
"
TX
CommonUtil"
;
private
static
final
String
KEY_MAX_BRIGHTNESS
=
"max_brightness"
;
private
static
final
String
KEY_IS_MIUI
=
"is_miui"
;
...
...
@@ -73,7 +70,7 @@ public class CommonUtil {
}
catch
(
Exception
e
)
{
Log
.
getStackTraceString
(
e
);
}
if
(
CommonUtil
.
isMIUI
()
&&
Build
.
VERSION
.
SDK_INT
>=
33
)
{
if
(
TX
CommonUtil
.
isMIUI
()
&&
Build
.
VERSION
.
SDK_INT
>=
33
)
{
maxBrightness
=
128
F
;
}
CACHE_MAP
.
put
(
KEY_MAX_BRIGHTNESS
,
maxBrightness
);
...
...
Flutter/android/src/main/java/com/tencent/vod/flutter/ui/FlutterPipImplActivity.java
浏览文件 @
f626ddfc
...
...
@@ -36,12 +36,13 @@ import com.tencent.rtmp.ITXVodPlayListener;
import
com.tencent.rtmp.TXLiveConstants
;
import
com.tencent.rtmp.TXLivePlayer
;
import
com.tencent.rtmp.TXPlayInfoParams
;
import
com.tencent.rtmp.TXVodPlayConfig
;
import
com.tencent.rtmp.TXVodPlayer
;
import
com.tencent.vod.flutter.FTXEvent
;
import
com.tencent.vod.flutter.FTXPIPManager.PipParams
;
import
com.tencent.vod.flutter.R
;
import
com.tencent.vod.flutter.model.PipResult
;
import
com.tencent.vod.flutter.model.VideoModel
;
import
com.tencent.vod.flutter.model.
TX
PipResult
;
import
com.tencent.vod.flutter.model.
TX
VideoModel
;
import
java.util.List
;
import
java.util.Set
;
...
...
@@ -75,7 +76,7 @@ public class FlutterPipImplActivity extends Activity implements Callback, ITXVod
// In picture-in-picture mode, clicking the X in the upper right corner will trigger `onStop` first.
// Clicking the zoom button will not trigger `onStop`.
private
boolean
mIsNeedToStop
=
false
;
private
VideoModel
mVideoModel
;
private
TX
VideoModel
mVideoModel
;
private
boolean
mIsRegisterReceiver
=
false
;
private
PipParams
mCurrentParams
;
private
Handler
mMainHandler
;
...
...
@@ -138,6 +139,8 @@ public class FlutterPipImplActivity extends Activity implements Callback, ITXVod
}
private
void
setVodPlayerListener
()
{
// set default config
mVodPlayer
.
setConfig
(
new
TXVodPlayConfig
());
mVodPlayer
.
setVodListener
(
this
);
}
...
...
@@ -245,7 +248,7 @@ public class FlutterPipImplActivity extends Activity implements Callback, ITXVod
private
void
handlePipExitEvent
()
{
Bundle
data
=
new
Bundle
();
PipResult
pipResult
=
new
PipResult
();
TXPipResult
pipResult
=
new
TX
PipResult
();
if
(
mVideoModel
.
getPlayerType
()
==
FTXEvent
.
PLAYER_VOD
)
{
Float
currentPlayTime
=
mVodPlayer
.
getCurrentPlaybackTime
();
pipResult
.
setPlayTime
(
currentPlayTime
);
...
...
@@ -354,7 +357,7 @@ public class FlutterPipImplActivity extends Activity implements Callback, ITXVod
}
private
void
startPipVideoFromIntent
(
Intent
intent
)
{
mVideoModel
=
(
VideoModel
)
intent
.
getParcelableExtra
(
FTXEvent
.
EXTRA_NAME_VIDEO
);
mVideoModel
=
(
TX
VideoModel
)
intent
.
getParcelableExtra
(
FTXEvent
.
EXTRA_NAME_VIDEO
);
if
(
mIsSurfaceCreated
)
{
attachSurface
(
mVideoSurface
.
getHolder
().
getSurface
());
startPlay
();
...
...
@@ -434,7 +437,7 @@ public class FlutterPipImplActivity extends Activity implements Callback, ITXVod
private
void
bindAndroid12BugServiceIfNeed
()
{
if
(
Build
.
VERSION
.
SDK_INT
>=
VERSION_CODES
.
S
)
{
Intent
serviceIntent
=
new
Intent
(
this
,
Android12BridgeService
.
class
);
Intent
serviceIntent
=
new
Intent
(
this
,
TX
Android12BridgeService
.
class
);
startService
(
serviceIntent
);
bindService
(
serviceIntent
,
this
,
Context
.
BIND_AUTO_CREATE
);
}
...
...
Flutter/android/src/main/java/com/tencent/vod/flutter/ui/Android12BridgeService.java
→
Flutter/android/src/main/java/com/tencent/vod/flutter/ui/
TX
Android12BridgeService.java
浏览文件 @
f626ddfc
...
...
@@ -15,7 +15,7 @@ import androidx.annotation.Nullable;
* 为了解决多次打开画中画的时候,启动画中画被认为是后台启动,导致无法启动的问题。
* 该问题出现于android 12版本上,目前只在MIUI的android 12版本上发现该问题。
*/
public
class
Android12BridgeService
extends
Service
{
public
class
TX
Android12BridgeService
extends
Service
{
@Nullable
@Override
...
...
@@ -24,8 +24,8 @@ public class Android12BridgeService extends Service {
}
class
Android12BridgeServiceBinder
extends
Binder
{
public
Android12BridgeService
getService
()
{
return
Android12BridgeService
.
this
;
public
TX
Android12BridgeService
getService
()
{
return
TX
Android12BridgeService
.
this
;
}
}
}
Flutter/ios/Classes/FTXDownloadManager.m
浏览文件 @
f626ddfc
...
...
@@ -7,9 +7,9 @@
#import <TXLiteAVSDK_Professional/TXVodPreloadManager.h>
#import <TXLiteAVSDK_Professional/TXVodDownloadManager.h>
#import "FTXEvent.h"
#import "CommonUtil.h"
#import "
TX
CommonUtil.h"
#import "FtxMessages.h"
#import "PredownloadFileHelperDelegate.h"
#import "
TX
PredownloadFileHelperDelegate.h"
@interface
FTXDownloadManager
()
<
FlutterStreamHandler
,
TXVodPreloadManagerDelegate
,
TXVodDownloadDelegate
,
TXFlutterDownloadApi
>
...
...
@@ -71,13 +71,13 @@
[
_eventSink
success
:[
FTXDownloadManager
getParamsWithEvent
:
EVENT_PREDOWNLOAD_ON_ERROR
withParams
:
dict
]];
}
-
(
void
)
removePreDelegate
:
(
PredownloadFileHelperDelegate
*
)
delegate
{
-
(
void
)
removePreDelegate
:
(
TX
PredownloadFileHelperDelegate
*
)
delegate
{
@synchronized
(
self
.
delegateArray
)
{
[
self
.
delegateArray
removeObject
:
delegate
];
}
}
-
(
void
)
addPreDelegate
:
(
PredownloadFileHelperDelegate
*
)
delegate
{
-
(
void
)
addPreDelegate
:
(
TX
PredownloadFileHelperDelegate
*
)
delegate
{
@synchronized
(
self
.
delegateArray
)
{
if
(
!
[
self
.
delegateArray
containsObject
:
delegate
])
{
[
self
.
delegateArray
addObject
:
delegate
];
...
...
@@ -168,7 +168,7 @@
if
(
nil
!=
info
)
{
[
dict
setValue
:
info
.
playPath
forKey
:
@"playPath"
];
[
dict
setValue
:
@
(
info
.
progress
)
forKey
:
@"progress"
];
[
dict
setValue
:[
CommonUtil
getDownloadEventByState
:(
int
)
info
.
downloadState
]
forKey
:
@"downloadState"
];
[
dict
setValue
:[
TX
CommonUtil
getDownloadEventByState
:(
int
)
info
.
downloadState
]
forKey
:
@"downloadState"
];
[
dict
setValue
:
info
.
userName
forKey
:
@"userName"
];
[
dict
setValue
:
@
(
info
.
duration
)
forKey
:
@"duration"
];
[
dict
setValue
:
@
(
info
.
playableDuration
)
forKey
:
@"playableDuration"
];
...
...
@@ -196,7 +196,7 @@
if
(
nil
!=
info
)
{
msg
.
playPath
=
info
.
playPath
;
msg
.
progress
=
@
(
info
.
progress
);
msg
.
downloadState
=
[
CommonUtil
getDownloadEventByState
:(
int
)
info
.
downloadState
];
msg
.
downloadState
=
[
TX
CommonUtil
getDownloadEventByState
:(
int
)
info
.
downloadState
];
msg
.
userName
=
info
.
userName
;
msg
.
duration
=
@
(
info
.
duration
);
msg
.
playableDuration
=
@
(
info
.
playableDuration
);
...
...
@@ -266,7 +266,7 @@
-
(
nullable
BoolMsg
*
)
deleteDownloadMediaInfoMsg
:
(
nonnull
TXVodDownloadMediaMsg
*
)
msg
error
:
(
FlutterError
*
_Nullable
__autoreleasing
*
_Nonnull
)
error
{
TXVodDownloadMediaInfo
*
mediaInfo
=
[
self
parseMediaInfoFromInfo
:
msg
.
quality
url
:
msg
.
url
appId
:
msg
.
appId
fileId
:
msg
.
fileId
name
:
msg
.
userName
];
BOOL
deleteResult
=
[[
TXVodDownloadManager
shareInstance
]
deleteDownloadMediaInfo
:
mediaInfo
];
return
[
CommonUtil
boolMsgWith
:
deleteResult
];
return
[
TX
CommonUtil
boolMsgWith
:
deleteResult
];
}
-
(
nullable
TXVodDownloadMediaMsg
*
)
getDownloadInfoMsg
:
(
nonnull
TXVodDownloadMediaMsg
*
)
msg
error
:
(
FlutterError
*
_Nullable
__autoreleasing
*
_Nonnull
)
error
{
...
...
@@ -326,7 +326,7 @@
preloadSize
:
preloadSizeMB
preferredResolution
:
preferredResolution
delegate
:
self
];
return
[
CommonUtil
intMsgWith
:
@
(
taskID
)];
return
[
TX
CommonUtil
intMsgWith
:
@
(
taskID
)];
}
-
(
void
)
stopDownloadMsg
:
(
nonnull
TXVodDownloadMediaMsg
*
)
msg
error
:
(
FlutterError
*
_Nullable
__autoreleasing
*
_Nonnull
)
error
{
...
...
@@ -350,7 +350,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
:
@""
;
__block
PredownloadFileHelperDelegate
*
delegate
=
[[
PredownloadFileHelperDelegate
alloc
]
initWithBlock
:
tmpTaskId
start
:
^
(
long
tmpTaskId
,
int
taskID
,
NSString
*
_Nonnull
fileId
,
NSString
*
_Nonnull
url
,
NSDictionary
*
_Nonnull
param
)
{
__block
TXPredownloadFileHelperDelegate
*
delegate
=
[[
TX
PredownloadFileHelperDelegate
alloc
]
initWithBlock
:
tmpTaskId
start
:
^
(
long
tmpTaskId
,
int
taskID
,
NSString
*
_Nonnull
fileId
,
NSString
*
_Nonnull
url
,
NSDictionary
*
_Nonnull
param
)
{
[
self
onStartEvent
:
tmpTaskId
taskID
:
taskID
fileId
:
fileId
url
:
url
param
:
param
];
}
complete
:^
(
int
taskID
,
NSString
*
_Nonnull
url
)
{
[
self
onComplete
:
taskID
url
:
url
];
...
...
Flutter/ios/Classes/FTXEvent.h
浏览文件 @
f626ddfc
...
...
@@ -92,4 +92,25 @@
// 横屏,底部在左
#define ORIENTATION_LANDSCAPE_LEFT 414
// SDK event
// onLog
#define EVENT_ON_LOG 501
// onUpdateNetworkTime
#define EVENT_ON_UPDATE_NETWORK_TIME 502
// onLicenceLoaded
#define EVENT_ON_LICENCE_LOADED 503
// onCustomHttpDNS
#define EVENT_ON_CUSTOM_HTTP_DNS 504
// this events may be common,so remove the specific field identifier
#define EVENT_LOG_LEVEL "logLevel"
#define EVENT_LOG_MODULE "logModule"
#define EVENT_LOG_MSG "logMsg"
#define EVENT_ERR_CODE "errCode"
#define EVENT_ERR_MSG "errMsg"
#define EVENT_RESULT "result"
#define EVENT_REASON "reason"
#define EVENT_HOST_NAME "hostName"
#define EVENT_IPS "ips"
#endif // SUPERPLAYER_FLUTTER_IOS_CLASSES_FTXEVENT_H_
Flutter/ios/Classes/FTXLivePlayer.m
浏览文件 @
f626ddfc
...
...
@@ -8,7 +8,7 @@
#import <stdatomic.h>
#import <libkern/OSAtomic.h>
#import "FtxMessages.h"
#import "CommonUtil.h"
#import "
TX
CommonUtil.h"
static
const
int
uninitialized
=
-
1
;
...
...
@@ -359,7 +359,7 @@ static const int uninitialized = -1;
-
(
nullable
BoolMsg
*
)
enableHardwareDecodeEnable
:
(
nonnull
BoolPlayerMsg
*
)
enable
error
:
(
FlutterError
*
_Nullable
__autoreleasing
*
_Nonnull
)
error
{
int
r
=
[
self
enableHardwareDecode
:
enable
.
value
];
return
[
CommonUtil
boolMsgWith
:
r
];
return
[
TX
CommonUtil
boolMsgWith
:
r
];
}
-
(
nullable
IntMsg
*
)
enterPictureInPictureModePipParamsMsg
:
(
nonnull
PipParamsPlayerMsg
*
)
pipParamsMsg
error
:
(
FlutterError
*
_Nullable
__autoreleasing
*
_Nonnull
)
error
{
...
...
@@ -373,11 +373,11 @@ static const int uninitialized = -1;
-
(
nullable
IntMsg
*
)
initializeOnlyAudio
:
(
nonnull
BoolPlayerMsg
*
)
onlyAudio
error
:
(
FlutterError
*
_Nullable
__autoreleasing
*
_Nonnull
)
error
{
NSNumber
*
textureId
=
[
self
createPlayer
:
onlyAudio
.
value
.
boolValue
];
return
[
CommonUtil
intMsgWith
:
textureId
];
return
[
TX
CommonUtil
intMsgWith
:
textureId
];
}
-
(
nullable
BoolMsg
*
)
isPlayingPlayerMsg
:
(
nonnull
PlayerMsg
*
)
playerMsg
error
:
(
FlutterError
*
_Nullable
__autoreleasing
*
_Nonnull
)
error
{
return
[
CommonUtil
boolMsgWith
:[
self
isPlaying
]];
return
[
TX
CommonUtil
boolMsgWith
:[
self
isPlaying
]];
}
-
(
void
)
pausePlayerMsg
:
(
nonnull
PlayerMsg
*
)
playerMsg
error
:
(
FlutterError
*
_Nullable
__autoreleasing
*
_Nonnull
)
error
{
...
...
@@ -418,16 +418,16 @@ static const int uninitialized = -1;
-
(
nullable
BoolMsg
*
)
startLivePlayPlayerMsg
:
(
nonnull
StringIntPlayerMsg
*
)
playerMsg
error
:
(
FlutterError
*
_Nullable
__autoreleasing
*
_Nonnull
)
error
{
int
r
=
[
self
startLivePlay
:
playerMsg
.
strValue
type
:
playerMsg
.
intValue
.
intValue
];
return
[
CommonUtil
boolMsgWith
:
r
];
return
[
TX
CommonUtil
boolMsgWith
:
r
];
}
-
(
nullable
BoolMsg
*
)
stopIsNeedClear
:
(
nonnull
BoolPlayerMsg
*
)
isNeedClear
error
:
(
FlutterError
*
_Nullable
__autoreleasing
*
_Nonnull
)
error
{
return
[
CommonUtil
boolMsgWith
:[
self
stopPlay
]];
return
[
TX
CommonUtil
boolMsgWith
:[
self
stopPlay
]];
}
-
(
nullable
IntMsg
*
)
switchStreamUrl
:
(
nonnull
StringPlayerMsg
*
)
url
error
:
(
FlutterError
*
_Nullable
__autoreleasing
*
_Nonnull
)
error
{
int
r
=
[
self
switchStream
:
url
.
value
];
return
[
CommonUtil
intMsgWith
:
@
(
r
)];
return
[
TX
CommonUtil
intMsgWith
:
@
(
r
)];
}
@end
Flutter/ios/Classes/FTXVodPlayer.m
浏览文件 @
f626ddfc
...
...
@@ -10,7 +10,7 @@
#import <AVKit/AVKit.h>
#import "FTXEvent.h"
#import "FtxMessages.h"
#import "CommonUtil.h"
#import "
TX
CommonUtil.h"
static
const
int
uninitialized
=
-
1
;
static
const
int
CODE_ON_RECEIVE_FIRST_FRAME
=
2003
;
...
...
@@ -816,12 +816,12 @@ BOOL CGImageRefContainsAlpha(CGImageRef imageRef) {
-
(
nullable
BoolMsg
*
)
enableHardwareDecodeEnable
:
(
nonnull
BoolPlayerMsg
*
)
enable
error
:
(
FlutterError
*
_Nullable
__autoreleasing
*
_Nonnull
)
error
{
bool
res
=
[
self
enableHardwareDecode
:
enable
.
value
];
return
[
CommonUtil
boolMsgWith
:
res
];
return
[
TX
CommonUtil
boolMsgWith
:
res
];
}
-
(
nullable
IntMsg
*
)
enterPictureInPictureModePipParamsMsg
:
(
nonnull
PipParamsPlayerMsg
*
)
pipParamsMsg
error
:
(
FlutterError
*
_Nullable
__autoreleasing
*
_Nonnull
)
error
{
int
res
=
[
self
enterPictureInPictureMode
];
return
[
CommonUtil
intMsgWith
:
@
(
res
)];
return
[
TX
CommonUtil
intMsgWith
:
@
(
res
)];
}
-
(
void
)
exitPictureInPictureModePlayerMsg
:
(
nonnull
PlayerMsg
*
)
playerMsg
error
:
(
FlutterError
*
_Nullable
__autoreleasing
*
_Nonnull
)
error
{
...
...
@@ -832,7 +832,7 @@ BOOL CGImageRefContainsAlpha(CGImageRef imageRef) {
-
(
nullable
IntMsg
*
)
getBitrateIndexPlayerMsg
:
(
nonnull
PlayerMsg
*
)
playerMsg
error
:
(
FlutterError
*
_Nullable
__autoreleasing
*
_Nonnull
)
error
{
long
index
=
[
self
getBitrateIndex
];
return
[
CommonUtil
intMsgWith
:
@
(
index
)];
return
[
TX
CommonUtil
intMsgWith
:
@
(
index
)];
}
-
(
nullable
DoubleMsg
*
)
getBufferDurationPlayerMsg
:
(
nonnull
PlayerMsg
*
)
playerMsg
error
:
(
FlutterError
*
_Nullable
__autoreleasing
*
_Nonnull
)
error
{
...
...
@@ -842,27 +842,27 @@ BOOL CGImageRefContainsAlpha(CGImageRef imageRef) {
-
(
nullable
DoubleMsg
*
)
getCurrentPlaybackTimePlayerMsg
:
(
nonnull
PlayerMsg
*
)
playerMsg
error
:
(
FlutterError
*
_Nullable
__autoreleasing
*
_Nonnull
)
error
{
float
time
=
[
self
getCurrentPlaybackTime
];
return
[
CommonUtil
doubleMsgWith
:
time
];
return
[
TX
CommonUtil
doubleMsgWith
:
time
];
}
-
(
nullable
DoubleMsg
*
)
getDurationPlayerMsg
:
(
nonnull
PlayerMsg
*
)
playerMsg
error
:
(
FlutterError
*
_Nullable
__autoreleasing
*
_Nonnull
)
error
{
float
time
=
[
self
getDuration
];
return
[
CommonUtil
doubleMsgWith
:
time
];
return
[
TX
CommonUtil
doubleMsgWith
:
time
];
}
-
(
nullable
IntMsg
*
)
getHeightPlayerMsg
:
(
nonnull
PlayerMsg
*
)
playerMsg
error
:
(
FlutterError
*
_Nullable
__autoreleasing
*
_Nonnull
)
error
{
int
height
=
[
self
getHeight
];
return
[
CommonUtil
intMsgWith
:
@
(
height
)];
return
[
TX
CommonUtil
intMsgWith
:
@
(
height
)];
}
-
(
nullable
UInt8ListMsg
*
)
getImageSpriteTime
:
(
nonnull
DoublePlayerMsg
*
)
time
error
:
(
FlutterError
*
_Nullable
__autoreleasing
*
_Nonnull
)
error
{
NSData
*
data
=
[
self
getPlayerImageSprite
:
time
.
value
];
return
[
CommonUtil
uInt8MsgWith
:
data
];
return
[
TX
CommonUtil
uInt8MsgWith
:
data
];
}
-
(
nullable
DoubleMsg
*
)
getPlayableDurationPlayerMsg
:
(
nonnull
PlayerMsg
*
)
playerMsg
error
:
(
FlutterError
*
_Nullable
__autoreleasing
*
_Nonnull
)
error
{
float
time
=
[
self
getPlayableDuration
];
return
[
CommonUtil
doubleMsgWith
:
time
];
return
[
TX
CommonUtil
doubleMsgWith
:
time
];
}
-
(
nullable
ListMsg
*
)
getSupportedBitratePlayerMsg
:
(
nonnull
PlayerMsg
*
)
playerMsg
error
:
(
FlutterError
*
_Nullable
__autoreleasing
*
_Nonnull
)
error
{
...
...
@@ -874,7 +874,7 @@ BOOL CGImageRefContainsAlpha(CGImageRef imageRef) {
-
(
nullable
IntMsg
*
)
getWidthPlayerMsg
:
(
nonnull
PlayerMsg
*
)
playerMsg
error
:
(
FlutterError
*
_Nullable
__autoreleasing
*
_Nonnull
)
error
{
int
width
=
[
self
getWidth
];
return
[
CommonUtil
intMsgWith
:
@
(
width
)];
return
[
TX
CommonUtil
intMsgWith
:
@
(
width
)];
}
-
(
void
)
initImageSpriteSpriteInfo
:
(
nonnull
StringListPlayerMsg
*
)
spriteInfo
error
:
(
FlutterError
*
_Nullable
__autoreleasing
*
_Nonnull
)
error
{
...
...
@@ -883,15 +883,15 @@ BOOL CGImageRefContainsAlpha(CGImageRef imageRef) {
-
(
nullable
IntMsg
*
)
initializeOnlyAudio
:
(
nonnull
BoolPlayerMsg
*
)
onlyAudio
error
:
(
FlutterError
*
_Nullable
__autoreleasing
*
_Nonnull
)
error
{
NSNumber
*
textureId
=
[
self
createPlayer
:
onlyAudio
.
value
.
boolValue
];
return
[
CommonUtil
intMsgWith
:
textureId
];
return
[
TX
CommonUtil
intMsgWith
:
textureId
];
}
-
(
nullable
BoolMsg
*
)
isLoopPlayerMsg
:
(
nonnull
PlayerMsg
*
)
playerMsg
error
:
(
FlutterError
*
_Nullable
__autoreleasing
*
_Nonnull
)
error
{
return
[
CommonUtil
boolMsgWith
:[
self
isLoop
]];
return
[
TX
CommonUtil
boolMsgWith
:[
self
isLoop
]];
}
-
(
nullable
BoolMsg
*
)
isPlayingPlayerMsg
:
(
nonnull
PlayerMsg
*
)
playerMsg
error
:
(
FlutterError
*
_Nullable
__autoreleasing
*
_Nonnull
)
error
{
return
[
CommonUtil
boolMsgWith
:[
self
isPlaying
]];
return
[
TX
CommonUtil
boolMsgWith
:[
self
isPlaying
]];
}
-
(
void
)
pausePlayerMsg
:
(
nonnull
PlayerMsg
*
)
playerMsg
error
:
(
FlutterError
*
_Nullable
__autoreleasing
*
_Nonnull
)
error
{
...
...
@@ -936,7 +936,7 @@ BOOL CGImageRefContainsAlpha(CGImageRef imageRef) {
-
(
nullable
BoolMsg
*
)
setRequestAudioFocusFocus
:
(
nonnull
BoolPlayerMsg
*
)
focus
error
:
(
FlutterError
*
_Nullable
__autoreleasing
*
_Nonnull
)
error
{
// FlutterMethodNotImplemented
return
[
CommonUtil
boolMsgWith
:
YES
];
return
[
TX
CommonUtil
boolMsgWith
:
YES
];
}
-
(
void
)
setStartTimeStartTime
:
(
nonnull
DoublePlayerMsg
*
)
startTime
error
:
(
FlutterError
*
_Nullable
__autoreleasing
*
_Nonnull
)
error
{
...
...
@@ -949,7 +949,7 @@ BOOL CGImageRefContainsAlpha(CGImageRef imageRef) {
-
(
nullable
BoolMsg
*
)
startVodPlayUrl
:
(
nonnull
StringPlayerMsg
*
)
url
error
:
(
FlutterError
*
_Nullable
__autoreleasing
*
_Nonnull
)
error
{
int
r
=
[
self
startVodPlay
:
url
.
value
];
return
[
CommonUtil
boolMsgWith
:
r
];
return
[
TX
CommonUtil
boolMsgWith
:
r
];
}
-
(
void
)
startVodPlayWithParamsParams
:
(
nonnull
TXPlayInfoParamsPlayerMsg
*
)
params
error
:
(
FlutterError
*
_Nullable
__autoreleasing
*
_Nonnull
)
error
{
...
...
@@ -958,7 +958,7 @@ BOOL CGImageRefContainsAlpha(CGImageRef imageRef) {
-
(
nullable
BoolMsg
*
)
stopIsNeedClear
:
(
nonnull
BoolPlayerMsg
*
)
isNeedClear
error
:
(
FlutterError
*
_Nullable
__autoreleasing
*
_Nonnull
)
error
{
BOOL
r
=
[
self
stopPlay
];
return
[
CommonUtil
boolMsgWith
:
r
];
return
[
TX
CommonUtil
boolMsgWith
:
r
];
}
@end
Flutter/ios/Classes/SuperPlayerPlugin.h
浏览文件 @
f626ddfc
...
...
@@ -3,7 +3,7 @@
#define SUPERPLAYER_FLUTTER_IOS_CLASSES_SUPERPLAYERPLUGIN_H_
#import <Flutter/Flutter.h>
#import "CommonUtil.h"
#import "
TX
CommonUtil.h"
@interface
SuperPlayerPlugin
:
NSObject
<
FlutterPlugin
>
...
...
Flutter/ios/Classes/SuperPlayerPlugin.m
浏览文件 @
f626ddfc
...
...
@@ -13,7 +13,7 @@
#import "FTXVodPlayerDispatcher.h"
#import "FTXLivePlayerDispatcher.h"
@interface
SuperPlayerPlugin
()
<
FlutterStreamHandler
,
FTXVodPlayerDelegate
,
TXFlutterSuperPlayerPluginAPI
,
TXFlutterNativeAPI
,
I
PlayersBridge
,
FlutterPlugin
>
@interface
SuperPlayerPlugin
()
<
FlutterStreamHandler
,
FTXVodPlayerDelegate
,
TXFlutterSuperPlayerPluginAPI
,
TXFlutterNativeAPI
,
I
TXPlayersBridge
,
FlutterPlugin
,
TXLiveBaseDelegate
>
@property
(
nonatomic
,
strong
)
NSObject
<
FlutterPluginRegistrar
>*
registrar
;
@property
(
nonatomic
,
strong
)
NSMutableDictionary
*
players
;
...
...
@@ -40,7 +40,7 @@ SuperPlayerPlugin* instance;
TXFlutterVodPlayerApiSetup
([
registrar
messenger
],
[[
FTXVodPlayerDispatcher
alloc
]
initWithBridge
:
instance
]);
TXFlutterLivePlayerApiSetup
([
registrar
messenger
],
[[
FTXLivePlayerDispatcher
alloc
]
initWithBridge
:
instance
]);
[
registrar
addApplicationDelegate
:
instance
];
[
TXLiveBase
sharedInstance
].
delegate
=
instance
;
}
-
(
void
)
detachFromEngineForRegistrar
:(
NSObject
<
FlutterPluginRegistrar
>
*
)
registrar
{
...
...
@@ -238,7 +238,7 @@ SuperPlayerPlugin* instance;
FTXLivePlayer
*
player
=
[[
FTXLivePlayer
alloc
]
initWithRegistrar
:
self
.
registrar
];
NSNumber
*
playerId
=
player
.
playerId
;
_players
[
playerId
]
=
player
;
return
[
CommonUtil
playerMsgWith
:
playerId
];
return
[
TX
CommonUtil
playerMsgWith
:
playerId
];
}
-
(
nullable
PlayerMsg
*
)
createVodPlayerWithError
:
(
FlutterError
*
_Nullable
__autoreleasing
*
_Nonnull
)
error
{
...
...
@@ -246,15 +246,15 @@ SuperPlayerPlugin* instance;
player
.
delegate
=
self
;
NSNumber
*
playerId
=
player
.
playerId
;
_players
[
playerId
]
=
player
;
return
[
CommonUtil
playerMsgWith
:
playerId
];
return
[
TX
CommonUtil
playerMsgWith
:
playerId
];
}
-
(
nullable
StringMsg
*
)
getLiteAVSDKVersionWithError
:
(
FlutterError
*
_Nullable
__autoreleasing
*
_Nonnull
)
error
{
return
[
CommonUtil
stringMsgWith
:[
TXLiveBase
getSDKVersionStr
]];
return
[
TX
CommonUtil
stringMsgWith
:[
TXLiveBase
getSDKVersionStr
]];
}
-
(
nullable
StringMsg
*
)
getPlatformVersionWithError
:
(
FlutterError
*
_Nullable
__autoreleasing
*
_Nonnull
)
error
{
return
[
CommonUtil
stringMsgWith
:[
@"iOS "
stringByAppendingString
:[[
UIDevice
currentDevice
]
systemVersion
]]];
return
[
TX
CommonUtil
stringMsgWith
:[
@"iOS "
stringByAppendingString
:[[
UIDevice
currentDevice
]
systemVersion
]]];
}
-
(
void
)
releasePlayerPlayerId
:
(
nonnull
PlayerMsg
*
)
playerId
error
:
(
FlutterError
*
_Nullable
__autoreleasing
*
_Nonnull
)
error
{
...
...
@@ -279,16 +279,16 @@ SuperPlayerPlugin* instance;
NSError
*
error
=
nil
;
[[
NSFileManager
defaultManager
]
createDirectoryAtPath
:
preloadDataPath
withIntermediateDirectories
:
NO
attributes
:
nil
error
:&
error
];
[
TXPlayerGlobalSetting
setCacheFolderPath
:
preloadDataPath
];
return
[
CommonUtil
boolMsgWith
:
YES
];
return
[
TX
CommonUtil
boolMsgWith
:
YES
];
}
else
{
return
[
CommonUtil
boolMsgWith
:
NO
];
return
[
TX
CommonUtil
boolMsgWith
:
NO
];
}
}
-
(
nullable
IntMsg
*
)
setGlobalEnvEnvConfig
:
(
nonnull
StringMsg
*
)
envConfig
error
:
(
FlutterError
*
_Nullable
__autoreleasing
*
_Nonnull
)
error
{
int
setResult
=
[
TXLiveBase
setGlobalEnv
:[
envConfig
.
value
UTF8String
]];
return
[
CommonUtil
intMsgWith
:
@
(
setResult
)];
return
[
TX
CommonUtil
intMsgWith
:
@
(
setResult
)];
}
-
(
void
)
setGlobalLicenseLicenseMsg
:
(
nonnull
LicenseMsg
*
)
licenseMsg
error
:
(
FlutterError
*
_Nullable
__autoreleasing
*
_Nonnull
)
error
{
...
...
@@ -307,7 +307,7 @@ SuperPlayerPlugin* instance;
-
(
nullable
BoolMsg
*
)
startVideoOrientationServiceWithError
:
(
FlutterError
*
_Nullable
__autoreleasing
*
_Nonnull
)
error
{
// only for android
return
[
CommonUtil
boolMsgWith
:
YES
];
return
[
TX
CommonUtil
boolMsgWith
:
YES
];
}
#pragma mark nativeAPI
...
...
@@ -318,23 +318,23 @@ SuperPlayerPlugin* instance;
-
(
nullable
DoubleMsg
*
)
getBrightnessWithError
:
(
FlutterError
*
_Nullable
__autoreleasing
*
_Nonnull
)
error
{
NSNumber
*
brightness
=
[
NSNumber
numberWithFloat
:[
UIScreen
mainScreen
].
brightness
];
return
[
CommonUtil
doubleMsgWith
:
brightness
.
doubleValue
];
return
[
TX
CommonUtil
doubleMsgWith
:
brightness
.
doubleValue
];
}
-
(
DoubleMsg
*
)
getSysBrightnessWithError
:
(
FlutterError
*
_Nullable
__autoreleasing
*
)
error
{
NSNumber
*
brightness
=
[
NSNumber
numberWithFloat
:[
UIScreen
mainScreen
].
brightness
];
return
[
CommonUtil
doubleMsgWith
:
brightness
.
doubleValue
];
return
[
TX
CommonUtil
doubleMsgWith
:
brightness
.
doubleValue
];
}
-
(
nullable
DoubleMsg
*
)
getSystemVolumeWithError
:
(
FlutterError
*
_Nullable
__autoreleasing
*
_Nonnull
)
error
{
NSNumber
*
volume
=
[
NSNumber
numberWithFloat
:[
audioManager
getVolume
]];
return
[
CommonUtil
doubleMsgWith
:
volume
.
doubleValue
];
return
[
TX
CommonUtil
doubleMsgWith
:
volume
.
doubleValue
];
}
-
(
nullable
IntMsg
*
)
isDeviceSupportPipWithError
:
(
FlutterError
*
_Nullable
__autoreleasing
*
_Nonnull
)
error
{
BOOL
isSupport
=
[
TXVodPlayer
isSupportPictureInPicture
];
int
pipSupportResult
=
isSupport
?
0
:
ERROR_IOS_PIP_DEVICE_NOT_SUPPORT
;
return
[
CommonUtil
intMsgWith
:
@
(
pipSupportResult
)];
return
[
TX
CommonUtil
intMsgWith
:
@
(
pipSupportResult
)];
}
-
(
void
)
requestAudioFocusWithError
:
(
FlutterError
*
_Nullable
__autoreleasing
*
_Nonnull
)
error
{
...
...
@@ -370,4 +370,39 @@ SuperPlayerPlugin* instance;
return
self
.
players
;
}
#pragma mark TXLiveBaseDelegate
-
(
void
)
onLog
:
(
NSString
*
)
log
LogLevel
:
(
int
)
level
WhichModule
:
(
NSString
*
)
module
{
// [_eventSink success:[SuperPlayerPlugin getParamsWithEvent:EVENT_ON_LOG withParams:@{
// @(EVENT_LOG_LEVEL) : @(level),
// @(EVENT_LOG_MODULE) : module,
// @(EVENT_LOG_MSG) : log
// }]];
// this may be too busy, so currently do not throw on the Flutter side
}
-
(
void
)
onUpdateNetworkTime
:
(
int
)
errCode
message
:
(
NSString
*
)
errMsg
{
// [_eventSink success:[SuperPlayerPlugin getParamsWithEvent:EVENT_ON_UPDATE_NETWORK_TIME withParams:@{
// @(EVENT_ERR_CODE) : @(errCode),
// @(EVENT_ERR_MSG) : errMsg,
// }]];
// This will be opened in a subsequent version
}
-
(
void
)
onLicenceLoaded
:
(
int
)
result
Reason
:
(
NSString
*
)
reason
{
[
_eventSink
success
:[
SuperPlayerPlugin
getParamsWithEvent
:
EVENT_ON_LICENCE_LOADED
withParams
:@{
@
(
EVENT_RESULT
)
:
@
(
result
),
@
(
EVENT_REASON
)
:
reason
,
}]];
}
-
(
void
)
onCustomHttpDNS
:
(
NSString
*
)
hostName
ipList
:
(
NSMutableArray
<
NSString
*>
*
)
list
{
// [_eventSink success:[SuperPlayerPlugin getParamsWithEvent:EVENT_ON_LICENCE_LOADED withParams:@{
// @(EVENT_HOST_NAME) : hostName,
// @(EVENT_IPS) : list,
// }]];
// This will be opened in a subsequent version
}
@end
Flutter/ios/Classes/CommonUtil.h
→
Flutter/ios/Classes/
TX
CommonUtil.h
浏览文件 @
f626ddfc
...
...
@@ -5,7 +5,7 @@
#import "FTXEvent.h"
#import "FtxMessages.h"
@interface
CommonUtil
:
NSObject
@interface
TX
CommonUtil
:
NSObject
+
(
NSNumber
*
)
getDownloadEventByState
:(
int
)
downloadState
;
...
...
Flutter/ios/Classes/CommonUtil.m
→
Flutter/ios/Classes/
TX
CommonUtil.m
浏览文件 @
f626ddfc
// Copyright (c) 2022 Tencent. All rights reserved.
#import "CommonUtil.h"
#import "
TX
CommonUtil.h"
#import <Flutter/Flutter.h>
@implementation
CommonUtil
@implementation
TX
CommonUtil
+
(
NSNumber
*
)
getDownloadEventByState
:(
int
)
downloadState
{
int
result
;
...
...
Flutter/ios/Classes/helper/PredownloadFileHelperDelegate.h
→
Flutter/ios/Classes/helper/
TX
PredownloadFileHelperDelegate.h
浏览文件 @
f626ddfc
// Copyright (c) 2022 Tencent. All rights reserved.
#ifndef SUPERPLAYER_FLUTTER_IOS_CLASSES_HELPER_PREDOWNLOADFILEHELPERDELEGATE_H_
#define SUPERPLAYER_FLUTTER_IOS_CLASSES_HELPER_PREDOWNLOADFILEHELPERDELEGATE_H_
#ifndef SUPERPLAYER_FLUTTER_IOS_CLASSES_HELPER_
TX
PREDOWNLOADFILEHELPERDELEGATE_H_
#define SUPERPLAYER_FLUTTER_IOS_CLASSES_HELPER_
TX
PREDOWNLOADFILEHELPERDELEGATE_H_
#import <Foundation/Foundation.h>
#import <TXLiteAVSDK_Professional/TXVodPreloadManager.h>
...
...
@@ -11,7 +11,7 @@ typedef void (^FTXPreDownloadOnStart)(long tmpTaskId, int taskID, NSString* file
typedef
void
(
^
FTXPreDownloadOnCompelete
)(
int
taskID
,
NSString
*
url
);
typedef
void
(
^
FTXPreDownloadOnError
)(
long
tmpTaskId
,
int
taskID
,
NSString
*
url
,
NSError
*
error
);
@interface
PredownloadFileHelperDelegate
:
NSObject
<
TXVodPreloadManagerDelegate
>
@interface
TX
PredownloadFileHelperDelegate
:
NSObject
<
TXVodPreloadManagerDelegate
>
-
(
instancetype
)
initWithBlock
:
(
long
)
tmpTaskId
start
:
(
FTXPreDownloadOnStart
)
onStart
complete
:
(
FTXPreDownloadOnCompelete
)
onComplete
...
...
@@ -20,4 +20,4 @@ typedef void (^FTXPreDownloadOnError)(long tmpTaskId, int taskID, NSString* url,
@end
NS_ASSUME_NONNULL_END
#endif // SUPERPLAYER_FLUTTER_IOS_CLASSES_HELPER_PREDOWNLOADFILEHELPERDELEGATE_H_
#endif // SUPERPLAYER_FLUTTER_IOS_CLASSES_HELPER_
TX
PREDOWNLOADFILEHELPERDELEGATE_H_
Flutter/ios/Classes/helper/PredownloadFileHelperDelegate.m
→
Flutter/ios/Classes/helper/
TX
PredownloadFileHelperDelegate.m
浏览文件 @
f626ddfc
// Copyright (c) 2022 Tencent. All rights reserved.
#import "PredownloadFileHelperDelegate.h"
#import "
TX
PredownloadFileHelperDelegate.h"
@interface
PredownloadFileHelperDelegate
()
@interface
TX
PredownloadFileHelperDelegate
()
@property
(
nonatomic
,
assign
)
long
tmpTaskId
;
@property
(
nonatomic
,
strong
)
FTXPreDownloadOnStart
onStartBlock
;
...
...
@@ -10,7 +10,7 @@
@end
@implementation
PredownloadFileHelperDelegate
@implementation
TX
PredownloadFileHelperDelegate
-
(
instancetype
)
initWithBlock
:(
long
)
tmpTaskId
start
:(
FTXPreDownloadOnStart
)
onStart
complete
:(
FTXPreDownloadOnCompelete
)
onComplete
error
:(
FTXPreDownloadOnError
)
onError
{
self
=
[
super
init
];
...
...
Flutter/ios/Classes/messages/FTXLivePlayerDispatcher.h
浏览文件 @
f626ddfc
...
...
@@ -4,13 +4,13 @@
#import <Foundation/Foundation.h>
#import "FtxMessages.h"
#import "IPlayersBridge.h"
#import "I
TX
PlayersBridge.h"
@interface
FTXLivePlayerDispatcher
:
NSObject
<
TXFlutterLivePlayerApi
>
@property
(
atomic
,
strong
)
id
<
IPlayersBridge
>
bridge
;
@property
(
atomic
,
strong
)
id
<
I
TX
PlayersBridge
>
bridge
;
-
(
instancetype
)
initWithBridge
:(
id
<
IPlayersBridge
>
)
dataBridge
;
-
(
instancetype
)
initWithBridge
:(
id
<
I
TX
PlayersBridge
>
)
dataBridge
;
@end
...
...
Flutter/ios/Classes/messages/FTXLivePlayerDispatcher.m
浏览文件 @
f626ddfc
...
...
@@ -4,7 +4,7 @@
@implementation
FTXLivePlayerDispatcher
-
(
instancetype
)
initWithBridge
:(
id
<
IPlayersBridge
>
)
dataBridge
{
-
(
instancetype
)
initWithBridge
:(
id
<
I
TX
PlayersBridge
>
)
dataBridge
{
if
(
self
=
[
self
init
])
{
self
.
bridge
=
dataBridge
;
}
...
...
Flutter/ios/Classes/messages/FTXVodPlayerDispatcher.h
浏览文件 @
f626ddfc
...
...
@@ -4,13 +4,13 @@
#import <Foundation/Foundation.h>
#import "FtxMessages.h"
#import "IPlayersBridge.h"
#import "I
TX
PlayersBridge.h"
@interface
FTXVodPlayerDispatcher
:
NSObject
<
TXFlutterVodPlayerApi
>
@property
(
atomic
,
strong
)
id
<
IPlayersBridge
>
bridge
;
@property
(
atomic
,
strong
)
id
<
I
TX
PlayersBridge
>
bridge
;
-
(
instancetype
)
initWithBridge
:(
id
<
IPlayersBridge
>
)
dataBridge
;
-
(
instancetype
)
initWithBridge
:(
id
<
I
TX
PlayersBridge
>
)
dataBridge
;
@end
...
...
Flutter/ios/Classes/messages/FTXVodPlayerDispatcher.m
浏览文件 @
f626ddfc
...
...
@@ -5,7 +5,7 @@
@implementation
FTXVodPlayerDispatcher
-
(
instancetype
)
initWithBridge
:(
id
<
IPlayersBridge
>
)
dataBridge
{
-
(
instancetype
)
initWithBridge
:(
id
<
I
TX
PlayersBridge
>
)
dataBridge
{
if
(
self
=
[
self
init
])
{
self
.
bridge
=
dataBridge
;
}
...
...
Flutter/ios/Classes/messages/IPlayersBridge.h
→
Flutter/ios/Classes/messages/I
TX
PlayersBridge.h
浏览文件 @
f626ddfc
// Copyright (c) 2022 Tencent. All rights reserved.
#ifndef SUPERPLAYER_FLUTTER_IOS_CLASSES_MESSAGES_IPLAYERSBRIDGE_H_
#define SUPERPLAYER_FLUTTER_IOS_CLASSES_MESSAGES_IPLAYERSBRIDGE_H_
#ifndef SUPERPLAYER_FLUTTER_IOS_CLASSES_MESSAGES_I
TX
PLAYERSBRIDGE_H_
#define SUPERPLAYER_FLUTTER_IOS_CLASSES_MESSAGES_I
TX
PLAYERSBRIDGE_H_
#import <Foundation/Foundation.h>
@protocol
IPlayersBridge
@protocol
I
TX
PlayersBridge
-
(
NSMutableDictionary
*
)
getPlayers
;
@end
#endif // SUPERPLAYER_FLUTTER_IOS_CLASSES_MESSAGES_IPLAYERSBRIDGE_H_
#endif // SUPERPLAYER_FLUTTER_IOS_CLASSES_MESSAGES_I
TX
PLAYERSBRIDGE_H_
Flutter/lib/Core/superplayer_plugin.dart
浏览文件 @
f626ddfc
...
...
@@ -24,7 +24,7 @@ class SuperPlayerPlugin {
final
StreamController
<
Map
<
dynamic
,
dynamic
>>
_eventPipStreamController
=
StreamController
.
broadcast
();
/// Native interaction, common event listener, events from the plugin, such as sound change events.
/// 原生交互,通用事件监听,来自插件的事件,例如 声音变化等事件
/// 原生交互,通用事件监听,来自插件的事件,例如 声音变化
、播放器SDK加载鉴权
等事件
Stream
<
Map
<
dynamic
,
dynamic
>>
get
onEventBroadcast
=>
_eventStreamController
.
stream
;
/// Native interaction, common event listener, events from the native container,
...
...
@@ -32,12 +32,20 @@ class SuperPlayerPlugin {
/// 原生交互,通用事件监听,来自原生容器的事件,例如 PIP事件、activity/controller 生命周期变化
Stream
<
Map
<
dynamic
,
dynamic
>>
get
onExtraEventBroadcast
=>
_eventPipStreamController
.
stream
;
FTXLicenceLoadedListener
?
_licenseLoadedListener
;
SuperPlayerPlugin
.
_internal
()
{
EventChannel
eventChannel
=
EventChannel
(
"cloud.tencent.com/playerPlugin/event"
);
eventChannel
.
receiveBroadcastStream
(
"event"
).
listen
(
_eventHandler
,
onError:
_errorHandler
);
EventChannel
pipEventChanne
=
EventChannel
(
"cloud.tencent.com/playerPlugin/componentEvent"
);
pipEventChanne
.
receiveBroadcastStream
(
"pipEvent"
).
listen
(
_pipEventHandler
,
onError:
_errorHandler
);
onEventBroadcast
.
listen
((
event
)
{
int
evtCode
=
event
[
"event"
];
if
(
evtCode
==
TXVodPlayEvent
.
EVENT_ON_LICENCE_LOADED
)
{
_licenseLoadedListener
?.
call
(
event
[
TXVodPlayEvent
.
EVENT_RESULT
],
event
[
TXVodPlayEvent
.
EVENT_REASON
]);
}
});
}
_pipEventHandler
(
event
)
{
...
...
@@ -179,7 +187,7 @@ class SuperPlayerPlugin {
/// Get the current system volume, range: 0.0 ~ 1.0
/// 获得当前系统音量,范围:0.0 ~ 1.0
static
Future
<
double
?>
getSystemVolume
()
async
{
DoubleMsg
doubleMsg
=
await
_nativeAPI
.
getSystemVolume
();
DoubleMsg
doubleMsg
=
await
_nativeAPI
.
getSystemVolume
();
return
doubleMsg
.
value
;
}
...
...
@@ -268,7 +276,17 @@ class SuperPlayerPlugin {
/// @param isRegister:true register system brightness
/// :false unregister system brightness
///
static
Future
<
void
>
registerSysBrightness
(
bool
isRegister
)
async
{
static
Future
<
void
>
registerSysBrightness
(
bool
isRegister
)
async
{
await
_nativeAPI
.
registerSysBrightness
(
BoolMsg
()..
value
=
isRegister
);
}
///
/// 设置SDK的监听,目前有licence加载监听,后续还会陆续开放其他类型的监听
///
/// Set up SDK listeners, currently there is a license loading listener, and other types of listeners
/// will be gradually opened in the future.
///
void
setSDKListener
({
FTXLicenceLoadedListener
?
licenceLoadedListener
})
{
_licenseLoadedListener
=
licenceLoadedListener
;
}
}
Flutter/lib/Core/txplayer_define.dart
浏览文件 @
f626ddfc
...
...
@@ -333,6 +333,13 @@ abstract class TXVodPlayEvent {
// Error occurred during video download.
// 视频下载错误
static
const
EVENT_DOWNLOAD_ERROR
=
305
;
// SDK event
// onLicenceLoaded
static
const
EVENT_ON_LICENCE_LOADED
=
503
;
static
const
EVENT_RESULT
=
"result"
;
static
const
EVENT_REASON
=
"reason"
;
}
abstract
class
TXVodNetEvent
{
...
...
@@ -685,3 +692,5 @@ typedef FTXPredownlodOnErrorListener = void Function(int taskId, String url, int
// 视频下载时间回调Listener
typedef
FTXDownlodOnStateChangeListener
=
void
Function
(
int
event
,
TXVodDownloadMediaInfo
info
);
typedef
FTXDownlodOnErrorListener
=
void
Function
(
int
errorCode
,
String
errorMsg
,
TXVodDownloadMediaInfo
info
);
typedef
FTXLicenceLoadedListener
=
void
Function
(
int
result
,
String
reason
);
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论