Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
T
tx_player_fork
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
蒋俊
tx_player_fork
Commits
7db2b9ce
提交
7db2b9ce
authored
11月 02, 2023
作者:
kongdywang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
1、add registerSysBrightness for control android brightness' observer
2、move restorePageBrightness from moreView to demoSuperPlayer
上级
3e550ab0
显示空白字符变更
内嵌
并排
正在显示
13 个修改的文件
包含
637 行增加
和
114 行删除
+637
-114
SuperPlayerPlugin.java
.../main/java/com/tencent/vod/flutter/SuperPlayerPlugin.java
+24
-3
FtxMessages.java
...in/java/com/tencent/vod/flutter/messages/FtxMessages.java
+206
-47
CommonUtil.java
...c/main/java/com/tencent/vod/flutter/tools/CommonUtil.java
+2
-6
API文档.md
Flutter/docs/API文档.md
+35
-11
demo_superplayer.dart
Flutter/example/lib/demo_superplayer.dart
+6
-0
SuperPlayerPlugin.m
Flutter/ios/Classes/SuperPlayerPlugin.m
+4
-0
FtxMessages.h
Flutter/ios/Classes/messages/FtxMessages.h
+95
-11
FtxMessages.m
Flutter/ios/Classes/messages/FtxMessages.m
+122
-19
txplayer_message.dart
Flutter/lib/Core/pigeons/txplayer_message.dart
+5
-0
superplayer_plugin.dart
Flutter/lib/Core/superplayer_plugin.dart
+11
-0
txplayer_define.dart
Flutter/lib/Core/txplayer_define.dart
+6
-2
txplayer_messages.dart
Flutter/lib/Core/txplayer_messages.dart
+121
-14
superplayer_more_view.dart
Flutter/superplayer_widget/lib/ui/superplayer_more_view.dart
+0
-1
没有找到文件。
Flutter/android/src/main/java/com/tencent/vod/flutter/SuperPlayerPlugin.java
浏览文件 @
7db2b9ce
...
...
@@ -85,6 +85,8 @@ public class SuperPlayerPlugin implements FlutterPlugin, ActivityAware,
private
int
mCurrentOrientation
=
FTXEvent
.
ORIENTATION_PORTRAIT_UP
;
private
final
TXFlutterEngineHolder
mEngineHolder
=
new
TXFlutterEngineHolder
();
private
boolean
mIsBrightnessObserverRegistered
=
false
;
private
final
FTXAudioManager
.
AudioFocusChangeListener
audioFocusChangeListener
=
new
FTXAudioManager
.
AudioFocusChangeListener
()
{
@Override
...
...
@@ -102,8 +104,7 @@ public class SuperPlayerPlugin implements FlutterPlugin, ActivityAware,
@Override
public
void
onChange
(
boolean
selfChange
,
@NonNull
Collection
<
Uri
>
uris
,
int
flags
)
{
super
.
onChange
(
selfChange
,
uris
,
flags
);
double
systemBrightness
=
getSystemScreenBrightness
();
setWindowBrightness
(
systemBrightness
);
setWindowBrightness
(-
1
D
);
}
};
...
...
@@ -449,10 +450,23 @@ public class SuperPlayerPlugin implements FlutterPlugin, ActivityAware,
IntentFilter
filter
=
new
IntentFilter
();
filter
.
addAction
(
VOLUME_CHANGED_ACTION
);
mActivityPluginBinding
.
getActivity
().
registerReceiver
(
mVolumeBroadcastReceiver
,
filter
);
}
public
void
enableBrightnessObserver
(
boolean
enable
)
{
if
(
null
!=
mActivityPluginBinding
&&
!
mActivityPluginBinding
.
getActivity
().
isDestroyed
())
{
if
(
enable
)
{
if
(!
mIsBrightnessObserverRegistered
)
{
// brightness observer
ContentResolver
resolver
=
mActivityPluginBinding
.
getActivity
().
getContentResolver
();
resolver
.
registerContentObserver
(
Settings
.
System
.
getUriFor
(
Settings
.
System
.
SCREEN_BRIGHTNESS
),
true
,
brightnessObserver
);
mIsBrightnessObserverRegistered
=
true
;
}
}
else
{
mActivityPluginBinding
.
getActivity
().
getContentResolver
().
unregisterContentObserver
(
brightnessObserver
);
mIsBrightnessObserverRegistered
=
false
;
}
}
}
/**
...
...
@@ -464,7 +478,7 @@ public class SuperPlayerPlugin implements FlutterPlugin, ActivityAware,
try
{
mTxAudioManager
.
removeAudioFocusChangedListener
(
audioFocusChangeListener
);
mActivityPluginBinding
.
getActivity
().
unregisterReceiver
(
mVolumeBroadcastReceiver
);
mActivityPluginBinding
.
getActivity
().
getContentResolver
().
unregisterContentObserver
(
brightnessObserver
);
enableBrightnessObserver
(
false
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
...
...
@@ -548,6 +562,13 @@ public class SuperPlayerPlugin implements FlutterPlugin, ActivityAware,
return
intMsg
;
}
@Override
public
void
registerSysBrightness
(
@NonNull
BoolMsg
isRegister
)
{
if
(
null
!=
isRegister
.
getValue
())
{
enableBrightnessObserver
(
isRegister
.
getValue
());
}
}
private
class
VolumeBroadcastReceiver
extends
BroadcastReceiver
{
public
void
onReceive
(
Context
context
,
Intent
intent
)
{
...
...
Flutter/android/src/main/java/com/tencent/vod/flutter/messages/FtxMessages.java
浏览文件 @
7db2b9ce
// // Copyright (c) 2022 Tencent. All rights reserved.
// Autogenerated from Pigeon (v9.
1.2
), do not edit directly.
// Autogenerated from Pigeon (v9.
2.5
), do not edit directly.
// See also: https://pub.dev/packages/pigeon
package
com
.
tencent
.
vod
.
flutter
.
messages
;
...
...
@@ -42,7 +42,7 @@ public class FtxMessages {
}
@NonNull
pr
ivate
static
ArrayList
<
Object
>
wrapError
(
@NonNull
Throwable
exception
)
{
pr
otected
static
ArrayList
<
Object
>
wrapError
(
@NonNull
Throwable
exception
)
{
ArrayList
<
Object
>
errorList
=
new
ArrayList
<
Object
>(
3
);
if
(
exception
instanceof
FlutterError
)
{
FlutterError
error
=
(
FlutterError
)
exception
;
...
...
@@ -59,6 +59,10 @@ public class FtxMessages {
}
/**
* Pigeon original component, used to generate native communication code for `messages`.
* The generation command is as follows. When using the generation command,
* the two import statements above need to be implemented or commented out.
*
* pigeon原始原件,由此文件生成messages原生通信代码
* 生成命令如下,使用生成命令的时候,需要实现注释掉以上两个import导入
*
...
...
@@ -2466,11 +2470,11 @@ public class FtxMessages {
BoolMsg
startVideoOrientationService
();
/** The codec used by TXFlutterSuperPlayerPluginAPI. */
static
MessageCodec
<
Object
>
getCodec
()
{
static
@NonNull
MessageCodec
<
Object
>
getCodec
()
{
return
TXFlutterSuperPlayerPluginAPICodec
.
INSTANCE
;
}
/**Sets up an instance of `TXFlutterSuperPlayerPluginAPI` to handle messages through the `binaryMessenger`. */
static
void
setup
(
BinaryMessenger
binaryMessenger
,
TXFlutterSuperPlayerPluginAPI
api
)
{
static
void
setup
(
@NonNull
BinaryMessenger
binaryMessenger
,
@Nullable
TXFlutterSuperPlayerPluginAPI
api
)
{
{
BasicMessageChannel
<
Object
>
channel
=
new
BasicMessageChannel
<>(
...
...
@@ -2761,8 +2765,10 @@ public class FtxMessages {
protected
Object
readValueOfType
(
byte
type
,
@NonNull
ByteBuffer
buffer
)
{
switch
(
type
)
{
case
(
byte
)
128
:
return
Double
Msg
.
fromList
((
ArrayList
<
Object
>)
readValue
(
buffer
));
return
Bool
Msg
.
fromList
((
ArrayList
<
Object
>)
readValue
(
buffer
));
case
(
byte
)
129
:
return
DoubleMsg
.
fromList
((
ArrayList
<
Object
>)
readValue
(
buffer
));
case
(
byte
)
130
:
return
IntMsg
.
fromList
((
ArrayList
<
Object
>)
readValue
(
buffer
));
default
:
return
super
.
readValueOfType
(
type
,
buffer
);
...
...
@@ -2771,11 +2777,14 @@ public class FtxMessages {
@Override
protected
void
writeValue
(
@NonNull
ByteArrayOutputStream
stream
,
Object
value
)
{
if
(
value
instanceof
Double
Msg
)
{
if
(
value
instanceof
Bool
Msg
)
{
stream
.
write
(
128
);
writeValue
(
stream
,
((
BoolMsg
)
value
).
toList
());
}
else
if
(
value
instanceof
DoubleMsg
)
{
stream
.
write
(
129
);
writeValue
(
stream
,
((
DoubleMsg
)
value
).
toList
());
}
else
if
(
value
instanceof
IntMsg
)
{
stream
.
write
(
1
29
);
stream
.
write
(
1
30
);
writeValue
(
stream
,
((
IntMsg
)
value
).
toList
());
}
else
{
super
.
writeValue
(
stream
,
value
);
...
...
@@ -2814,13 +2823,19 @@ public class FtxMessages {
*/
@NonNull
IntMsg
isDeviceSupportPip
();
/**
*
* register or unregister system brightness
*
*/
void
registerSysBrightness
(
@NonNull
BoolMsg
isRegister
);
/** The codec used by TXFlutterNativeAPI. */
static
MessageCodec
<
Object
>
getCodec
()
{
static
@NonNull
MessageCodec
<
Object
>
getCodec
()
{
return
TXFlutterNativeAPICodec
.
INSTANCE
;
}
/**Sets up an instance of `TXFlutterNativeAPI` to handle messages through the `binaryMessenger`. */
static
void
setup
(
BinaryMessenger
binaryMessenger
,
TXFlutterNativeAPI
api
)
{
static
void
setup
(
@NonNull
BinaryMessenger
binaryMessenger
,
@Nullable
TXFlutterNativeAPI
api
)
{
{
BasicMessageChannel
<
Object
>
channel
=
new
BasicMessageChannel
<>(
...
...
@@ -3013,6 +3028,30 @@ public class FtxMessages {
IntMsg
output
=
api
.
isDeviceSupportPip
();
wrapped
.
add
(
0
,
output
);
}
catch
(
Throwable
exception
)
{
ArrayList
<
Object
>
wrappedError
=
wrapError
(
exception
);
wrapped
=
wrappedError
;
}
reply
.
reply
(
wrapped
);
});
}
else
{
channel
.
setMessageHandler
(
null
);
}
}
{
BasicMessageChannel
<
Object
>
channel
=
new
BasicMessageChannel
<>(
binaryMessenger
,
"dev.flutter.pigeon.TXFlutterNativeAPI.registerSysBrightness"
,
getCodec
());
if
(
api
!=
null
)
{
channel
.
setMessageHandler
(
(
message
,
reply
)
->
{
ArrayList
<
Object
>
wrapped
=
new
ArrayList
<
Object
>();
ArrayList
<
Object
>
args
=
(
ArrayList
<
Object
>)
message
;
BoolMsg
isRegisterArg
=
(
BoolMsg
)
args
.
get
(
0
);
try
{
api
.
registerSysBrightness
(
isRegisterArg
);
wrapped
.
add
(
0
,
null
);
}
catch
(
Throwable
exception
)
{
ArrayList
<
Object
>
wrappedError
=
wrapError
(
exception
);
wrapped
=
wrappedError
;
...
...
@@ -3121,7 +3160,9 @@ public class FtxMessages {
public
interface
TXFlutterVodPlayerApi
{
/**
* 播放器初始化,创建共享纹理、初始化播放器
* @param onlyAudio 是否是纯音频模式
*
* To initialize the player, you would need to create a shared texture and initialize the player.
* @param onlyAudio 是否是纯音频模式 if pure audio mode
*/
@NonNull
IntMsg
initialize
(
@NonNull
BoolPlayerMsg
onlyAudio
);
...
...
@@ -3131,8 +3172,16 @@ public class FtxMessages {
* 否则将播放失败(黑屏),全局仅设置一次即可。直播 Licence、短视频 Licence 和视频播放 Licence 均可使用,若您暂未获取上述 Licence ,
* 可[快速免费申请测试版 Licence](https://cloud.tencent.com/act/event/License) 以正常播放,正式版 License 需[购买]
* (https://cloud.tencent.com/document/product/881/74588#.E8.B4.AD.E4.B9.B0.E5.B9.B6.E6.96.B0.E5.BB.BA.E6.AD.A3.E5.BC.8F.E7.89.88-license)。
* @param url : 视频播放地址
* return 是否播放成功
*
* Starting from version 10.7, the method `startPlay` has been changed to `startVodPlay` for playing videos via a URL.
* To play videos successfully, it is necessary to set the license by using the method `SuperPlayerPlugin#setGlobalLicense`.
* Failure to set the license will result in video playback failure (a black screen).
* Live streaming, short video, and video playback licenses can all be used. If you do not have any of the above licenses,
* you can apply for a free trial license to play videos normally[Quickly apply for a free trial version Licence]
* (https://cloud.tencent.com/act/event/License).Official licenses can be purchased
* (https://cloud.tencent.com/document/product/881/74588#.E8.B4.AD.E4.B9.B0.E5.B9.B6.E6.96.B0.E5.BB.BA.E6.AD.A3.E5.BC.8F.E7.89.88-license).
* @param url : 视频播放地址 video playback address
* return 是否播放成功 if play successfully
*/
@NonNull
BoolMsg
startVodPlay
(
@NonNull
StringPlayerMsg
url
);
...
...
@@ -3142,82 +3191,184 @@ public class FtxMessages {
* 否则将播放失败(黑屏),全局仅设置一次即可。直播 Licence、短视频 Licence 和视频播放 Licence 均可使用,若您暂未获取上述 Licence ,
* 可[快速免费申请测试版 Licence](https://cloud.tencent.com/act/event/License) 以正常播放,正式版 License 需[购买]
* (https://cloud.tencent.com/document/product/881/74588#.E8.B4.AD.E4.B9.B0.E5.B9.B6.E6.96.B0.E5.BB.BA.E6.AD.A3.E5.BC.8F.E7.89.88-license)。
* @params : 见[TXPlayInfoParams]
* return 是否播放成功
*
* Starting from version 10.7, the method "startPlayWithParams" has been changed to "startVodPlayWithParams" for playing videos using fileId.
* To play the video successfully, you need to set the Licence using "SuperPlayerPlugin#setGlobalLicense" method before playing the video.
* If you do not set the Licence, the video will not play (black screen). The Licence for live streaming,
* short video, and video playback can all be used. If you have not obtained the Licence, you can apply for a free trial version [here]
* (https://cloud.tencent.com/act/event/License) for normal playback. To use the official version, you need to [purchase]
* (https://cloud.tencent.com/document/product/881/74588#.E8.B4.AD.E4.B9.B0.E5.B9.B6.E6.96.B0.E5.BB.BA.E6.AD.A3.E5.BC.8F.E7.89.88-license).
* @params : see[TXPlayInfoParams]
* return 是否播放成功 if play successful
*/
void
startVodPlayWithParams
(
@NonNull
TXPlayInfoParamsPlayerMsg
params
);
/** 设置是否自动播放 */
/**
* 设置是否自动播放
*
* set autoplay
*/
void
setAutoPlay
(
@NonNull
BoolPlayerMsg
isAutoPlay
);
/**
* 停止播放
* return 是否停止成功
*
* Stop playback
* return 是否停止成功 if stop successful
*/
@NonNull
BoolMsg
stop
(
@NonNull
BoolPlayerMsg
isNeedClear
);
/** 视频是否处于正在播放中 */
/**
* 视频是否处于正在播放中
*
* Is the video currently playing
*/
@NonNull
BoolMsg
isPlaying
(
@NonNull
PlayerMsg
playerMsg
);
/** 视频暂停,必须在播放器开始播放的时候调用 */
/**
* 视频暂停,必须在播放器开始播放的时候调用
*
* pause video, it must be called when the player starts playing
*/
void
pause
(
@NonNull
PlayerMsg
playerMsg
);
/** 继续播放,在暂停的时候调用 */
/**
* 继续播放,在暂停的时候调用
*
* resume playback, it should be called when the video is paused
*/
void
resume
(
@NonNull
PlayerMsg
playerMsg
);
/** 设置是否静音 */
/**
* 设置是否静音
*
* Set whether to mute or not
*/
void
setMute
(
@NonNull
BoolPlayerMsg
mute
);
/** 设置是否循环播放 */
/**
* 设置是否循环播放
*
* Set whether to loop playback or not
*/
void
setLoop
(
@NonNull
BoolPlayerMsg
loop
);
/**
* 将视频播放进度定位到指定的进度进行播放
* progress 要定位的视频时间,单位 秒
*
* Set the video playback progress to a specific time and start playing.
* progress 要定位的视频时间,单位 秒 The video playback time to be located, in seconds
*/
void
seek
(
@NonNull
DoublePlayerMsg
progress
);
/** 设置播放速率,默认速率 1 */
/**
* 设置播放速率,默认速率 1
*
* Set the playback speed, with a default speed of 1.
*/
void
setRate
(
@NonNull
DoublePlayerMsg
rate
);
/**
* 获得播放视频解析出来的码率信息
*
* get the bitrate information extracted from playing a video
* return List<Map>
* Bitrate键值:index 码率序号,width 码率对应视频宽度,
* height 码率对应视频高度, bitrate 码率值
* Bitrate:index 码率序号,
* width 码率对应视频宽度,
* height 码率对应视频高度,
* bitrate 码率值
*
* Bitrate:index:bitrate index,
* width:the video with of this bitrate,
* height:the video height of this bitrate,
* bitrate:bitrate value
*/
@NonNull
ListMsg
getSupportedBitrate
(
@NonNull
PlayerMsg
playerMsg
);
/** 获得当前设置的码率序号 */
/**
* 获得当前设置的码率序号
*
* Get the index of the current bitrate setting
*/
@NonNull
IntMsg
getBitrateIndex
(
@NonNull
PlayerMsg
playerMsg
);
/** 设置码率序号 */
/**
* 设置码率序号
*
* Set the index of the bitrate setting.
*/
void
setBitrateIndex
(
@NonNull
IntPlayerMsg
index
);
/** 设置视频播放开始时间,单位 秒 */
/**
* 设置视频播放开始时间,单位 秒
*
* Set the start time of the video playback, in seconds.
*/
void
setStartTime
(
@NonNull
DoublePlayerMsg
startTime
);
/** 设置视频声音 0~100 */
/**
* 设置视频声音 0~100
*
* Set the volume of the video, ranging from 0 to 100.
*/
void
setAudioPlayOutVolume
(
@NonNull
IntPlayerMsg
volume
);
/** 请求获得音频焦点 */
/**
* 请求获得音频焦点
*
* Request audio focus.
*/
@NonNull
BoolMsg
setRequestAudioFocus
(
@NonNull
BoolPlayerMsg
focus
);
/**
* 设置播放器配置
* config @see [FTXVodPlayConfigPlayerMsg]
*
* Set player configuration
* config @see [FTXVodPlayConfig]
*/
void
setConfig
(
@NonNull
FTXVodPlayConfigPlayerMsg
config
);
/** 获得当前已经播放的时间,单位 秒 */
/**
* 获得当前已经播放的时间,单位 秒
*
* Get the current playback time, in seconds.
*/
@NonNull
DoubleMsg
getCurrentPlaybackTime
(
@NonNull
PlayerMsg
playerMsg
);
/** 获得当前视频已缓存的时间 */
/**
* 获得当前视频已缓存的时间
*
* Get the current amount of video that has been buffered.
*/
@NonNull
DoubleMsg
getBufferDuration
(
@NonNull
PlayerMsg
playerMsg
);
/** 获得当前视频的可播放时间 */
/**
* 获得当前视频的可播放时间
*
* Get the current playable duration of the video.
*/
@NonNull
DoubleMsg
getPlayableDuration
(
@NonNull
PlayerMsg
playerMsg
);
/** 获得当前播放视频的宽度 */
/**
* 获得当前播放视频的宽度
*
* Get the width of the currently playing video.
*/
@NonNull
IntMsg
getWidth
(
@NonNull
PlayerMsg
playerMsg
);
/** 获得当前播放视频的高度 */
/**
* 获得当前播放视频的高度
*
* Get the height of the currently playing video.
*/
@NonNull
IntMsg
getHeight
(
@NonNull
PlayerMsg
playerMsg
);
/** 设置播放视频的token */
/**
* 设置播放视频的token
*
* Set the token for playing the video.
*/
void
setToken
(
@NonNull
StringPlayerMsg
token
);
/** 当前播放的视频是否循环播放 */
/**
* 当前播放的视频是否循环播放
*
* Is the currently playing video set to loop
*/
@NonNull
BoolMsg
isLoop
(
@NonNull
PlayerMsg
playerMsg
);
/** 开启/关闭硬件编码 */
/**
* 开启/关闭硬件编码
*
* Enable/Disable hardware encoding.
*/
@NonNull
BoolMsg
enableHardwareDecode
(
@NonNull
BoolPlayerMsg
enable
);
/**
...
...
@@ -3230,23 +3381,31 @@ public class FtxMessages {
*/
@NonNull
IntMsg
enterPictureInPictureMode
(
@NonNull
PipParamsPlayerMsg
pipParamsMsg
);
/** 退出画中画,如果该播放器处于画中画模式 */
/**
* 退出画中画,如果该播放器处于画中画模式
*
* Exit picture-in-picture mode if the video player is in picture-in-picture mode.
*/
void
exitPictureInPictureMode
(
@NonNull
PlayerMsg
playerMsg
);
void
initImageSprite
(
@NonNull
StringListPlayerMsg
spriteInfo
);
@NonNull
UInt8ListMsg
getImageSprite
(
@NonNull
DoublePlayerMsg
time
);
/** 获取总时长 */
/**
* 获取总时长
*
* To get the total duration
*/
@NonNull
DoubleMsg
getDuration
(
@NonNull
PlayerMsg
playerMsg
);
/** The codec used by TXFlutterVodPlayerApi. */
static
MessageCodec
<
Object
>
getCodec
()
{
static
@NonNull
MessageCodec
<
Object
>
getCodec
()
{
return
TXFlutterVodPlayerApiCodec
.
INSTANCE
;
}
/**Sets up an instance of `TXFlutterVodPlayerApi` to handle messages through the `binaryMessenger`. */
static
void
setup
(
BinaryMessenger
binaryMessenger
,
TXFlutterVodPlayerApi
api
)
{
static
void
setup
(
@NonNull
BinaryMessenger
binaryMessenger
,
@Nullable
TXFlutterVodPlayerApi
api
)
{
{
BasicMessageChannel
<
Object
>
channel
=
new
BasicMessageChannel
<>(
...
...
@@ -4149,11 +4308,11 @@ public class FtxMessages {
void
exitPictureInPictureMode
(
@NonNull
PlayerMsg
playerMsg
);
/** The codec used by TXFlutterLivePlayerApi. */
static
MessageCodec
<
Object
>
getCodec
()
{
static
@NonNull
MessageCodec
<
Object
>
getCodec
()
{
return
TXFlutterLivePlayerApiCodec
.
INSTANCE
;
}
/**Sets up an instance of `TXFlutterLivePlayerApi` to handle messages through the `binaryMessenger`. */
static
void
setup
(
BinaryMessenger
binaryMessenger
,
TXFlutterLivePlayerApi
api
)
{
static
void
setup
(
@NonNull
BinaryMessenger
binaryMessenger
,
@Nullable
TXFlutterLivePlayerApi
api
)
{
{
BasicMessageChannel
<
Object
>
channel
=
new
BasicMessageChannel
<>(
...
...
@@ -4613,11 +4772,11 @@ public class FtxMessages {
BoolMsg
deleteDownloadMediaInfo
(
@NonNull
TXVodDownloadMediaMsg
msg
);
/** The codec used by TXFlutterDownloadApi. */
static
MessageCodec
<
Object
>
getCodec
()
{
static
@NonNull
MessageCodec
<
Object
>
getCodec
()
{
return
TXFlutterDownloadApiCodec
.
INSTANCE
;
}
/**Sets up an instance of `TXFlutterDownloadApi` to handle messages through the `binaryMessenger`. */
static
void
setup
(
BinaryMessenger
binaryMessenger
,
TXFlutterDownloadApi
api
)
{
static
void
setup
(
@NonNull
BinaryMessenger
binaryMessenger
,
@Nullable
TXFlutterDownloadApi
api
)
{
{
BasicMessageChannel
<
Object
>
channel
=
new
BasicMessageChannel
<>(
...
...
Flutter/android/src/main/java/com/tencent/vod/flutter/tools/CommonUtil.java
浏览文件 @
7db2b9ce
...
...
@@ -61,9 +61,8 @@ public class CommonUtil {
if
(
CACHE_MAP
.
containsKey
(
KEY_MAX_BRIGHTNESS
))
{
//noinspection ConstantConditions
return
(
float
)
CACHE_MAP
.
get
(
KEY_MAX_BRIGHTNESS
);
}
else
if
(
CommonUtil
.
isMIUI
())
{
}
float
maxBrightness
=
255
f
;
if
(
Build
.
VERSION
.
SDK_INT
<
33
)
{
try
{
Resources
system
=
Resources
.
getSystem
();
int
resId
=
system
.
getIdentifier
(
"config_screenBrightnessSettingMaximum"
,
...
...
@@ -74,15 +73,12 @@ public class CommonUtil {
}
catch
(
Exception
e
)
{
Log
.
getStackTraceString
(
e
);
}
}
else
{
if
(
CommonUtil
.
isMIUI
()
&&
Build
.
VERSION
.
SDK_INT
>=
33
)
{
maxBrightness
=
128
F
;
}
CACHE_MAP
.
put
(
KEY_MAX_BRIGHTNESS
,
maxBrightness
);
return
maxBrightness
;
}
CACHE_MAP
.
put
(
KEY_MAX_BRIGHTNESS
,
255
f
);
return
255
f
;
}
public
static
boolean
isMIUI
()
{
if
(
CACHE_MAP
.
containsKey
(
KEY_IS_MIUI
))
{
...
...
Flutter/docs/API文档.md
浏览文件 @
7db2b9ce
...
...
@@ -443,6 +443,30 @@ static Future<bool> startVideoOrientationService() async
| result | bool | true 开启成功,false 开启失败,如开启过早,还未等到上下文初始化、获取sensor失败等原因 |
### registerSysBrightness
**说明**
开启或关闭对于系统亮度的监听,如果开启,当系统亮度发生变化,会改变当前window亮度,并回调亮度到flutter层。该接口需配合
setBrightness和onExtraEventBroadcast使用。
**接口**
```
dart
static
Future
<
void
>
registerSysBrightness
(
bool
isRegister
)
async
```
**参数说明**
| 参数名 | 类型 | 描述 |
| ------ | ------ |-------------------------|
| isRegister | bool | true 开启建提高,false 关闭监听 |
**返回值说明**
无
## TXVodPlayerController类
...
...
@@ -1740,17 +1764,17 @@ Future<void> startDownload(TXVodDownloadMediaInfo mediaInfo) async
**TXVodDownloadMediaInfo**
| 参数名 | 类型 | 描述 |
| ------ | ------ |
------------------
|
| playPath | String? | 缓存地址,获得到的视频缓存会有该值,启动下载可以不赋值|
| progress | double? | 缓存进度,获得到的视频缓存会有该值,启动下载可以不赋值|
| downloadState | int? | 缓存状态,获得到的视频缓存会有该值,启动下载可以不赋值|
| userName | String? | 下载账户名称,用于区分不同账户的下载,传空则为 default|
| duration | int? | 缓存视频总时长,安卓端单位为毫秒,IOS为秒,获得到的视频缓存会有该值,启动下载可以不赋值|
| playableDuration | int? | 视频已缓存时长,安卓端单位为毫秒,IOS为秒,获得到的视频缓存会有该值,启动下载可以不赋值|
| size | int? | 文件总大小,单位:byte,获得到的视频缓存会有该值,启动下载可以不赋值|
| downloadSize | int? | 文件已下载的大小,单位:byte,获得到的视频缓存会有该值,启动下载可以不赋值|
| url | String? | 需要下载的视频url,url下载必填,不支持嵌套m3u8和mp4下载|
| dataSource | TXVodDownloadDataSource? | 需要下载的视频fileId信息,url与该参数可只使用一个|
| ------ | ------ |
-----------------------------------------------
|
| playPath | String? | 缓存地址,获得到的视频缓存会有该值,启动下载可以不赋值
|
| progress | double? | 缓存进度,获得到的视频缓存会有该值,启动下载可以不赋值
|
| downloadState | int? | 缓存状态,获得到的视频缓存会有该值,启动下载可以不赋值
|
| userName | String? | 下载账户名称,用于区分不同账户的下载,传空则为 default
,不建议设置比较长的字符串
|
| duration | int? | 缓存视频总时长,安卓端单位为毫秒,IOS为秒,获得到的视频缓存会有该值,启动下载可以不赋值
|
| playableDuration | int? | 视频已缓存时长,安卓端单位为毫秒,IOS为秒,获得到的视频缓存会有该值,启动下载可以不赋值
|
| size | int? | 文件总大小,单位:byte,获得到的视频缓存会有该值,启动下载可以不赋值
|
| downloadSize | int? | 文件已下载的大小,单位:byte,获得到的视频缓存会有该值,启动下载可以不赋值
|
| url | String? | 需要下载的视频url,url下载必填,不支持嵌套m3u8和mp4下载
|
| dataSource | TXVodDownloadDataSource? | 需要下载的视频fileId信息,url与该参数可只使用一个
|
| speed | int? | 下载速度,单位:KByte/秒 |
| isResourceBroken | bool? | 资源是否已损坏, 如:资源被删除了 |
...
...
Flutter/example/lib/demo_superplayer.dart
浏览文件 @
7db2b9ce
...
...
@@ -46,6 +46,8 @@ class _DemoSuperPlayerState extends State<DemoSuperPlayer> with TXPipPlayerResto
super
.
initState
();
// Listen for device rotation.
SuperPlayerPlugin
.
startVideoOrientationService
();
// open brightness observer
SuperPlayerPlugin
.
registerSysBrightness
(
true
);
_controller
=
SuperPlayerController
(
context
);
TXPipController
.
instance
.
setPipPlayerPage
(
this
);
FTXVodPlayConfig
config
=
FTXVodPlayConfig
();
...
...
@@ -417,6 +419,10 @@ class _DemoSuperPlayerState extends State<DemoSuperPlayer> with TXPipPlayerResto
// must invoke when page exit.
_controller
.
releasePlayer
();
simpleEventSubscription
?.
cancel
();
// restore current brightness to sys brightness
SuperPlayerPlugin
.
restorePageBrightness
();
// unregister brightness observer
SuperPlayerPlugin
.
registerSysBrightness
(
false
);
super
.
dispose
();
}
...
...
Flutter/ios/Classes/SuperPlayerPlugin.m
浏览文件 @
7db2b9ce
...
...
@@ -359,6 +359,10 @@ SuperPlayerPlugin* instance;
[
audioManager
setVolume
:
volumeNum
.
floatValue
];
}
-
(
void
)
registerSysBrightnessIsRegister
:
(
BoolMsg
*
)
isRegister
error
:
(
FlutterError
*
_Nullable
__autoreleasing
*
)
error
{
// only for android
}
#pragma mark DataBridge
-
(
NSMutableDictionary
*
)
getPlayers
{
...
...
Flutter/ios/Classes/messages/FtxMessages.h
浏览文件 @
7db2b9ce
// // Copyright (c) 2022 Tencent. All rights reserved.
// Autogenerated from Pigeon (v9.
1.2
), do not edit directly.
// Autogenerated from Pigeon (v9.
2.5
), do not edit directly.
// See also: https://pub.dev/packages/pigeon
#import <Foundation/Foundation.h>
...
...
@@ -34,6 +34,10 @@ NS_ASSUME_NONNULL_BEGIN
@class
PreLoadMsg
;
@class
MapMsg
;
/// Pigeon original component, used to generate native communication code for `messages`.
/// The generation command is as follows. When using the generation command,
/// the two import statements above need to be implemented or commented out.
///
/// pigeon原始原件,由此文件生成messages原生通信代码
/// 生成命令如下,使用生成命令的时候,需要实现注释掉以上两个import导入
@interface
PlayerMsg
:
NSObject
...
...
@@ -394,6 +398,10 @@ NSObject<FlutterMessageCodec> *TXFlutterNativeAPIGetCodec(void);
///
/// @return `nil` only when `error != nil`.
-
(
nullable
IntMsg
*
)
isDeviceSupportPipWithError
:(
FlutterError
*
_Nullable
*
_Nonnull
)
error
;
///
/// register or unregister system brightness
///
-
(
void
)
registerSysBrightnessIsRegister
:(
BoolMsg
*
)
isRegister
error
:(
FlutterError
*
_Nullable
*
_Nonnull
)
error
;
@end
extern
void
TXFlutterNativeAPISetup
(
id
<
FlutterBinaryMessenger
>
binaryMessenger
,
NSObject
<
TXFlutterNativeAPI
>
*
_Nullable
api
);
...
...
@@ -403,7 +411,9 @@ NSObject<FlutterMessageCodec> *TXFlutterVodPlayerApiGetCodec(void);
@protocol
TXFlutterVodPlayerApi
/// 播放器初始化,创建共享纹理、初始化播放器
/// @param onlyAudio 是否是纯音频模式
///
/// To initialize the player, you would need to create a shared texture and initialize the player.
/// @param onlyAudio 是否是纯音频模式 if pure audio mode
///
/// @return `nil` only when `error != nil`.
-
(
nullable
IntMsg
*
)
initializeOnlyAudio
:(
BoolPlayerMsg
*
)
onlyAudio
error
:(
FlutterError
*
_Nullable
*
_Nonnull
)
error
;
...
...
@@ -412,8 +422,16 @@ NSObject<FlutterMessageCodec> *TXFlutterVodPlayerApiGetCodec(void);
/// 否则将播放失败(黑屏),全局仅设置一次即可。直播 Licence、短视频 Licence 和视频播放 Licence 均可使用,若您暂未获取上述 Licence ,
/// 可[快速免费申请测试版 Licence](https://cloud.tencent.com/act/event/License) 以正常播放,正式版 License 需[购买]
/// (https://cloud.tencent.com/document/product/881/74588#.E8.B4.AD.E4.B9.B0.E5.B9.B6.E6.96.B0.E5.BB.BA.E6.AD.A3.E5.BC.8F.E7.89.88-license)。
/// @param url : 视频播放地址
/// return 是否播放成功
///
/// Starting from version 10.7, the method `startPlay` has been changed to `startVodPlay` for playing videos via a URL.
/// To play videos successfully, it is necessary to set the license by using the method `SuperPlayerPlugin#setGlobalLicense`.
/// Failure to set the license will result in video playback failure (a black screen).
/// Live streaming, short video, and video playback licenses can all be used. If you do not have any of the above licenses,
/// you can apply for a free trial license to play videos normally[Quickly apply for a free trial version Licence]
/// (https://cloud.tencent.com/act/event/License).Official licenses can be purchased
/// (https://cloud.tencent.com/document/product/881/74588#.E8.B4.AD.E4.B9.B0.E5.B9.B6.E6.96.B0.E5.BB.BA.E6.AD.A3.E5.BC.8F.E7.89.88-license).
/// @param url : 视频播放地址 video playback address
/// return 是否播放成功 if play successfully
///
/// @return `nil` only when `error != nil`.
-
(
nullable
BoolMsg
*
)
startVodPlayUrl
:(
StringPlayerMsg
*
)
url
error
:(
FlutterError
*
_Nullable
*
_Nonnull
)
error
;
...
...
@@ -422,85 +440,147 @@ NSObject<FlutterMessageCodec> *TXFlutterVodPlayerApiGetCodec(void);
/// 否则将播放失败(黑屏),全局仅设置一次即可。直播 Licence、短视频 Licence 和视频播放 Licence 均可使用,若您暂未获取上述 Licence ,
/// 可[快速免费申请测试版 Licence](https://cloud.tencent.com/act/event/License) 以正常播放,正式版 License 需[购买]
/// (https://cloud.tencent.com/document/product/881/74588#.E8.B4.AD.E4.B9.B0.E5.B9.B6.E6.96.B0.E5.BB.BA.E6.AD.A3.E5.BC.8F.E7.89.88-license)。
/// @params : 见[TXPlayInfoParams]
/// return 是否播放成功
///
/// Starting from version 10.7, the method "startPlayWithParams" has been changed to "startVodPlayWithParams" for playing videos using fileId.
/// To play the video successfully, you need to set the Licence using "SuperPlayerPlugin#setGlobalLicense" method before playing the video.
/// If you do not set the Licence, the video will not play (black screen). The Licence for live streaming,
/// short video, and video playback can all be used. If you have not obtained the Licence, you can apply for a free trial version [here]
/// (https://cloud.tencent.com/act/event/License) for normal playback. To use the official version, you need to [purchase]
/// (https://cloud.tencent.com/document/product/881/74588#.E8.B4.AD.E4.B9.B0.E5.B9.B6.E6.96.B0.E5.BB.BA.E6.AD.A3.E5.BC.8F.E7.89.88-license).
/// @params : see[TXPlayInfoParams]
/// return 是否播放成功 if play successful
-
(
void
)
startVodPlayWithParamsParams
:(
TXPlayInfoParamsPlayerMsg
*
)
params
error
:(
FlutterError
*
_Nullable
*
_Nonnull
)
error
;
/// 设置是否自动播放
///
/// set autoplay
-
(
void
)
setAutoPlayIsAutoPlay
:(
BoolPlayerMsg
*
)
isAutoPlay
error
:(
FlutterError
*
_Nullable
*
_Nonnull
)
error
;
/// 停止播放
/// return 是否停止成功
///
/// Stop playback
/// return 是否停止成功 if stop successful
///
/// @return `nil` only when `error != nil`.
-
(
nullable
BoolMsg
*
)
stopIsNeedClear
:(
BoolPlayerMsg
*
)
isNeedClear
error
:(
FlutterError
*
_Nullable
*
_Nonnull
)
error
;
/// 视频是否处于正在播放中
///
/// Is the video currently playing
///
/// @return `nil` only when `error != nil`.
-
(
nullable
BoolMsg
*
)
isPlayingPlayerMsg
:(
PlayerMsg
*
)
playerMsg
error
:(
FlutterError
*
_Nullable
*
_Nonnull
)
error
;
/// 视频暂停,必须在播放器开始播放的时候调用
///
/// pause video, it must be called when the player starts playing
-
(
void
)
pausePlayerMsg
:(
PlayerMsg
*
)
playerMsg
error
:(
FlutterError
*
_Nullable
*
_Nonnull
)
error
;
/// 继续播放,在暂停的时候调用
///
/// resume playback, it should be called when the video is paused
-
(
void
)
resumePlayerMsg
:(
PlayerMsg
*
)
playerMsg
error
:(
FlutterError
*
_Nullable
*
_Nonnull
)
error
;
/// 设置是否静音
///
/// Set whether to mute or not
-
(
void
)
setMuteMute
:(
BoolPlayerMsg
*
)
mute
error
:(
FlutterError
*
_Nullable
*
_Nonnull
)
error
;
/// 设置是否循环播放
///
/// Set whether to loop playback or not
-
(
void
)
setLoopLoop
:(
BoolPlayerMsg
*
)
loop
error
:(
FlutterError
*
_Nullable
*
_Nonnull
)
error
;
/// 将视频播放进度定位到指定的进度进行播放
/// progress 要定位的视频时间,单位 秒
///
/// Set the video playback progress to a specific time and start playing.
/// progress 要定位的视频时间,单位 秒 The video playback time to be located, in seconds
-
(
void
)
seekProgress
:(
DoublePlayerMsg
*
)
progress
error
:(
FlutterError
*
_Nullable
*
_Nonnull
)
error
;
/// 设置播放速率,默认速率 1
///
/// Set the playback speed, with a default speed of 1.
-
(
void
)
setRateRate
:(
DoublePlayerMsg
*
)
rate
error
:(
FlutterError
*
_Nullable
*
_Nonnull
)
error
;
/// 获得播放视频解析出来的码率信息
///
/// get the bitrate information extracted from playing a video
/// return List<Map>
/// Bitrate键值:index 码率序号,width 码率对应视频宽度,
/// height 码率对应视频高度, bitrate 码率值
/// Bitrate:index 码率序号,
/// width 码率对应视频宽度,
/// height 码率对应视频高度,
/// bitrate 码率值
///
/// Bitrate:index:bitrate index,
/// width:the video with of this bitrate,
/// height:the video height of this bitrate,
/// bitrate:bitrate value
///
/// @return `nil` only when `error != nil`.
-
(
nullable
ListMsg
*
)
getSupportedBitratePlayerMsg
:(
PlayerMsg
*
)
playerMsg
error
:(
FlutterError
*
_Nullable
*
_Nonnull
)
error
;
/// 获得当前设置的码率序号
///
/// Get the index of the current bitrate setting
///
/// @return `nil` only when `error != nil`.
-
(
nullable
IntMsg
*
)
getBitrateIndexPlayerMsg
:(
PlayerMsg
*
)
playerMsg
error
:(
FlutterError
*
_Nullable
*
_Nonnull
)
error
;
/// 设置码率序号
///
/// Set the index of the bitrate setting.
-
(
void
)
setBitrateIndexIndex
:(
IntPlayerMsg
*
)
index
error
:(
FlutterError
*
_Nullable
*
_Nonnull
)
error
;
/// 设置视频播放开始时间,单位 秒
///
/// Set the start time of the video playback, in seconds.
-
(
void
)
setStartTimeStartTime
:(
DoublePlayerMsg
*
)
startTime
error
:(
FlutterError
*
_Nullable
*
_Nonnull
)
error
;
/// 设置视频声音 0~100
///
/// Set the volume of the video, ranging from 0 to 100.
-
(
void
)
setAudioPlayOutVolumeVolume
:(
IntPlayerMsg
*
)
volume
error
:(
FlutterError
*
_Nullable
*
_Nonnull
)
error
;
/// 请求获得音频焦点
///
/// Request audio focus.
///
/// @return `nil` only when `error != nil`.
-
(
nullable
BoolMsg
*
)
setRequestAudioFocusFocus
:(
BoolPlayerMsg
*
)
focus
error
:(
FlutterError
*
_Nullable
*
_Nonnull
)
error
;
/// 设置播放器配置
/// config @see [FTXVodPlayConfigPlayerMsg]
///
/// Set player configuration
/// config @see [FTXVodPlayConfig]
-
(
void
)
setConfigConfig
:(
FTXVodPlayConfigPlayerMsg
*
)
config
error
:(
FlutterError
*
_Nullable
*
_Nonnull
)
error
;
/// 获得当前已经播放的时间,单位 秒
///
/// Get the current playback time, in seconds.
///
/// @return `nil` only when `error != nil`.
-
(
nullable
DoubleMsg
*
)
getCurrentPlaybackTimePlayerMsg
:(
PlayerMsg
*
)
playerMsg
error
:(
FlutterError
*
_Nullable
*
_Nonnull
)
error
;
/// 获得当前视频已缓存的时间
///
/// Get the current amount of video that has been buffered.
///
/// @return `nil` only when `error != nil`.
-
(
nullable
DoubleMsg
*
)
getBufferDurationPlayerMsg
:(
PlayerMsg
*
)
playerMsg
error
:(
FlutterError
*
_Nullable
*
_Nonnull
)
error
;
/// 获得当前视频的可播放时间
///
/// Get the current playable duration of the video.
///
/// @return `nil` only when `error != nil`.
-
(
nullable
DoubleMsg
*
)
getPlayableDurationPlayerMsg
:(
PlayerMsg
*
)
playerMsg
error
:(
FlutterError
*
_Nullable
*
_Nonnull
)
error
;
/// 获得当前播放视频的宽度
///
/// Get the width of the currently playing video.
///
/// @return `nil` only when `error != nil`.
-
(
nullable
IntMsg
*
)
getWidthPlayerMsg
:(
PlayerMsg
*
)
playerMsg
error
:(
FlutterError
*
_Nullable
*
_Nonnull
)
error
;
/// 获得当前播放视频的高度
///
/// Get the height of the currently playing video.
///
/// @return `nil` only when `error != nil`.
-
(
nullable
IntMsg
*
)
getHeightPlayerMsg
:(
PlayerMsg
*
)
playerMsg
error
:(
FlutterError
*
_Nullable
*
_Nonnull
)
error
;
/// 设置播放视频的token
///
/// Set the token for playing the video.
-
(
void
)
setTokenToken
:(
StringPlayerMsg
*
)
token
error
:(
FlutterError
*
_Nullable
*
_Nonnull
)
error
;
/// 当前播放的视频是否循环播放
///
/// Is the currently playing video set to loop
///
/// @return `nil` only when `error != nil`.
-
(
nullable
BoolMsg
*
)
isLoopPlayerMsg
:(
PlayerMsg
*
)
playerMsg
error
:(
FlutterError
*
_Nullable
*
_Nonnull
)
error
;
/// 开启/关闭硬件编码
///
/// Enable/Disable hardware encoding.
///
/// @return `nil` only when `error != nil`.
-
(
nullable
BoolMsg
*
)
enableHardwareDecodeEnable
:(
BoolPlayerMsg
*
)
enable
error
:(
FlutterError
*
_Nullable
*
_Nonnull
)
error
;
/// 进入画中画模式,进入画中画模式,需要适配画中画模式的界面,安卓只支持7.0以上机型
...
...
@@ -513,12 +593,16 @@ NSObject<FlutterMessageCodec> *TXFlutterVodPlayerApiGetCodec(void);
/// @return `nil` only when `error != nil`.
-
(
nullable
IntMsg
*
)
enterPictureInPictureModePipParamsMsg
:(
PipParamsPlayerMsg
*
)
pipParamsMsg
error
:(
FlutterError
*
_Nullable
*
_Nonnull
)
error
;
/// 退出画中画,如果该播放器处于画中画模式
///
/// Exit picture-in-picture mode if the video player is in picture-in-picture mode.
-
(
void
)
exitPictureInPictureModePlayerMsg
:(
PlayerMsg
*
)
playerMsg
error
:(
FlutterError
*
_Nullable
*
_Nonnull
)
error
;
-
(
void
)
initImageSpriteSpriteInfo
:(
StringListPlayerMsg
*
)
spriteInfo
error
:(
FlutterError
*
_Nullable
*
_Nonnull
)
error
;
/// @return `nil` only when `error != nil`.
-
(
nullable
UInt8ListMsg
*
)
getImageSpriteTime
:(
DoublePlayerMsg
*
)
time
error
:(
FlutterError
*
_Nullable
*
_Nonnull
)
error
;
/// 获取总时长
///
/// To get the total duration
///
/// @return `nil` only when `error != nil`.
-
(
nullable
DoubleMsg
*
)
getDurationPlayerMsg
:(
PlayerMsg
*
)
playerMsg
error
:(
FlutterError
*
_Nullable
*
_Nonnull
)
error
;
@end
...
...
Flutter/ios/Classes/messages/FtxMessages.m
浏览文件 @
7db2b9ce
// // Copyright (c) 2022 Tencent. All rights reserved.
// Autogenerated from Pigeon (v9.
1.2
), do not edit directly.
// Autogenerated from Pigeon (v9.
2.5
), do not edit directly.
// See also: https://pub.dev/packages/pigeon
#import "FtxMessages.h"
...
...
@@ -925,7 +925,7 @@ static id GetNullableObjectAtIndex(NSArray *array, NSInteger key) {
}
@end
NSObject
<
FlutterMessageCodec
>
*
TXFlutterSuperPlayerPluginAPIGetCodec
()
{
NSObject
<
FlutterMessageCodec
>
*
TXFlutterSuperPlayerPluginAPIGetCodec
(
void
)
{
static
FlutterStandardMessageCodec
*
sSharedObject
=
nil
;
static
dispatch_once_t
sPred
=
0
;
dispatch_once
(
&
sPred
,
^
{
...
...
@@ -1196,8 +1196,10 @@ void TXFlutterSuperPlayerPluginAPISetup(id<FlutterBinaryMessenger> binaryMesseng
-
(
nullable
id
)
readValueOfType
:(
UInt8
)
type
{
switch
(
type
)
{
case
128
:
return
[
Double
Msg
fromList
:[
self
readValue
]];
return
[
Bool
Msg
fromList
:[
self
readValue
]];
case
129
:
return
[
DoubleMsg
fromList
:[
self
readValue
]];
case
130
:
return
[
IntMsg
fromList
:[
self
readValue
]];
default:
return
[
super
readValueOfType
:
type
];
...
...
@@ -1209,12 +1211,15 @@ void TXFlutterSuperPlayerPluginAPISetup(id<FlutterBinaryMessenger> binaryMesseng
@end
@implementation
TXFlutterNativeAPICodecWriter
-
(
void
)
writeValue
:(
id
)
value
{
if
([
value
isKindOfClass
:[
Double
Msg
class
]])
{
if
([
value
isKindOfClass
:[
Bool
Msg
class
]])
{
[
self
writeByte
:
128
];
[
self
writeValue
:[
value
toList
]];
}
else
if
([
value
isKindOfClass
:[
Int
Msg
class
]])
{
}
else
if
([
value
isKindOfClass
:[
Double
Msg
class
]])
{
[
self
writeByte
:
129
];
[
self
writeValue
:[
value
toList
]];
}
else
if
([
value
isKindOfClass
:[
IntMsg
class
]])
{
[
self
writeByte
:
130
];
[
self
writeValue
:[
value
toList
]];
}
else
{
[
super
writeValue
:
value
];
}
...
...
@@ -1232,7 +1237,7 @@ void TXFlutterSuperPlayerPluginAPISetup(id<FlutterBinaryMessenger> binaryMesseng
}
@end
NSObject
<
FlutterMessageCodec
>
*
TXFlutterNativeAPIGetCodec
()
{
NSObject
<
FlutterMessageCodec
>
*
TXFlutterNativeAPIGetCodec
(
void
)
{
static
FlutterStandardMessageCodec
*
sSharedObject
=
nil
;
static
dispatch_once_t
sPred
=
0
;
dispatch_once
(
&
sPred
,
^
{
...
...
@@ -1414,6 +1419,28 @@ void TXFlutterNativeAPISetup(id<FlutterBinaryMessenger> binaryMessenger, NSObjec
[
channel
setMessageHandler
:
nil
];
}
}
///
/// register or unregister system brightness
///
{
FlutterBasicMessageChannel
*
channel
=
[[
FlutterBasicMessageChannel
alloc
]
initWithName
:
@"dev.flutter.pigeon.TXFlutterNativeAPI.registerSysBrightness"
binaryMessenger
:
binaryMessenger
codec
:
TXFlutterNativeAPIGetCodec
()];
if
(
api
)
{
NSCAssert
([
api
respondsToSelector
:
@selector
(
registerSysBrightnessIsRegister
:
error
:
)],
@"TXFlutterNativeAPI api (%@) doesn't respond to @selector(registerSysBrightnessIsRegister:error:)"
,
api
);
[
channel
setMessageHandler
:
^
(
id
_Nullable
message
,
FlutterReply
callback
)
{
NSArray
*
args
=
message
;
BoolMsg
*
arg_isRegister
=
GetNullableObjectAtIndex
(
args
,
0
);
FlutterError
*
error
;
[
api
registerSysBrightnessIsRegister
:
arg_isRegister
error
:
&
error
];
callback
(
wrapResult
(
nil
,
error
));
}];
}
else
{
[
channel
setMessageHandler
:
nil
];
}
}
}
@interface
TXFlutterVodPlayerApiCodecReader
:
FlutterStandardReader
@end
...
...
@@ -1517,7 +1544,7 @@ void TXFlutterNativeAPISetup(id<FlutterBinaryMessenger> binaryMessenger, NSObjec
}
@end
NSObject
<
FlutterMessageCodec
>
*
TXFlutterVodPlayerApiGetCodec
()
{
NSObject
<
FlutterMessageCodec
>
*
TXFlutterVodPlayerApiGetCodec
(
void
)
{
static
FlutterStandardMessageCodec
*
sSharedObject
=
nil
;
static
dispatch_once_t
sPred
=
0
;
dispatch_once
(
&
sPred
,
^
{
...
...
@@ -1529,7 +1556,9 @@ NSObject<FlutterMessageCodec> *TXFlutterVodPlayerApiGetCodec() {
void
TXFlutterVodPlayerApiSetup
(
id
<
FlutterBinaryMessenger
>
binaryMessenger
,
NSObject
<
TXFlutterVodPlayerApi
>
*
api
)
{
/// 播放器初始化,创建共享纹理、初始化播放器
/// @param onlyAudio 是否是纯音频模式
///
/// To initialize the player, you would need to create a shared texture and initialize the player.
/// @param onlyAudio 是否是纯音频模式 if pure audio mode
{
FlutterBasicMessageChannel
*
channel
=
[[
FlutterBasicMessageChannel
alloc
]
...
...
@@ -1554,8 +1583,16 @@ void TXFlutterVodPlayerApiSetup(id<FlutterBinaryMessenger> binaryMessenger, NSOb
/// 否则将播放失败(黑屏),全局仅设置一次即可。直播 Licence、短视频 Licence 和视频播放 Licence 均可使用,若您暂未获取上述 Licence ,
/// 可[快速免费申请测试版 Licence](https://cloud.tencent.com/act/event/License) 以正常播放,正式版 License 需[购买]
/// (https://cloud.tencent.com/document/product/881/74588#.E8.B4.AD.E4.B9.B0.E5.B9.B6.E6.96.B0.E5.BB.BA.E6.AD.A3.E5.BC.8F.E7.89.88-license)。
/// @param url : 视频播放地址
/// return 是否播放成功
///
/// Starting from version 10.7, the method `startPlay` has been changed to `startVodPlay` for playing videos via a URL.
/// To play videos successfully, it is necessary to set the license by using the method `SuperPlayerPlugin#setGlobalLicense`.
/// Failure to set the license will result in video playback failure (a black screen).
/// Live streaming, short video, and video playback licenses can all be used. If you do not have any of the above licenses,
/// you can apply for a free trial license to play videos normally[Quickly apply for a free trial version Licence]
/// (https://cloud.tencent.com/act/event/License).Official licenses can be purchased
/// (https://cloud.tencent.com/document/product/881/74588#.E8.B4.AD.E4.B9.B0.E5.B9.B6.E6.96.B0.E5.BB.BA.E6.AD.A3.E5.BC.8F.E7.89.88-license).
/// @param url : 视频播放地址 video playback address
/// return 是否播放成功 if play successfully
{
FlutterBasicMessageChannel
*
channel
=
[[
FlutterBasicMessageChannel
alloc
]
...
...
@@ -1580,8 +1617,15 @@ void TXFlutterVodPlayerApiSetup(id<FlutterBinaryMessenger> binaryMessenger, NSOb
/// 否则将播放失败(黑屏),全局仅设置一次即可。直播 Licence、短视频 Licence 和视频播放 Licence 均可使用,若您暂未获取上述 Licence ,
/// 可[快速免费申请测试版 Licence](https://cloud.tencent.com/act/event/License) 以正常播放,正式版 License 需[购买]
/// (https://cloud.tencent.com/document/product/881/74588#.E8.B4.AD.E4.B9.B0.E5.B9.B6.E6.96.B0.E5.BB.BA.E6.AD.A3.E5.BC.8F.E7.89.88-license)。
/// @params : 见[TXPlayInfoParams]
/// return 是否播放成功
///
/// Starting from version 10.7, the method "startPlayWithParams" has been changed to "startVodPlayWithParams" for playing videos using fileId.
/// To play the video successfully, you need to set the Licence using "SuperPlayerPlugin#setGlobalLicense" method before playing the video.
/// If you do not set the Licence, the video will not play (black screen). The Licence for live streaming,
/// short video, and video playback can all be used. If you have not obtained the Licence, you can apply for a free trial version [here]
/// (https://cloud.tencent.com/act/event/License) for normal playback. To use the official version, you need to [purchase]
/// (https://cloud.tencent.com/document/product/881/74588#.E8.B4.AD.E4.B9.B0.E5.B9.B6.E6.96.B0.E5.BB.BA.E6.AD.A3.E5.BC.8F.E7.89.88-license).
/// @params : see[TXPlayInfoParams]
/// return 是否播放成功 if play successful
{
FlutterBasicMessageChannel
*
channel
=
[[
FlutterBasicMessageChannel
alloc
]
...
...
@@ -1602,6 +1646,8 @@ void TXFlutterVodPlayerApiSetup(id<FlutterBinaryMessenger> binaryMessenger, NSOb
}
}
/// 设置是否自动播放
///
/// set autoplay
{
FlutterBasicMessageChannel
*
channel
=
[[
FlutterBasicMessageChannel
alloc
]
...
...
@@ -1622,7 +1668,9 @@ void TXFlutterVodPlayerApiSetup(id<FlutterBinaryMessenger> binaryMessenger, NSOb
}
}
/// 停止播放
/// return 是否停止成功
///
/// Stop playback
/// return 是否停止成功 if stop successful
{
FlutterBasicMessageChannel
*
channel
=
[[
FlutterBasicMessageChannel
alloc
]
...
...
@@ -1643,6 +1691,8 @@ void TXFlutterVodPlayerApiSetup(id<FlutterBinaryMessenger> binaryMessenger, NSOb
}
}
/// 视频是否处于正在播放中
///
/// Is the video currently playing
{
FlutterBasicMessageChannel
*
channel
=
[[
FlutterBasicMessageChannel
alloc
]
...
...
@@ -1663,6 +1713,8 @@ void TXFlutterVodPlayerApiSetup(id<FlutterBinaryMessenger> binaryMessenger, NSOb
}
}
/// 视频暂停,必须在播放器开始播放的时候调用
///
/// pause video, it must be called when the player starts playing
{
FlutterBasicMessageChannel
*
channel
=
[[
FlutterBasicMessageChannel
alloc
]
...
...
@@ -1683,6 +1735,8 @@ void TXFlutterVodPlayerApiSetup(id<FlutterBinaryMessenger> binaryMessenger, NSOb
}
}
/// 继续播放,在暂停的时候调用
///
/// resume playback, it should be called when the video is paused
{
FlutterBasicMessageChannel
*
channel
=
[[
FlutterBasicMessageChannel
alloc
]
...
...
@@ -1703,6 +1757,8 @@ void TXFlutterVodPlayerApiSetup(id<FlutterBinaryMessenger> binaryMessenger, NSOb
}
}
/// 设置是否静音
///
/// Set whether to mute or not
{
FlutterBasicMessageChannel
*
channel
=
[[
FlutterBasicMessageChannel
alloc
]
...
...
@@ -1723,6 +1779,8 @@ void TXFlutterVodPlayerApiSetup(id<FlutterBinaryMessenger> binaryMessenger, NSOb
}
}
/// 设置是否循环播放
///
/// Set whether to loop playback or not
{
FlutterBasicMessageChannel
*
channel
=
[[
FlutterBasicMessageChannel
alloc
]
...
...
@@ -1743,7 +1801,9 @@ void TXFlutterVodPlayerApiSetup(id<FlutterBinaryMessenger> binaryMessenger, NSOb
}
}
/// 将视频播放进度定位到指定的进度进行播放
/// progress 要定位的视频时间,单位 秒
///
/// Set the video playback progress to a specific time and start playing.
/// progress 要定位的视频时间,单位 秒 The video playback time to be located, in seconds
{
FlutterBasicMessageChannel
*
channel
=
[[
FlutterBasicMessageChannel
alloc
]
...
...
@@ -1764,6 +1824,8 @@ void TXFlutterVodPlayerApiSetup(id<FlutterBinaryMessenger> binaryMessenger, NSOb
}
}
/// 设置播放速率,默认速率 1
///
/// Set the playback speed, with a default speed of 1.
{
FlutterBasicMessageChannel
*
channel
=
[[
FlutterBasicMessageChannel
alloc
]
...
...
@@ -1784,9 +1846,18 @@ void TXFlutterVodPlayerApiSetup(id<FlutterBinaryMessenger> binaryMessenger, NSOb
}
}
/// 获得播放视频解析出来的码率信息
///
/// get the bitrate information extracted from playing a video
/// return List<Map>
/// Bitrate键值:index 码率序号,width 码率对应视频宽度,
/// height 码率对应视频高度, bitrate 码率值
/// Bitrate:index 码率序号,
/// width 码率对应视频宽度,
/// height 码率对应视频高度,
/// bitrate 码率值
///
/// Bitrate:index:bitrate index,
/// width:the video with of this bitrate,
/// height:the video height of this bitrate,
/// bitrate:bitrate value
{
FlutterBasicMessageChannel
*
channel
=
[[
FlutterBasicMessageChannel
alloc
]
...
...
@@ -1807,6 +1878,8 @@ void TXFlutterVodPlayerApiSetup(id<FlutterBinaryMessenger> binaryMessenger, NSOb
}
}
/// 获得当前设置的码率序号
///
/// Get the index of the current bitrate setting
{
FlutterBasicMessageChannel
*
channel
=
[[
FlutterBasicMessageChannel
alloc
]
...
...
@@ -1827,6 +1900,8 @@ void TXFlutterVodPlayerApiSetup(id<FlutterBinaryMessenger> binaryMessenger, NSOb
}
}
/// 设置码率序号
///
/// Set the index of the bitrate setting.
{
FlutterBasicMessageChannel
*
channel
=
[[
FlutterBasicMessageChannel
alloc
]
...
...
@@ -1847,6 +1922,8 @@ void TXFlutterVodPlayerApiSetup(id<FlutterBinaryMessenger> binaryMessenger, NSOb
}
}
/// 设置视频播放开始时间,单位 秒
///
/// Set the start time of the video playback, in seconds.
{
FlutterBasicMessageChannel
*
channel
=
[[
FlutterBasicMessageChannel
alloc
]
...
...
@@ -1867,6 +1944,8 @@ void TXFlutterVodPlayerApiSetup(id<FlutterBinaryMessenger> binaryMessenger, NSOb
}
}
/// 设置视频声音 0~100
///
/// Set the volume of the video, ranging from 0 to 100.
{
FlutterBasicMessageChannel
*
channel
=
[[
FlutterBasicMessageChannel
alloc
]
...
...
@@ -1887,6 +1966,8 @@ void TXFlutterVodPlayerApiSetup(id<FlutterBinaryMessenger> binaryMessenger, NSOb
}
}
/// 请求获得音频焦点
///
/// Request audio focus.
{
FlutterBasicMessageChannel
*
channel
=
[[
FlutterBasicMessageChannel
alloc
]
...
...
@@ -1907,7 +1988,9 @@ void TXFlutterVodPlayerApiSetup(id<FlutterBinaryMessenger> binaryMessenger, NSOb
}
}
/// 设置播放器配置
/// config @see [FTXVodPlayConfigPlayerMsg]
///
/// Set player configuration
/// config @see [FTXVodPlayConfig]
{
FlutterBasicMessageChannel
*
channel
=
[[
FlutterBasicMessageChannel
alloc
]
...
...
@@ -1928,6 +2011,8 @@ void TXFlutterVodPlayerApiSetup(id<FlutterBinaryMessenger> binaryMessenger, NSOb
}
}
/// 获得当前已经播放的时间,单位 秒
///
/// Get the current playback time, in seconds.
{
FlutterBasicMessageChannel
*
channel
=
[[
FlutterBasicMessageChannel
alloc
]
...
...
@@ -1948,6 +2033,8 @@ void TXFlutterVodPlayerApiSetup(id<FlutterBinaryMessenger> binaryMessenger, NSOb
}
}
/// 获得当前视频已缓存的时间
///
/// Get the current amount of video that has been buffered.
{
FlutterBasicMessageChannel
*
channel
=
[[
FlutterBasicMessageChannel
alloc
]
...
...
@@ -1968,6 +2055,8 @@ void TXFlutterVodPlayerApiSetup(id<FlutterBinaryMessenger> binaryMessenger, NSOb
}
}
/// 获得当前视频的可播放时间
///
/// Get the current playable duration of the video.
{
FlutterBasicMessageChannel
*
channel
=
[[
FlutterBasicMessageChannel
alloc
]
...
...
@@ -1988,6 +2077,8 @@ void TXFlutterVodPlayerApiSetup(id<FlutterBinaryMessenger> binaryMessenger, NSOb
}
}
/// 获得当前播放视频的宽度
///
/// Get the width of the currently playing video.
{
FlutterBasicMessageChannel
*
channel
=
[[
FlutterBasicMessageChannel
alloc
]
...
...
@@ -2008,6 +2099,8 @@ void TXFlutterVodPlayerApiSetup(id<FlutterBinaryMessenger> binaryMessenger, NSOb
}
}
/// 获得当前播放视频的高度
///
/// Get the height of the currently playing video.
{
FlutterBasicMessageChannel
*
channel
=
[[
FlutterBasicMessageChannel
alloc
]
...
...
@@ -2028,6 +2121,8 @@ void TXFlutterVodPlayerApiSetup(id<FlutterBinaryMessenger> binaryMessenger, NSOb
}
}
/// 设置播放视频的token
///
/// Set the token for playing the video.
{
FlutterBasicMessageChannel
*
channel
=
[[
FlutterBasicMessageChannel
alloc
]
...
...
@@ -2048,6 +2143,8 @@ void TXFlutterVodPlayerApiSetup(id<FlutterBinaryMessenger> binaryMessenger, NSOb
}
}
/// 当前播放的视频是否循环播放
///
/// Is the currently playing video set to loop
{
FlutterBasicMessageChannel
*
channel
=
[[
FlutterBasicMessageChannel
alloc
]
...
...
@@ -2068,6 +2165,8 @@ void TXFlutterVodPlayerApiSetup(id<FlutterBinaryMessenger> binaryMessenger, NSOb
}
}
/// 开启/关闭硬件编码
///
/// Enable/Disable hardware encoding.
{
FlutterBasicMessageChannel
*
channel
=
[[
FlutterBasicMessageChannel
alloc
]
...
...
@@ -2113,6 +2212,8 @@ void TXFlutterVodPlayerApiSetup(id<FlutterBinaryMessenger> binaryMessenger, NSOb
}
}
/// 退出画中画,如果该播放器处于画中画模式
///
/// Exit picture-in-picture mode if the video player is in picture-in-picture mode.
{
FlutterBasicMessageChannel
*
channel
=
[[
FlutterBasicMessageChannel
alloc
]
...
...
@@ -2171,6 +2272,8 @@ void TXFlutterVodPlayerApiSetup(id<FlutterBinaryMessenger> binaryMessenger, NSOb
}
}
/// 获取总时长
///
/// To get the total duration
{
FlutterBasicMessageChannel
*
channel
=
[[
FlutterBasicMessageChannel
alloc
]
...
...
@@ -2268,7 +2371,7 @@ void TXFlutterVodPlayerApiSetup(id<FlutterBinaryMessenger> binaryMessenger, NSOb
}
@end
NSObject
<
FlutterMessageCodec
>
*
TXFlutterLivePlayerApiGetCodec
()
{
NSObject
<
FlutterMessageCodec
>
*
TXFlutterLivePlayerApiGetCodec
(
void
)
{
static
FlutterStandardMessageCodec
*
sSharedObject
=
nil
;
static
dispatch_once_t
sPred
=
0
;
dispatch_once
(
&
sPred
,
^
{
...
...
@@ -2656,7 +2759,7 @@ void TXFlutterLivePlayerApiSetup(id<FlutterBinaryMessenger> binaryMessenger, NSO
}
@end
NSObject
<
FlutterMessageCodec
>
*
TXFlutterDownloadApiGetCodec
()
{
NSObject
<
FlutterMessageCodec
>
*
TXFlutterDownloadApiGetCodec
(
void
)
{
static
FlutterStandardMessageCodec
*
sSharedObject
=
nil
;
static
dispatch_once_t
sPred
=
0
;
dispatch_once
(
&
sPred
,
^
{
...
...
Flutter/lib/Core/pigeons/txplayer_message.dart
浏览文件 @
7db2b9ce
...
...
@@ -365,6 +365,11 @@ abstract class TXFlutterNativeAPI {
/// -102 画中画权限关闭/设备不支持画中画
/// -103 当前界面已销毁
IntMsg
isDeviceSupportPip
();
///
/// register or unregister system brightness
///
void
registerSysBrightness
(
BoolMsg
isRegister
);
}
@HostApi
()
...
...
Flutter/lib/Core/superplayer_plugin.dart
浏览文件 @
7db2b9ce
...
...
@@ -260,4 +260,15 @@ class SuperPlayerPlugin {
BoolMsg
boolMsg
=
await
_playerPluginApi
.
startVideoOrientationService
();
return
boolMsg
.
value
;
}
///
/// register or unregister system brightness.if register the system brightness observer,
/// current window brightness wil changed by system brightness's change.
/// <h2>only for android</h2>
/// @param isRegister:true register system brightness
/// :false unregister system brightness
///
static
Future
<
void
>
registerSysBrightness
(
bool
isRegister
)
async
{
await
_nativeAPI
.
registerSysBrightness
(
BoolMsg
()..
value
=
isRegister
);
}
}
Flutter/lib/Core/txplayer_define.dart
浏览文件 @
7db2b9ce
...
...
@@ -547,7 +547,9 @@ class TXVodDownloadDataSource {
String
?
token
;
/// Account name, used to set the account name for URL download.
/// 账户名称,用于url下载设置账户名称
/// It is not recommended to set a string that is too long,
/// Otherwise, it may lead to unforeseen problems.
/// 账户名称,用于url下载设置账户名称。不建议设置比较长的字符串,否则可能会导致不可预料的问题。
String
?
userName
;
Map
<
String
,
dynamic
>
toJson
()
{
...
...
@@ -578,7 +580,9 @@ class TXVodDownloadMediaInfo {
int
?
downloadState
;
/// Account name, used to set the account name for URL download.
/// 账户名称,用于url下载设置账户名称
/// It is not recommended to set a string that is too long,
/// Otherwise, it may lead to unforeseen problems.
/// 账户名称,用于url下载设置账户名称。不建议设置比较长的字符串,否则可能会导致不可预料的问题。
String
?
userName
;
/// Total duration.
...
...
Flutter/lib/Core/txplayer_messages.dart
浏览文件 @
7db2b9ce
// Copyright (c) 2022 Tencent. All rights reserved.
part of
SuperPlayer
;
// Autogenerated from Pigeon (v9.
1.2
), do not edit directly.
// Autogenerated from Pigeon (v9.
2.5
), do not edit directly.
// See also: https://pub.dev/packages/pigeon
// ignore_for_file: public_member_api_docs, non_constant_identifier_names, avoid_as, unused_import, unnecessary_parenthesis, prefer_null_aware_operators, omit_local_variable_types, unused_shown_name, unnecessary_import
/// Pigeon original component, used to generate native communication code for `messages`.
/// The generation command is as follows. When using the generation command,
/// the two import statements above need to be implemented or commented out.
...
...
@@ -1197,12 +1198,15 @@ class _TXFlutterNativeAPICodec extends StandardMessageCodec {
const
_TXFlutterNativeAPICodec
();
@override
void
writeValue
(
WriteBuffer
buffer
,
Object
?
value
)
{
if
(
value
is
Double
Msg
)
{
if
(
value
is
Bool
Msg
)
{
buffer
.
putUint8
(
128
);
writeValue
(
buffer
,
value
.
encode
());
}
else
if
(
value
is
Int
Msg
)
{
}
else
if
(
value
is
Double
Msg
)
{
buffer
.
putUint8
(
129
);
writeValue
(
buffer
,
value
.
encode
());
}
else
if
(
value
is
IntMsg
)
{
buffer
.
putUint8
(
130
);
writeValue
(
buffer
,
value
.
encode
());
}
else
{
super
.
writeValue
(
buffer
,
value
);
}
...
...
@@ -1212,8 +1216,10 @@ class _TXFlutterNativeAPICodec extends StandardMessageCodec {
Object
?
readValueOfType
(
int
type
,
ReadBuffer
buffer
)
{
switch
(
type
)
{
case
128
:
return
Double
Msg
.
decode
(
readValue
(
buffer
)!);
return
Bool
Msg
.
decode
(
readValue
(
buffer
)!);
case
129
:
return
DoubleMsg
.
decode
(
readValue
(
buffer
)!);
case
130
:
return
IntMsg
.
decode
(
readValue
(
buffer
)!);
default
:
return
super
.
readValueOfType
(
type
,
buffer
);
...
...
@@ -1462,6 +1468,31 @@ class TXFlutterNativeAPI {
return
(
replyList
[
0
]
as
IntMsg
?)!;
}
}
///
/// register or unregister system brightness
///
Future
<
void
>
registerSysBrightness
(
BoolMsg
arg_isRegister
)
async
{
final
BasicMessageChannel
<
Object
?>
channel
=
BasicMessageChannel
<
Object
?>(
'dev.flutter.pigeon.TXFlutterNativeAPI.registerSysBrightness'
,
codec
,
binaryMessenger:
_binaryMessenger
);
final
List
<
Object
?>?
replyList
=
await
channel
.
send
(<
Object
?>[
arg_isRegister
])
as
List
<
Object
?>?;
if
(
replyList
==
null
)
{
throw
PlatformException
(
code:
'channel-error'
,
message:
'Unable to establish connection on channel.'
,
);
}
else
if
(
replyList
.
length
>
1
)
{
throw
PlatformException
(
code:
replyList
[
0
]!
as
String
,
message:
replyList
[
1
]
as
String
?,
details:
replyList
[
2
],
);
}
else
{
return
;
}
}
}
class
_TXFlutterVodPlayerApiCodec
extends
StandardMessageCodec
{
...
...
@@ -1563,7 +1594,9 @@ class TXFlutterVodPlayerApi {
static
const
MessageCodec
<
Object
?>
codec
=
_TXFlutterVodPlayerApiCodec
();
/// 播放器初始化,创建共享纹理、初始化播放器
/// @param onlyAudio 是否是纯音频模式
///
/// To initialize the player, you would need to create a shared texture and initialize the player.
/// @param onlyAudio 是否是纯音频模式 if pure audio mode
Future
<
IntMsg
>
initialize
(
BoolPlayerMsg
arg_onlyAudio
)
async
{
final
BasicMessageChannel
<
Object
?>
channel
=
BasicMessageChannel
<
Object
?>(
'dev.flutter.pigeon.TXFlutterVodPlayerApi.initialize'
,
codec
,
...
...
@@ -1596,8 +1629,16 @@ class TXFlutterVodPlayerApi {
/// 否则将播放失败(黑屏),全局仅设置一次即可。直播 Licence、短视频 Licence 和视频播放 Licence 均可使用,若您暂未获取上述 Licence ,
/// 可[快速免费申请测试版 Licence](https://cloud.tencent.com/act/event/License) 以正常播放,正式版 License 需[购买]
/// (https://cloud.tencent.com/document/product/881/74588#.E8.B4.AD.E4.B9.B0.E5.B9.B6.E6.96.B0.E5.BB.BA.E6.AD.A3.E5.BC.8F.E7.89.88-license)。
/// @param url : 视频播放地址
/// return 是否播放成功
///
/// Starting from version 10.7, the method `startPlay` has been changed to `startVodPlay` for playing videos via a URL.
/// To play videos successfully, it is necessary to set the license by using the method `SuperPlayerPlugin#setGlobalLicense`.
/// Failure to set the license will result in video playback failure (a black screen).
/// Live streaming, short video, and video playback licenses can all be used. If you do not have any of the above licenses,
/// you can apply for a free trial license to play videos normally[Quickly apply for a free trial version Licence]
/// (https://cloud.tencent.com/act/event/License).Official licenses can be purchased
/// (https://cloud.tencent.com/document/product/881/74588#.E8.B4.AD.E4.B9.B0.E5.B9.B6.E6.96.B0.E5.BB.BA.E6.AD.A3.E5.BC.8F.E7.89.88-license).
/// @param url : 视频播放地址 video playback address
/// return 是否播放成功 if play successfully
Future
<
BoolMsg
>
startVodPlay
(
StringPlayerMsg
arg_url
)
async
{
final
BasicMessageChannel
<
Object
?>
channel
=
BasicMessageChannel
<
Object
?>(
'dev.flutter.pigeon.TXFlutterVodPlayerApi.startVodPlay'
,
codec
,
...
...
@@ -1630,8 +1671,15 @@ class TXFlutterVodPlayerApi {
/// 否则将播放失败(黑屏),全局仅设置一次即可。直播 Licence、短视频 Licence 和视频播放 Licence 均可使用,若您暂未获取上述 Licence ,
/// 可[快速免费申请测试版 Licence](https://cloud.tencent.com/act/event/License) 以正常播放,正式版 License 需[购买]
/// (https://cloud.tencent.com/document/product/881/74588#.E8.B4.AD.E4.B9.B0.E5.B9.B6.E6.96.B0.E5.BB.BA.E6.AD.A3.E5.BC.8F.E7.89.88-license)。
/// @params : 见[TXPlayInfoParams]
/// return 是否播放成功
///
/// Starting from version 10.7, the method "startPlayWithParams" has been changed to "startVodPlayWithParams" for playing videos using fileId.
/// To play the video successfully, you need to set the Licence using "SuperPlayerPlugin#setGlobalLicense" method before playing the video.
/// If you do not set the Licence, the video will not play (black screen). The Licence for live streaming,
/// short video, and video playback can all be used. If you have not obtained the Licence, you can apply for a free trial version [here]
/// (https://cloud.tencent.com/act/event/License) for normal playback. To use the official version, you need to [purchase]
/// (https://cloud.tencent.com/document/product/881/74588#.E8.B4.AD.E4.B9.B0.E5.B9.B6.E6.96.B0.E5.BB.BA.E6.AD.A3.E5.BC.8F.E7.89.88-license).
/// @params : see[TXPlayInfoParams]
/// return 是否播放成功 if play successful
Future
<
void
>
startVodPlayWithParams
(
TXPlayInfoParamsPlayerMsg
arg_params
)
async
{
final
BasicMessageChannel
<
Object
?>
channel
=
BasicMessageChannel
<
Object
?>(
'dev.flutter.pigeon.TXFlutterVodPlayerApi.startVodPlayWithParams'
,
codec
,
...
...
@@ -1655,6 +1703,8 @@ class TXFlutterVodPlayerApi {
}
/// 设置是否自动播放
///
/// set autoplay
Future
<
void
>
setAutoPlay
(
BoolPlayerMsg
arg_isAutoPlay
)
async
{
final
BasicMessageChannel
<
Object
?>
channel
=
BasicMessageChannel
<
Object
?>(
'dev.flutter.pigeon.TXFlutterVodPlayerApi.setAutoPlay'
,
codec
,
...
...
@@ -1678,7 +1728,9 @@ class TXFlutterVodPlayerApi {
}
/// 停止播放
/// return 是否停止成功
///
/// Stop playback
/// return 是否停止成功 if stop successful
Future
<
BoolMsg
>
stop
(
BoolPlayerMsg
arg_isNeedClear
)
async
{
final
BasicMessageChannel
<
Object
?>
channel
=
BasicMessageChannel
<
Object
?>(
'dev.flutter.pigeon.TXFlutterVodPlayerApi.stop'
,
codec
,
...
...
@@ -1707,6 +1759,8 @@ class TXFlutterVodPlayerApi {
}
/// 视频是否处于正在播放中
///
/// Is the video currently playing
Future
<
BoolMsg
>
isPlaying
(
PlayerMsg
arg_playerMsg
)
async
{
final
BasicMessageChannel
<
Object
?>
channel
=
BasicMessageChannel
<
Object
?>(
'dev.flutter.pigeon.TXFlutterVodPlayerApi.isPlaying'
,
codec
,
...
...
@@ -1735,6 +1789,8 @@ class TXFlutterVodPlayerApi {
}
/// 视频暂停,必须在播放器开始播放的时候调用
///
/// pause video, it must be called when the player starts playing
Future
<
void
>
pause
(
PlayerMsg
arg_playerMsg
)
async
{
final
BasicMessageChannel
<
Object
?>
channel
=
BasicMessageChannel
<
Object
?>(
'dev.flutter.pigeon.TXFlutterVodPlayerApi.pause'
,
codec
,
...
...
@@ -1758,6 +1814,8 @@ class TXFlutterVodPlayerApi {
}
/// 继续播放,在暂停的时候调用
///
/// resume playback, it should be called when the video is paused
Future
<
void
>
resume
(
PlayerMsg
arg_playerMsg
)
async
{
final
BasicMessageChannel
<
Object
?>
channel
=
BasicMessageChannel
<
Object
?>(
'dev.flutter.pigeon.TXFlutterVodPlayerApi.resume'
,
codec
,
...
...
@@ -1781,6 +1839,8 @@ class TXFlutterVodPlayerApi {
}
/// 设置是否静音
///
/// Set whether to mute or not
Future
<
void
>
setMute
(
BoolPlayerMsg
arg_mute
)
async
{
final
BasicMessageChannel
<
Object
?>
channel
=
BasicMessageChannel
<
Object
?>(
'dev.flutter.pigeon.TXFlutterVodPlayerApi.setMute'
,
codec
,
...
...
@@ -1804,6 +1864,8 @@ class TXFlutterVodPlayerApi {
}
/// 设置是否循环播放
///
/// Set whether to loop playback or not
Future
<
void
>
setLoop
(
BoolPlayerMsg
arg_loop
)
async
{
final
BasicMessageChannel
<
Object
?>
channel
=
BasicMessageChannel
<
Object
?>(
'dev.flutter.pigeon.TXFlutterVodPlayerApi.setLoop'
,
codec
,
...
...
@@ -1827,7 +1889,9 @@ class TXFlutterVodPlayerApi {
}
/// 将视频播放进度定位到指定的进度进行播放
/// progress 要定位的视频时间,单位 秒
///
/// Set the video playback progress to a specific time and start playing.
/// progress 要定位的视频时间,单位 秒 The video playback time to be located, in seconds
Future
<
void
>
seek
(
DoublePlayerMsg
arg_progress
)
async
{
final
BasicMessageChannel
<
Object
?>
channel
=
BasicMessageChannel
<
Object
?>(
'dev.flutter.pigeon.TXFlutterVodPlayerApi.seek'
,
codec
,
...
...
@@ -1851,6 +1915,8 @@ class TXFlutterVodPlayerApi {
}
/// 设置播放速率,默认速率 1
///
/// Set the playback speed, with a default speed of 1.
Future
<
void
>
setRate
(
DoublePlayerMsg
arg_rate
)
async
{
final
BasicMessageChannel
<
Object
?>
channel
=
BasicMessageChannel
<
Object
?>(
'dev.flutter.pigeon.TXFlutterVodPlayerApi.setRate'
,
codec
,
...
...
@@ -1874,9 +1940,18 @@ class TXFlutterVodPlayerApi {
}
/// 获得播放视频解析出来的码率信息
///
/// get the bitrate information extracted from playing a video
/// return List<Map>
/// Bitrate键值:index 码率序号,width 码率对应视频宽度,
/// height 码率对应视频高度, bitrate 码率值
/// Bitrate:index 码率序号,
/// width 码率对应视频宽度,
/// height 码率对应视频高度,
/// bitrate 码率值
///
/// Bitrate:index:bitrate index,
/// width:the video with of this bitrate,
/// height:the video height of this bitrate,
/// bitrate:bitrate value
Future
<
ListMsg
>
getSupportedBitrate
(
PlayerMsg
arg_playerMsg
)
async
{
final
BasicMessageChannel
<
Object
?>
channel
=
BasicMessageChannel
<
Object
?>(
'dev.flutter.pigeon.TXFlutterVodPlayerApi.getSupportedBitrate'
,
codec
,
...
...
@@ -1905,6 +1980,8 @@ class TXFlutterVodPlayerApi {
}
/// 获得当前设置的码率序号
///
/// Get the index of the current bitrate setting
Future
<
IntMsg
>
getBitrateIndex
(
PlayerMsg
arg_playerMsg
)
async
{
final
BasicMessageChannel
<
Object
?>
channel
=
BasicMessageChannel
<
Object
?>(
'dev.flutter.pigeon.TXFlutterVodPlayerApi.getBitrateIndex'
,
codec
,
...
...
@@ -1933,6 +2010,8 @@ class TXFlutterVodPlayerApi {
}
/// 设置码率序号
///
/// Set the index of the bitrate setting.
Future
<
void
>
setBitrateIndex
(
IntPlayerMsg
arg_index
)
async
{
final
BasicMessageChannel
<
Object
?>
channel
=
BasicMessageChannel
<
Object
?>(
'dev.flutter.pigeon.TXFlutterVodPlayerApi.setBitrateIndex'
,
codec
,
...
...
@@ -1956,6 +2035,8 @@ class TXFlutterVodPlayerApi {
}
/// 设置视频播放开始时间,单位 秒
///
/// Set the start time of the video playback, in seconds.
Future
<
void
>
setStartTime
(
DoublePlayerMsg
arg_startTime
)
async
{
final
BasicMessageChannel
<
Object
?>
channel
=
BasicMessageChannel
<
Object
?>(
'dev.flutter.pigeon.TXFlutterVodPlayerApi.setStartTime'
,
codec
,
...
...
@@ -1979,6 +2060,8 @@ class TXFlutterVodPlayerApi {
}
/// 设置视频声音 0~100
///
/// Set the volume of the video, ranging from 0 to 100.
Future
<
void
>
setAudioPlayOutVolume
(
IntPlayerMsg
arg_volume
)
async
{
final
BasicMessageChannel
<
Object
?>
channel
=
BasicMessageChannel
<
Object
?>(
'dev.flutter.pigeon.TXFlutterVodPlayerApi.setAudioPlayOutVolume'
,
codec
,
...
...
@@ -2002,6 +2085,8 @@ class TXFlutterVodPlayerApi {
}
/// 请求获得音频焦点
///
/// Request audio focus.
Future
<
BoolMsg
>
setRequestAudioFocus
(
BoolPlayerMsg
arg_focus
)
async
{
final
BasicMessageChannel
<
Object
?>
channel
=
BasicMessageChannel
<
Object
?>(
'dev.flutter.pigeon.TXFlutterVodPlayerApi.setRequestAudioFocus'
,
codec
,
...
...
@@ -2030,7 +2115,9 @@ class TXFlutterVodPlayerApi {
}
/// 设置播放器配置
/// config @see [FTXVodPlayConfigPlayerMsg]
///
/// Set player configuration
/// config @see [FTXVodPlayConfig]
Future
<
void
>
setConfig
(
FTXVodPlayConfigPlayerMsg
arg_config
)
async
{
final
BasicMessageChannel
<
Object
?>
channel
=
BasicMessageChannel
<
Object
?>(
'dev.flutter.pigeon.TXFlutterVodPlayerApi.setConfig'
,
codec
,
...
...
@@ -2054,6 +2141,8 @@ class TXFlutterVodPlayerApi {
}
/// 获得当前已经播放的时间,单位 秒
///
/// Get the current playback time, in seconds.
Future
<
DoubleMsg
>
getCurrentPlaybackTime
(
PlayerMsg
arg_playerMsg
)
async
{
final
BasicMessageChannel
<
Object
?>
channel
=
BasicMessageChannel
<
Object
?>(
'dev.flutter.pigeon.TXFlutterVodPlayerApi.getCurrentPlaybackTime'
,
codec
,
...
...
@@ -2082,6 +2171,8 @@ class TXFlutterVodPlayerApi {
}
/// 获得当前视频已缓存的时间
///
/// Get the current amount of video that has been buffered.
Future
<
DoubleMsg
>
getBufferDuration
(
PlayerMsg
arg_playerMsg
)
async
{
final
BasicMessageChannel
<
Object
?>
channel
=
BasicMessageChannel
<
Object
?>(
'dev.flutter.pigeon.TXFlutterVodPlayerApi.getBufferDuration'
,
codec
,
...
...
@@ -2110,6 +2201,8 @@ class TXFlutterVodPlayerApi {
}
/// 获得当前视频的可播放时间
///
/// Get the current playable duration of the video.
Future
<
DoubleMsg
>
getPlayableDuration
(
PlayerMsg
arg_playerMsg
)
async
{
final
BasicMessageChannel
<
Object
?>
channel
=
BasicMessageChannel
<
Object
?>(
'dev.flutter.pigeon.TXFlutterVodPlayerApi.getPlayableDuration'
,
codec
,
...
...
@@ -2138,6 +2231,8 @@ class TXFlutterVodPlayerApi {
}
/// 获得当前播放视频的宽度
///
/// Get the width of the currently playing video.
Future
<
IntMsg
>
getWidth
(
PlayerMsg
arg_playerMsg
)
async
{
final
BasicMessageChannel
<
Object
?>
channel
=
BasicMessageChannel
<
Object
?>(
'dev.flutter.pigeon.TXFlutterVodPlayerApi.getWidth'
,
codec
,
...
...
@@ -2166,6 +2261,8 @@ class TXFlutterVodPlayerApi {
}
/// 获得当前播放视频的高度
///
/// Get the height of the currently playing video.
Future
<
IntMsg
>
getHeight
(
PlayerMsg
arg_playerMsg
)
async
{
final
BasicMessageChannel
<
Object
?>
channel
=
BasicMessageChannel
<
Object
?>(
'dev.flutter.pigeon.TXFlutterVodPlayerApi.getHeight'
,
codec
,
...
...
@@ -2194,6 +2291,8 @@ class TXFlutterVodPlayerApi {
}
/// 设置播放视频的token
///
/// Set the token for playing the video.
Future
<
void
>
setToken
(
StringPlayerMsg
arg_token
)
async
{
final
BasicMessageChannel
<
Object
?>
channel
=
BasicMessageChannel
<
Object
?>(
'dev.flutter.pigeon.TXFlutterVodPlayerApi.setToken'
,
codec
,
...
...
@@ -2217,6 +2316,8 @@ class TXFlutterVodPlayerApi {
}
/// 当前播放的视频是否循环播放
///
/// Is the currently playing video set to loop
Future
<
BoolMsg
>
isLoop
(
PlayerMsg
arg_playerMsg
)
async
{
final
BasicMessageChannel
<
Object
?>
channel
=
BasicMessageChannel
<
Object
?>(
'dev.flutter.pigeon.TXFlutterVodPlayerApi.isLoop'
,
codec
,
...
...
@@ -2245,6 +2346,8 @@ class TXFlutterVodPlayerApi {
}
/// 开启/关闭硬件编码
///
/// Enable/Disable hardware encoding.
Future
<
BoolMsg
>
enableHardwareDecode
(
BoolPlayerMsg
arg_enable
)
async
{
final
BasicMessageChannel
<
Object
?>
channel
=
BasicMessageChannel
<
Object
?>(
'dev.flutter.pigeon.TXFlutterVodPlayerApi.enableHardwareDecode'
,
codec
,
...
...
@@ -2306,6 +2409,8 @@ class TXFlutterVodPlayerApi {
}
/// 退出画中画,如果该播放器处于画中画模式
///
/// Exit picture-in-picture mode if the video player is in picture-in-picture mode.
Future
<
void
>
exitPictureInPictureMode
(
PlayerMsg
arg_playerMsg
)
async
{
final
BasicMessageChannel
<
Object
?>
channel
=
BasicMessageChannel
<
Object
?>(
'dev.flutter.pigeon.TXFlutterVodPlayerApi.exitPictureInPictureMode'
,
codec
,
...
...
@@ -2378,6 +2483,8 @@ class TXFlutterVodPlayerApi {
}
/// 获取总时长
///
/// To get the total duration
Future
<
DoubleMsg
>
getDuration
(
PlayerMsg
arg_playerMsg
)
async
{
final
BasicMessageChannel
<
Object
?>
channel
=
BasicMessageChannel
<
Object
?>(
'dev.flutter.pigeon.TXFlutterVodPlayerApi.getDuration'
,
codec
,
...
...
Flutter/superplayer_widget/lib/ui/superplayer_more_view.dart
浏览文件 @
7db2b9ce
...
...
@@ -300,7 +300,6 @@ class _SuperPlayerMoreViewState extends State<SuperPlayerMoreView> {
void
dispose
()
{
super
.
dispose
();
eventSubscription
?.
cancel
();
SuperPlayerPlugin
.
restorePageBrightness
();
}
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论