Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
T
tx_player_fork
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
蒋俊
tx_player_fork
Commits
1e28cabf
提交
1e28cabf
authored
9月 02, 2022
作者:
kongdywang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix bug about volume and live
上级
a3fbe87c
显示空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
42 行增加
和
16 行删除
+42
-16
demo_txLiveplayer.dart
Flutter/example/lib/demo_txLiveplayer.dart
+6
-5
FTXAudioManager.h
Flutter/ios/Classes/FTXAudioManager.h
+2
-4
FTXAudioManager.m
Flutter/ios/Classes/FTXAudioManager.m
+3
-0
FTXTransformation.m
Flutter/ios/Classes/FTXTransformation.m
+24
-1
SuperPlayerPlugin.m
Flutter/ios/Classes/SuperPlayerPlugin.m
+7
-6
没有找到文件。
Flutter/example/lib/demo_txLiveplayer.dart
浏览文件 @
1e28cabf
...
@@ -81,15 +81,16 @@ class _DemoTXLivelayerState extends State<DemoTXLivePlayer> with WidgetsBindingO
...
@@ -81,15 +81,16 @@ class _DemoTXLivelayerState extends State<DemoTXLivePlayer> with WidgetsBindingO
await
SuperPlayerPlugin
.
setConsoleEnabled
(
true
);
await
SuperPlayerPlugin
.
setConsoleEnabled
(
true
);
await
_controller
.
initialize
();
await
_controller
.
initialize
();
await
_controller
.
setConfig
(
FTXLivePlayConfig
());
// 安卓需要设置hls格式才可正常播放
// 安卓需要设置hls格式才可正常播放
await
_controller
.
p
lay
(
_url
,
playType:
TXPlayType
.
LIVE_FLV
);
await
_controller
.
startP
lay
(
_url
,
playType:
TXPlayType
.
LIVE_FLV
);
}
}
@override
@override
void
initState
()
{
void
initState
()
{
super
.
initState
();
super
.
initState
();
init
();
init
();
WidgetsBinding
.
instance
?
.
addObserver
(
this
);
WidgetsBinding
.
instance
.
addObserver
(
this
);
EasyLoading
.
show
(
status:
'loading...'
);
EasyLoading
.
show
(
status:
'loading...'
);
}
}
...
@@ -207,7 +208,7 @@ class _DemoTXLivelayerState extends State<DemoTXLivePlayer> with WidgetsBindingO
...
@@ -207,7 +208,7 @@ class _DemoTXLivelayerState extends State<DemoTXLivePlayer> with WidgetsBindingO
),
),
new
GestureDetector
(
new
GestureDetector
(
onTap:
()
async
{
onTap:
()
async
{
_controller
.
p
lay
(
_url
,
playType:
TXPlayType
.
LIVE_FLV
);
_controller
.
startP
lay
(
_url
,
playType:
TXPlayType
.
LIVE_FLV
);
},
},
child:
Container
(
child:
Container
(
color:
Colors
.
transparent
,
color:
Colors
.
transparent
,
...
@@ -290,7 +291,7 @@ class _DemoTXLivelayerState extends State<DemoTXLivePlayer> with WidgetsBindingO
...
@@ -290,7 +291,7 @@ class _DemoTXLivelayerState extends State<DemoTXLivePlayer> with WidgetsBindingO
playNetEventSubscription
?.
cancel
();
playNetEventSubscription
?.
cancel
();
_controller
.
dispose
();
_controller
.
dispose
();
super
.
dispose
();
super
.
dispose
();
WidgetsBinding
.
instance
?
.
removeObserver
(
this
);
WidgetsBinding
.
instance
.
removeObserver
(
this
);
EasyLoading
.
dismiss
();
EasyLoading
.
dismiss
();
}
}
...
@@ -302,7 +303,7 @@ class _DemoTXLivelayerState extends State<DemoTXLivePlayer> with WidgetsBindingO
...
@@ -302,7 +303,7 @@ class _DemoTXLivelayerState extends State<DemoTXLivePlayer> with WidgetsBindingO
_url
=
url
;
_url
=
url
;
_controller
.
stop
();
_controller
.
stop
();
if
(
url
.
isNotEmpty
)
{
if
(
url
.
isNotEmpty
)
{
_controller
.
p
lay
(
url
);
_controller
.
startP
lay
(
url
);
}
}
},
showFileEdited:
false
);
},
showFileEdited:
false
);
});
});
...
...
Flutter/ios/Classes/FTXAudioManager.h
浏览文件 @
1e28cabf
...
@@ -12,10 +12,8 @@
...
@@ -12,10 +12,8 @@
-
(
void
)
setVolumeUIVisible
:(
BOOL
)
volumeUIVisible
;
-
(
void
)
setVolumeUIVisible
:(
BOOL
)
volumeUIVisible
;
-
(
void
)
registerVolumeChangeListener
:(
_Nonnull
id
)
observer
selector
:(
_Nonnull
SEL
)
aSelector
-
(
void
)
registerVolumeChangeListener
:(
_Nonnull
id
)
observer
;
name
:(
nullable
NSNotificationName
)
aName
object
:(
nullable
id
)
anObject
;
-
(
void
)
destory
:(
_Nonnull
id
)
observer
name
:(
nullable
NSNotificationName
)
aName
-
(
void
)
destory
:(
_Nonnull
id
)
observer
;
object
:(
nullable
id
)
anObject
;
@end
@end
Flutter/ios/Classes/FTXAudioManager.m
浏览文件 @
1e28cabf
...
@@ -5,7 +5,10 @@
...
@@ -5,7 +5,10 @@
@implementation
FTXAudioManager
@implementation
FTXAudioManager
UISlider
*
_volumeSlider
;
UISlider
*
_volumeSlider
;
MPVolumeView
*
volumeView
;
MPVolumeView
*
volumeView
;
AVAudioSession
*
audioSession
;
NSString
*
const
LOW_VERSION_NOTIFCATION_NAME
=
@"AVSystemController_SystemVolumeDidChangeNotification"
;
NSString
*
const
NOTIFCATION_NAME
=
@"SystemVolumeDidChange"
;
-
(
instancetype
)
init
-
(
instancetype
)
init
{
{
...
...
Flutter/ios/Classes/FTXTransformation.m
浏览文件 @
1e28cabf
...
@@ -4,7 +4,7 @@
...
@@ -4,7 +4,7 @@
@implementation
FTXTransformation
@implementation
FTXTransformation
+
(
TXVodPlayConfig
*
)
transformToConfig
:(
NSDictionary
*
)
args
+
(
TXVodPlayConfig
*
)
transformTo
Vod
Config
:(
NSDictionary
*
)
args
{
{
TXVodPlayConfig
*
playConfig
=
[[
TXVodPlayConfig
alloc
]
init
];
TXVodPlayConfig
*
playConfig
=
[[
TXVodPlayConfig
alloc
]
init
];
playConfig
.
connectRetryCount
=
[
args
[
@"config"
][
@"connectRetryCount"
]
intValue
];
playConfig
.
connectRetryCount
=
[
args
[
@"config"
][
@"connectRetryCount"
]
intValue
];
...
@@ -48,6 +48,29 @@
...
@@ -48,6 +48,29 @@
return
playConfig
;
return
playConfig
;
}
}
+
(
TXLivePlayConfig
*
)
transformToLiveConfig
:(
NSDictionary
*
)
args
{
TXLivePlayConfig
*
playConfig
=
[[
TXLivePlayConfig
alloc
]
init
];
playConfig
.
cacheTime
=
[
args
[
@"config"
][
@"cacheTime"
]
floatValue
];
playConfig
.
maxAutoAdjustCacheTime
=
[
args
[
@"config"
][
@"maxAutoAdjustCacheTime"
]
floatValue
];
playConfig
.
minAutoAdjustCacheTime
=
[
args
[
@"config"
][
@"minAutoAdjustCacheTime"
]
floatValue
];
playConfig
.
videoBlockThreshold
=
[
args
[
@"config"
][
@"videoBlockThreshold"
]
intValue
];
playConfig
.
connectRetryCount
=
[
args
[
@"config"
][
@"connectRetryCount"
]
intValue
];
playConfig
.
connectRetryInterval
=
[
args
[
@"config"
][
@"connectRetryInterval"
]
intValue
];
playConfig
.
bAutoAdjustCacheTime
=
[
args
[
@"config"
][
@"autoAdjustCacheTime"
]
boolValue
];
playConfig
.
enableAEC
=
[
args
[
@"config"
][
@"enableAec"
]
boolValue
];
playConfig
.
enableMessage
=
[
args
[
@"config"
][
@"enableMessage"
]
intValue
];
playConfig
.
enableMetaData
=
[
args
[
@"config"
][
@"enableMetaData"
]
intValue
];
NSString
*
flvSessionKey
=
args
[
@"config"
][
@"flvSessionKey"
];
if
(
flvSessionKey
!=
nil
&&
flvSessionKey
.
length
>
0
)
{
playConfig
.
flvSessionKey
=
flvSessionKey
;
}
return
playConfig
;
}
@end
@end
Flutter/ios/Classes/SuperPlayerPlugin.m
浏览文件 @
1e28cabf
...
@@ -5,8 +5,9 @@
...
@@ -5,8 +5,9 @@
#import "FTXTransformation.h"
#import "FTXTransformation.h"
#import "FTXPlayerEventSinkQueue.h"
#import "FTXPlayerEventSinkQueue.h"
#import "FTXEvent.h"
#import "FTXEvent.h"
#import
"FTXAudioManager.h"
#import
<MediaPlayer/MediaPlayer.h>
#import <TXLiteAVSDK_Player/TXLiteAVSDK.h>
#import <TXLiteAVSDK_Player/TXLiteAVSDK.h>
#import "FTXAudioManager.h"
#import "FTXDownloadManager.h"
#import "FTXDownloadManager.h"
@interface
SuperPlayerPlugin
()
<
FlutterStreamHandler
,
FTXVodPlayerDelegate
>
@interface
SuperPlayerPlugin
()
<
FlutterStreamHandler
,
FTXVodPlayerDelegate
>
...
@@ -64,10 +65,9 @@ SuperPlayerPlugin* instance;
...
@@ -64,10 +65,9 @@ SuperPlayerPlugin* instance;
_eventChannel
=
[
FlutterEventChannel
eventChannelWithName
:
@"cloud.tencent.com/playerPlugin/event"
binaryMessenger
:[
registrar
messenger
]];
_eventChannel
=
[
FlutterEventChannel
eventChannelWithName
:
@"cloud.tencent.com/playerPlugin/event"
binaryMessenger
:[
registrar
messenger
]];
_pipEventChannel
=
[
FlutterEventChannel
eventChannelWithName
:
@"cloud.tencent.com/playerPlugin/pipEvent"
binaryMessenger
:[
registrar
messenger
]];
_pipEventChannel
=
[
FlutterEventChannel
eventChannelWithName
:
@"cloud.tencent.com/playerPlugin/pipEvent"
binaryMessenger
:[
registrar
messenger
]];
[
_eventChannel
setStreamHandler
:
self
];
[
_eventChannel
setStreamHandler
:
self
];
[
audioManager
registerVolumeChangeListener
:
self
selector
:
@selector
(
systemVolumeDidChangeNoti
:
)
name
:
@"AVSystemController_SystemVolumeDidChangeNotification"
object
:
nil
];
// pip
[
_pipEventChannel
setStreamHandler
:
self
];
[
_pipEventChannel
setStreamHandler
:
self
];
// download
[
audioManager
registerVolumeChangeListener
:
self
];
_FTXDownloadManager
=
[[
FTXDownloadManager
alloc
]
initWithRegistrar
:
registrar
];
_FTXDownloadManager
=
[[
FTXDownloadManager
alloc
]
initWithRegistrar
:
registrar
];
// orientation
// orientation
mCurrentOrientation
=
ORIENTATION_PORTRAIT_UP
;
mCurrentOrientation
=
ORIENTATION_PORTRAIT_UP
;
...
@@ -79,7 +79,8 @@ SuperPlayerPlugin* instance;
...
@@ -79,7 +79,8 @@ SuperPlayerPlugin* instance;
return
self
;
return
self
;
}
}
-
(
void
)
systemVolumeDidChangeNoti
:(
NSNotification
*
)
noti
{
-
(
void
)
observeValueForKeyPath
:(
NSString
*
)
keyPath
ofObject
:(
id
)
object
change
:(
NSDictionary
<
NSKeyValueChangeKey
,
id
>
*
)
change
context
:(
void
*
)
context
{
[
_eventSink
success
:[
SuperPlayerPlugin
getParamsWithEvent
:
EVENT_VOLUME_CHANGED
withParams
:@{}]];
[
_eventSink
success
:[
SuperPlayerPlugin
getParamsWithEvent
:
EVENT_VOLUME_CHANGED
withParams
:@{}]];
}
}
...
@@ -207,7 +208,7 @@ SuperPlayerPlugin* instance;
...
@@ -207,7 +208,7 @@ SuperPlayerPlugin* instance;
-
(
void
)
destory
-
(
void
)
destory
{
{
[
audioManager
destory
:
self
name
:
@"AVSystemController_SystemVolumeDidChangeNotification"
object
:
nil
];
[
audioManager
destory
:
self
];
}
}
#pragma mark - FlutterStreamHandler
#pragma mark - FlutterStreamHandler
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论