Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
T
tx_player_fork
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
蒋俊
tx_player_fork
Commits
0e174025
提交
0e174025
authored
9月 29, 2021
作者:
kongdywang
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'main' of
https://github.com/tencentyun/SuperPlayer
into main
Conflicts: Flutter/android/src/main/java/com/example/super_player/SuperPlatformPlayerView.java Flutter/lib/Core/txplayer_define.dart
上级
24d8d849
469d52b1
隐藏空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
84 行增加
和
58 行删除
+84
-58
SuperPlatformPlayerView.java
...ava/com/example/super_player/SuperPlatformPlayerView.java
+29
-8
test_superplayer.dart
Flutter/example/lib/test_superplayer.dart
+28
-16
SuperPlatformPlayerView.m
Flutter/ios/Classes/SuperPlatformPlayerView.m
+19
-9
superplayerview_controller.dart
Flutter/lib/Core/superplayerview_controller.dart
+2
-17
txplayer_define.dart
Flutter/lib/Core/txplayer_define.dart
+6
-8
没有找到文件。
Flutter/android/src/main/java/com/example/super_player/SuperPlatformPlayerView.java
浏览文件 @
0e174025
package
com
.
example
.
super_player
;
import
android.content.Context
;
import
android.os.Bundle
;
import
android.view.View
;
import
androidx.annotation.NonNull
;
...
...
@@ -12,8 +13,10 @@ import com.tencent.liteav.demo.superplayer.SuperPlayerView;
import
com.tencent.rtmp.TXLiveBase
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Set
;
import
io.flutter.embedding.engine.plugins.FlutterPlugin
;
import
io.flutter.plugin.common.EventChannel
;
...
...
@@ -90,42 +93,42 @@ public class SuperPlatformPlayerView implements PlatformView, MethodChannel.Meth
@Override
public
void
onStartFullScreenPlay
()
{
mEventSink
.
success
(
"onStartFullScreenPlay"
);
mEventSink
.
success
(
getParams
(
"onStartFullScreenPlay"
,
null
)
);
}
@Override
public
void
onStopFullScreenPlay
()
{
mEventSink
.
success
(
"onStopFullScreenPlay"
);
mEventSink
.
success
(
getParams
(
"onStopFullScreenPlay"
,
null
)
);
}
@Override
public
void
onClickFloatCloseBtn
()
{
mEventSink
.
success
(
"onClickFloatCloseBtn"
);
mEventSink
.
success
(
getParams
(
"onClickFloatCloseBtn"
,
null
)
);
}
@Override
public
void
onSuperPlayerBackAction
()
{
mEventSink
.
success
(
"onSuperPlayerBackAction"
);
mEventSink
.
success
(
getParams
(
"onSuperPlayerBackAction"
,
null
)
);
}
@Override
public
void
onStartFloatWindowPlay
()
{
mEventSink
.
success
(
"onStartFloatWindowPlay"
);
mEventSink
.
success
(
getParams
(
"onStartFloatWindowPlay"
,
null
)
);
}
@Override
public
void
onSuperPlayerDidStart
()
{
mEventSink
.
success
(
"onSuperPlayerDidStart"
);
mEventSink
.
success
(
getParams
(
"onSuperPlayerDidStart"
,
null
)
);
}
@Override
public
void
onSuperPlayerDidEnd
()
{
mEventSink
.
success
(
"onSuperPlayerDidEnd"
);
mEventSink
.
success
(
getParams
(
"onSuperPlayerDidEnd"
,
null
)
);
}
@Override
public
void
onSuperPlayerError
()
{
mEventSink
.
success
(
"onSuperPlayerError"
);
mEventSink
.
success
(
getParams
(
"onSuperPlayerError"
,
null
)
);
}
@Override
...
...
@@ -259,4 +262,22 @@ public class SuperPlatformPlayerView implements PlatformView, MethodChannel.Meth
public
void
setLoop
(
boolean
b
)
{
mSuperPlayerView
.
setLoop
(
b
);
}
private
Map
<
String
,
Object
>
getParams
(
String
event
,
Bundle
bundle
)
{
Map
<
String
,
Object
>
param
=
new
HashMap
();
if
(!
event
.
isEmpty
())
{
param
.
put
(
"event"
,
event
);
}
if
(
bundle
!=
null
&&
!
bundle
.
isEmpty
())
{
Set
<
String
>
keySet
=
bundle
.
keySet
();
for
(
String
key
:
keySet
)
{
Object
val
=
bundle
.
get
(
key
);
param
.
put
(
key
,
val
);
}
}
return
param
;
}
}
Flutter/example/lib/test_superplayer.dart
浏览文件 @
0e174025
...
...
@@ -115,23 +115,35 @@ class _TestSuperPlayerState extends State<TestSuperPlayer> {
_playerController
.
setPlayConfig
(
_playerConfig
);
_playerController
.
onPlayerEventBroadcast
.
listen
((
event
)
{
setState
(()
{
if
(
event
==
SuperPlayerViewEvent
.
onStartFullScreenPlay
)
{
_isFullSceen
=
true
;
AutoOrientation
.
landscapeAutoMode
();
///关闭状态栏,与底部虚拟操作按钮
SystemChrome
.
setEnabledSystemUIOverlays
([]);
}
else
{
_isFullSceen
=
false
;
/// 如果是全屏就切换竖屏
AutoOrientation
.
portraitAutoMode
();
///显示状态栏,与底部虚拟操作按钮
SystemChrome
.
setEnabledSystemUIOverlays
(
[
SystemUiOverlay
.
top
,
SystemUiOverlay
.
bottom
]);
String
evtName
=
event
[
"event"
];
if
(
evtName
==
SuperPlayerViewEvent
.
onStartFullScreenPlay
)
{
if
(
defaultTargetPlatform
==
TargetPlatform
.
android
)
{
_isFullSceen
=
true
;
AutoOrientation
.
landscapeAutoMode
();
///关闭状态栏,与底部虚拟操作按钮
SystemChrome
.
setEnabledSystemUIOverlays
([]);
}
print
(
"onStartFullScreenPlay"
);
}
else
if
(
evtName
==
SuperPlayerViewEvent
.
onStopFullScreenPlay
){
if
(
defaultTargetPlatform
==
TargetPlatform
.
android
)
{
_isFullSceen
=
false
;
/// 如果是全屏就切换竖屏
AutoOrientation
.
portraitAutoMode
();
///显示状态栏,与底部虚拟操作按钮
SystemChrome
.
setEnabledSystemUIOverlays
(
[
SystemUiOverlay
.
top
,
SystemUiOverlay
.
bottom
]);
}
print
(
"onStopFullScreenPlay"
);
}
else
if
(
evtName
==
SuperPlayerViewEvent
.
onSuperPlayerBackAction
)
{
print
(
"onSuperPlayerBackAction"
);
}
else
{
print
(
evtName
);
}
}
}
);
);
});
_initPlayer
.
complete
(
true
);
},
...
...
Flutter/ios/Classes/SuperPlatformPlayerView.m
浏览文件 @
0e174025
...
...
@@ -286,40 +286,50 @@
/// 返回事件
-
(
void
)
superPlayerBackAction
:
(
SuperPlayerView
*
)
player
{
[
_eventSink
success
:[
self
getParamsWithEvent
:
@"onSuperPlayerBackAction"
withParams
:@{}]];
}
/// 全屏改变通知
-
(
void
)
superPlayerFullScreenChanged
:
(
SuperPlayerView
*
)
player
{
UIInterfaceOrientation
orientation
=
[
UIApplication
sharedApplication
].
statusBarOrientation
;
if
(
orientation
==
UIInterfaceOrientationPortrait
)
{
[
_eventSink
success
:
@"onStopFullScreenPlay"
];
if
(
!
player
.
isFullScreen
)
{
[
_eventSink
success
:[
self
getParamsWithEvent
:
@"onStopFullScreenPlay"
withParams
:@{}]];
}
else
{
[
_eventSink
success
:
@"onStartFullScreenPlay"
];
[
_eventSink
success
:
[
self
getParamsWithEvent
:
@"onStartFullScreenPlay"
withParams
:@{}]
];
}
}
/// 播放开始通知
-
(
void
)
superPlayerDidStart
:
(
SuperPlayerView
*
)
player
;
{
[
_eventSink
success
:[
self
getParamsWithEvent
:
@"onSuperPlayerDidStart"
withParams
:@{}]];
}
/// 播放结束通知
-
(
void
)
superPlayerDidEnd
:
(
SuperPlayerView
*
)
player
{
[
_eventSink
success
:[
self
getParamsWithEvent
:
@"onSuperPlayerDidEnd"
withParams
:@{}]];
}
/// 播放错误通知
-
(
void
)
superPlayerError
:
(
SuperPlayerView
*
)
player
errCode
:
(
int
)
code
errMessage
:
(
NSString
*
)
why
;
{
[
_eventSink
success
:[
self
getParamsWithEvent
:
@"onSuperPlayerError"
withParams
:@{
@"errCode"
:
@
(
code
),
@"errMessage"
:
why
}]];
}
// 需要通知到父view的事件在此添加
-
(
NSDictionary
*
)
getParamsWithEvent
:
(
NSString
*
)
evtName
withParams
:
(
NSDictionary
*
)
params
{
NSMutableDictionary
<
NSString
*
,
NSObject
*>
*
dict
=
[
NSMutableDictionary
dictionaryWithObject
:
evtName
forKey
:
@"event"
];
if
(
params
!=
nil
&&
params
.
count
!=
0
)
{
[
dict
addEntriesFromDictionary
:
params
];
}
return
dict
;
}
+
(
UINavigationController
*
)
currentNavigationController
{
...
...
Flutter/lib/Core/superplayerview_controller.dart
浏览文件 @
0e174025
...
...
@@ -4,9 +4,9 @@ part of SuperPlayer;
class
SuperPlayerPlatformViewController
{
MethodChannel
_channel
;
StreamSubscription
_eventSubscription
;
final
StreamController
<
String
>
_eventStreamController
=
final
StreamController
<
Map
<
dynamic
,
dynamic
>
>
_eventStreamController
=
StreamController
.
broadcast
();
Stream
<
String
>
get
onPlayerEventBroadcast
=>
_eventStreamController
.
stream
;
Stream
<
Map
<
dynamic
,
dynamic
>
>
get
onPlayerEventBroadcast
=>
_eventStreamController
.
stream
;
SuperPlayerPlatformViewController
.
init
(
int
id
)
{
_channel
=
new
MethodChannel
(
'cloud.tencent.com/superPlayer/
$id
'
);
...
...
@@ -18,21 +18,6 @@ class SuperPlayerPlatformViewController {
_eventHandler
(
event
)
{
if
(
event
==
null
)
return
;
if
(
event
is
String
)
{
print
(
"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
\n
"
);
print
(
event
);
print
(
"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
\n
"
);
switch
(
event
)
{
case
SuperPlayerViewEvent
.
onStartFullScreenPlay
:
break
;
case
SuperPlayerViewEvent
.
onStopFullScreenPlay
:
break
;
case
SuperPlayerViewEvent
.
onSuperPlayerBackAction
:
break
;
}
}
_eventStreamController
.
add
(
event
);
}
...
...
Flutter/lib/Core/txplayer_define.dart
浏览文件 @
0e174025
...
...
@@ -53,14 +53,12 @@ enum TXPlayerEvent{
}
abstract
class
SuperPlayerViewEvent
{
static
const
onStartFullScreenPlay
=
"onStartFullScreenPlay"
;
// 进入全屏播放
static
const
onStopFullScreenPlay
=
"onStopFullScreenPlay"
;
// 退出全屏播放
static
const
onSuperPlayerBackAction
=
"onSuperPlayerBackAction"
;
// 窗口模式触发左上角返回按钮
static
const
onClickFloatCloseBtn
=
"onClickFloatCloseBtn"
;
// 浮窗模式触发关闭按钮
static
const
onStartFloatWindowPlay
=
"onStartFloatWindowPlay"
;
// 开始进入浮窗模式
static
const
onSuperPlayerDidStart
=
"onSuperPlayerDidStart"
;
// 播放开始通知
static
const
onSuperPlayerDidEnd
=
"onSuperPlayerDidEnd"
;
// 播放结束通知
static
const
onSuperPlayerPause
=
"onSuperPlayerPause"
;
// 播放暂停通知
static
const
onStartFullScreenPlay
=
"onStartFullScreenPlay"
;
//进入全屏播放
static
const
onStopFullScreenPlay
=
"onStopFullScreenPlay"
;
//退出全屏播放
static
const
onSuperPlayerDidStart
=
"onSuperPlayerDidStart"
;
//播放开始通知
static
const
onSuperPlayerDidEnd
=
"onSuperPlayerDidEnd"
;
//播放结束通知
static
const
onSuperPlayerError
=
"onSuperPlayerError"
;
//播放错误通知
static
const
onSuperPlayerBackAction
=
"onSuperPlayerBackAction"
;
//返回事件
}
class
SuperPlayerUrl
{
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论