Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
T
tx_player_fork
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
蒋俊
tx_player_fork
Commits
412c00dd
提交
412c00dd
authored
3月 07, 2022
作者:
dokieyang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
超级播放器添加事件回调和pause、resume、stop接口
上级
5963b9de
隐藏空白字符变更
内嵌
并排
正在显示
9 个修改的文件
包含
187 行增加
和
6 行删除
+187
-6
SuperPlatformPlayerView.java
...ava/com/example/super_player/SuperPlatformPlayerView.java
+58
-1
SuperPlayerView.java
.../com/tencent/liteav/demo/superplayer/SuperPlayerView.java
+14
-0
ISuperPlayerListener.java
...t/liteav/demo/superplayer/model/ISuperPlayerListener.java
+13
-0
SuperPlayer.java
...om/tencent/liteav/demo/superplayer/model/SuperPlayer.java
+6
-0
SuperPlayerImpl.java
...encent/liteav/demo/superplayer/model/SuperPlayerImpl.java
+18
-2
test_superplayer.dart
Flutter/example/lib/test_superplayer.dart
+23
-1
test_txLiveplayer.dart
Flutter/example/lib/test_txLiveplayer.dart
+21
-1
test_txvodplayer.dart
Flutter/example/lib/test_txvodplayer.dart
+21
-1
superplayerview_controller.dart
Flutter/lib/Core/superplayerview_controller.dart
+13
-0
没有找到文件。
Flutter/android/src/main/java/com/example/super_player/SuperPlatformPlayerView.java
浏览文件 @
412c00dd
...
@@ -10,7 +10,9 @@ import com.tencent.liteav.demo.superplayer.SuperPlayerGlobalConfig;
...
@@ -10,7 +10,9 @@ import com.tencent.liteav.demo.superplayer.SuperPlayerGlobalConfig;
import
com.tencent.liteav.demo.superplayer.SuperPlayerModel
;
import
com.tencent.liteav.demo.superplayer.SuperPlayerModel
;
import
com.tencent.liteav.demo.superplayer.SuperPlayerVideoId
;
import
com.tencent.liteav.demo.superplayer.SuperPlayerVideoId
;
import
com.tencent.liteav.demo.superplayer.SuperPlayerView
;
import
com.tencent.liteav.demo.superplayer.SuperPlayerView
;
import
com.tencent.liteav.demo.superplayer.model.ISuperPlayerListener
;
import
com.tencent.rtmp.TXLiveBase
;
import
com.tencent.rtmp.TXLiveBase
;
import
com.tencent.rtmp.TXVodPlayer
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.HashMap
;
...
@@ -26,18 +28,21 @@ import io.flutter.plugin.platform.PlatformView;
...
@@ -26,18 +28,21 @@ import io.flutter.plugin.platform.PlatformView;
import
android.util.Log
;
import
android.util.Log
;
public
class
SuperPlatformPlayerView
implements
PlatformView
,
MethodChannel
.
MethodCallHandler
,
SuperPlayerView
.
OnSuperPlayerViewCallback
{
public
class
SuperPlatformPlayerView
implements
PlatformView
,
MethodChannel
.
MethodCallHandler
,
SuperPlayerView
.
OnSuperPlayerViewCallback
,
ISuperPlayerListener
{
private
SuperPlayerView
mSuperPlayerView
;
private
SuperPlayerView
mSuperPlayerView
;
private
FlutterPlugin
.
FlutterPluginBinding
mFlutterPluginBinding
;
private
FlutterPlugin
.
FlutterPluginBinding
mFlutterPluginBinding
;
private
final
MethodChannel
mMethodChannel
;
private
final
MethodChannel
mMethodChannel
;
private
final
EventChannel
mEventChannel
;
private
final
EventChannel
mEventChannel
;
private
final
EventChannel
mNetChannel
;
private
final
FTXPlayerEventSink
mEventSink
=
new
FTXPlayerEventSink
();
private
final
FTXPlayerEventSink
mEventSink
=
new
FTXPlayerEventSink
();
final
private
FTXPlayerEventSink
mNetStatusSink
=
new
FTXPlayerEventSink
();
public
SuperPlatformPlayerView
(
Context
context
,
Map
<
String
,
Object
>
params
,
int
viewId
,
FlutterPlugin
.
FlutterPluginBinding
flutterPluginBinding
)
{
public
SuperPlatformPlayerView
(
Context
context
,
Map
<
String
,
Object
>
params
,
int
viewId
,
FlutterPlugin
.
FlutterPluginBinding
flutterPluginBinding
)
{
super
();
super
();
mSuperPlayerView
=
new
SuperPlayerView
(
context
);
mSuperPlayerView
=
new
SuperPlayerView
(
context
);
mSuperPlayerView
.
setPlayerViewCallback
(
this
);
mSuperPlayerView
.
setPlayerViewCallback
(
this
);
mSuperPlayerView
.
setSuperPlayerListener
(
this
);
mMethodChannel
=
new
MethodChannel
(
flutterPluginBinding
.
getBinaryMessenger
(),
"cloud.tencent.com/superPlayer/"
+
viewId
);
mMethodChannel
=
new
MethodChannel
(
flutterPluginBinding
.
getBinaryMessenger
(),
"cloud.tencent.com/superPlayer/"
+
viewId
);
mMethodChannel
.
setMethodCallHandler
(
this
);
mMethodChannel
.
setMethodCallHandler
(
this
);
mEventChannel
=
new
EventChannel
(
flutterPluginBinding
.
getBinaryMessenger
(),
"cloud.tencent.com/superPlayer/event/"
+
viewId
);
mEventChannel
=
new
EventChannel
(
flutterPluginBinding
.
getBinaryMessenger
(),
"cloud.tencent.com/superPlayer/event/"
+
viewId
);
...
@@ -90,6 +95,18 @@ public class SuperPlatformPlayerView implements PlatformView, MethodChannel.Meth
...
@@ -90,6 +95,18 @@ public class SuperPlatformPlayerView implements PlatformView, MethodChannel.Meth
//
//
// mPlayerModel = model;
// mPlayerModel = model;
// mSuperPlayerView.playWithModel(model);
// mSuperPlayerView.playWithModel(model);
mNetChannel
=
new
EventChannel
(
flutterPluginBinding
.
getBinaryMessenger
(),
"cloud.tencent.com/superPlayer/net/"
+
viewId
);
mNetChannel
.
setStreamHandler
(
new
EventChannel
.
StreamHandler
()
{
@Override
public
void
onListen
(
Object
o
,
EventChannel
.
EventSink
eventSink
)
{
mNetStatusSink
.
setEventSinkProxy
(
eventSink
);
}
@Override
public
void
onCancel
(
Object
o
)
{
mNetStatusSink
.
setEventSinkProxy
(
null
);
}
});
}
}
...
@@ -179,6 +196,15 @@ public class SuperPlatformPlayerView implements PlatformView, MethodChannel.Meth
...
@@ -179,6 +196,15 @@ public class SuperPlatformPlayerView implements PlatformView, MethodChannel.Meth
}
else
if
(
call
.
method
.
equals
(
"resetPlayer"
)){
}
else
if
(
call
.
method
.
equals
(
"resetPlayer"
)){
destory
();
destory
();
result
.
success
(
null
);
result
.
success
(
null
);
}
else
if
(
call
.
method
.
equals
(
"pause"
)){
setPause
();
result
.
success
(
null
);
}
else
if
(
call
.
method
.
equals
(
"resume"
)){
setResume
();
result
.
success
(
null
);
}
else
if
(
call
.
method
.
equals
(
"stop"
)){
setStop
();
result
.
success
(
null
);
}
else
{
}
else
{
result
.
notImplemented
();
result
.
notImplemented
();
}
}
...
@@ -287,6 +313,18 @@ public class SuperPlatformPlayerView implements PlatformView, MethodChannel.Meth
...
@@ -287,6 +313,18 @@ public class SuperPlatformPlayerView implements PlatformView, MethodChannel.Meth
mSuperPlayerView
.
setLoop
(
b
);
mSuperPlayerView
.
setLoop
(
b
);
}
}
public
void
setPause
()
{
mSuperPlayerView
.
onPause
();
}
public
void
setResume
()
{
mSuperPlayerView
.
onResume
();
}
public
void
setStop
()
{
mSuperPlayerView
.
resetPlayer
();
}
private
Map
<
String
,
Object
>
getParams
(
String
event
,
Bundle
bundle
)
{
private
Map
<
String
,
Object
>
getParams
(
String
event
,
Bundle
bundle
)
{
Map
<
String
,
Object
>
param
=
new
HashMap
();
Map
<
String
,
Object
>
param
=
new
HashMap
();
if
(!
event
.
isEmpty
())
{
if
(!
event
.
isEmpty
())
{
...
@@ -311,4 +349,23 @@ public class SuperPlatformPlayerView implements PlatformView, MethodChannel.Meth
...
@@ -311,4 +349,23 @@ public class SuperPlatformPlayerView implements PlatformView, MethodChannel.Meth
mEventChannel
.
setStreamHandler
(
null
);
mEventChannel
.
setStreamHandler
(
null
);
}
}
@Override
public
void
onVodPlayEvent
(
TXVodPlayer
player
,
int
event
,
Bundle
param
)
{
mEventSink
.
success
(
getParams
(
"onVodPlayEvent"
,
param
));
}
@Override
public
void
onVodNetStatus
(
TXVodPlayer
player
,
Bundle
status
)
{
mNetStatusSink
.
success
(
getParams
(
"onVodNetStatus"
,
status
));
}
@Override
public
void
onLivePlayEvent
(
int
event
,
Bundle
param
)
{
mEventSink
.
success
(
getParams
(
"onLivePlayEvent"
,
param
));
}
@Override
public
void
onLiveNetStatus
(
Bundle
status
)
{
mNetStatusSink
.
success
(
getParams
(
"onLiveNetStatus"
,
status
));
}
}
}
Flutter/example/android/superplayerkit/src/main/java/com/tencent/liteav/demo/superplayer/SuperPlayerView.java
浏览文件 @
412c00dd
...
@@ -28,6 +28,7 @@ import android.widget.RelativeLayout;
...
@@ -28,6 +28,7 @@ import android.widget.RelativeLayout;
import
android.widget.Toast
;
import
android.widget.Toast
;
import
com.tencent.liteav.basic.log.TXCLog
;
import
com.tencent.liteav.basic.log.TXCLog
;
import
com.tencent.liteav.demo.superplayer.model.ISuperPlayerListener
;
import
com.tencent.liteav.demo.superplayer.model.SuperPlayer
;
import
com.tencent.liteav.demo.superplayer.model.SuperPlayer
;
import
com.tencent.liteav.demo.superplayer.model.SuperPlayerImpl
;
import
com.tencent.liteav.demo.superplayer.model.SuperPlayerImpl
;
import
com.tencent.liteav.demo.superplayer.model.SuperPlayerObserver
;
import
com.tencent.liteav.demo.superplayer.model.SuperPlayerObserver
;
...
@@ -87,6 +88,7 @@ public class SuperPlayerView extends RelativeLayout {
...
@@ -87,6 +88,7 @@ public class SuperPlayerView extends RelativeLayout {
private
OnSuperPlayerViewCallback
mPlayerViewCallback
;
// SuperPlayerView回调
private
OnSuperPlayerViewCallback
mPlayerViewCallback
;
// SuperPlayerView回调
private
NetWatcher
mWatcher
;
// 网络质量监视器
private
NetWatcher
mWatcher
;
// 网络质量监视器
private
SuperPlayer
mSuperPlayer
;
private
SuperPlayer
mSuperPlayer
;
private
ISuperPlayerListener
mSuperPlayerListener
;
public
SuperPlayerView
(
Context
context
)
{
public
SuperPlayerView
(
Context
context
)
{
super
(
context
);
super
(
context
);
...
@@ -291,6 +293,18 @@ public class SuperPlayerView extends RelativeLayout {
...
@@ -291,6 +293,18 @@ public class SuperPlayerView extends RelativeLayout {
mPlayerViewCallback
=
callback
;
mPlayerViewCallback
=
callback
;
}
}
/**
* 设置超级播放器中点播播放器和直播播放器的回调
*
* @param superPlayerListener
*/
public
void
setSuperPlayerListener
(
ISuperPlayerListener
superPlayerListener
)
{
mSuperPlayerListener
=
superPlayerListener
;
if
(
mSuperPlayer
!=
null
)
{
mSuperPlayer
.
setSuperPlayerListener
(
mSuperPlayerListener
);
}
}
/**
/**
* 控制是否全屏显示
* 控制是否全屏显示
*/
*/
...
...
Flutter/example/android/superplayerkit/src/main/java/com/tencent/liteav/demo/superplayer/model/ISuperPlayerListener.java
0 → 100644
浏览文件 @
412c00dd
package
com
.
tencent
.
liteav
.
demo
.
superplayer
.
model
;
import
android.os.Bundle
;
import
com.tencent.rtmp.TXVodPlayer
;
public
interface
ISuperPlayerListener
{
public
void
onVodPlayEvent
(
final
TXVodPlayer
player
,
final
int
event
,
final
Bundle
param
);
public
void
onVodNetStatus
(
final
TXVodPlayer
player
,
final
Bundle
status
);
public
void
onLivePlayEvent
(
final
int
event
,
final
Bundle
param
);
public
void
onLiveNetStatus
(
final
Bundle
status
);
}
Flutter/example/android/superplayerkit/src/main/java/com/tencent/liteav/demo/superplayer/model/SuperPlayer.java
浏览文件 @
412c00dd
...
@@ -137,6 +137,12 @@ public interface SuperPlayer {
...
@@ -137,6 +137,12 @@ public interface SuperPlayer {
*/
*/
void
setObserver
(
SuperPlayerObserver
observer
);
void
setObserver
(
SuperPlayerObserver
observer
);
/**
* 设置超级播放器中点播事件和直播事件的回调
* @param superPlayerListener
*/
void
setSuperPlayerListener
(
ISuperPlayerListener
superPlayerListener
);
/**
/**
* 设置是否循环
* 设置是否循环
* @param isLoop true循环,false不循环
* @param isLoop true循环,false不循环
...
...
Flutter/example/android/superplayerkit/src/main/java/com/tencent/liteav/demo/superplayer/model/SuperPlayerImpl.java
浏览文件 @
412c00dd
...
@@ -54,6 +54,7 @@ public class SuperPlayerImpl implements SuperPlayer, ITXVodPlayListener, ITXLive
...
@@ -54,6 +54,7 @@ public class SuperPlayerImpl implements SuperPlayer, ITXVodPlayListener, ITXLive
private
TXVodPlayConfig
mVodPlayConfig
;
// 点播播放器配置
private
TXVodPlayConfig
mVodPlayConfig
;
// 点播播放器配置
private
TXLivePlayer
mLivePlayer
;
// 直播播放器
private
TXLivePlayer
mLivePlayer
;
// 直播播放器
private
TXLivePlayConfig
mLivePlayConfig
;
// 直播播放器配置
private
TXLivePlayConfig
mLivePlayConfig
;
// 直播播放器配置
private
ISuperPlayerListener
mSuperPlayerListener
;
private
SuperPlayerModel
mCurrentModel
;
// 当前播放的model
private
SuperPlayerModel
mCurrentModel
;
// 当前播放的model
private
SuperPlayerObserver
mObserver
;
private
SuperPlayerObserver
mObserver
;
...
@@ -138,6 +139,9 @@ public class SuperPlayerImpl implements SuperPlayer, ITXVodPlayListener, ITXLive
...
@@ -138,6 +139,9 @@ public class SuperPlayerImpl implements SuperPlayer, ITXVodPlayListener, ITXLive
default
:
default
:
break
;
break
;
}
}
if
(
mSuperPlayerListener
!=
null
){
mSuperPlayerListener
.
onLivePlayEvent
(
event
,
param
);
}
}
}
/**
/**
...
@@ -147,7 +151,9 @@ public class SuperPlayerImpl implements SuperPlayer, ITXVodPlayListener, ITXLive
...
@@ -147,7 +151,9 @@ public class SuperPlayerImpl implements SuperPlayer, ITXVodPlayListener, ITXLive
*/
*/
@Override
@Override
public
void
onNetStatus
(
Bundle
bundle
)
{
public
void
onNetStatus
(
Bundle
bundle
)
{
if
(
mSuperPlayerListener
!=
null
){
mSuperPlayerListener
.
onLiveNetStatus
(
bundle
);
}
}
}
/**
/**
...
@@ -218,6 +224,9 @@ public class SuperPlayerImpl implements SuperPlayer, ITXVodPlayListener, ITXLive
...
@@ -218,6 +224,9 @@ public class SuperPlayerImpl implements SuperPlayer, ITXVodPlayListener, ITXLive
updatePlayerState
(
SuperPlayerDef
.
PlayerState
.
PAUSE
);
updatePlayerState
(
SuperPlayerDef
.
PlayerState
.
PAUSE
);
onError
(
SuperPlayerCode
.
VOD_PLAY_FAIL
,
param
.
getString
(
TXLiveConstants
.
EVT_DESCRIPTION
));
onError
(
SuperPlayerCode
.
VOD_PLAY_FAIL
,
param
.
getString
(
TXLiveConstants
.
EVT_DESCRIPTION
));
}
}
if
(
mSuperPlayerListener
!=
null
){
mSuperPlayerListener
.
onVodPlayEvent
(
player
,
event
,
param
);
}
}
}
/**
/**
...
@@ -228,7 +237,9 @@ public class SuperPlayerImpl implements SuperPlayer, ITXVodPlayListener, ITXLive
...
@@ -228,7 +237,9 @@ public class SuperPlayerImpl implements SuperPlayer, ITXVodPlayListener, ITXLive
*/
*/
@Override
@Override
public
void
onNetStatus
(
TXVodPlayer
player
,
Bundle
bundle
)
{
public
void
onNetStatus
(
TXVodPlayer
player
,
Bundle
bundle
)
{
if
(
mSuperPlayerListener
!=
null
){
mSuperPlayerListener
.
onVodNetStatus
(
player
,
bundle
);
}
}
}
private
void
initialize
(
Context
context
,
TXCloudVideoView
videoView
)
{
private
void
initialize
(
Context
context
,
TXCloudVideoView
videoView
)
{
...
@@ -909,6 +920,11 @@ public class SuperPlayerImpl implements SuperPlayer, ITXVodPlayListener, ITXLive
...
@@ -909,6 +920,11 @@ public class SuperPlayerImpl implements SuperPlayer, ITXVodPlayListener, ITXLive
mObserver
=
observer
;
mObserver
=
observer
;
}
}
@Override
public
void
setSuperPlayerListener
(
ISuperPlayerListener
superPlayerListener
)
{
mSuperPlayerListener
=
superPlayerListener
;
}
@Override
@Override
public
void
setLoop
(
boolean
isLoop
)
{
public
void
setLoop
(
boolean
isLoop
)
{
mVodPlayer
.
setLoop
(
isLoop
);
mVodPlayer
.
setLoop
(
isLoop
);
...
...
Flutter/example/lib/test_superplayer.dart
浏览文件 @
412c00dd
...
@@ -19,7 +19,7 @@ class TestSuperPlayer extends StatefulWidget {
...
@@ -19,7 +19,7 @@ class TestSuperPlayer extends StatefulWidget {
_TestSuperPlayerState
createState
()
=>
_TestSuperPlayerState
();
_TestSuperPlayerState
createState
()
=>
_TestSuperPlayerState
();
}
}
class
_TestSuperPlayerState
extends
State
<
TestSuperPlayer
>
{
class
_TestSuperPlayerState
extends
State
<
TestSuperPlayer
>
with
WidgetsBindingObserver
{
bool
_liveSelected
=
true
;
//live is default
bool
_liveSelected
=
true
;
//live is default
var
_currentModels
=
<
SuperPlayerViewModel
>[];
var
_currentModels
=
<
SuperPlayerViewModel
>[];
SuperPlayerViewConfig
_playerConfig
=
SuperPlayerViewConfig
();
SuperPlayerViewConfig
_playerConfig
=
SuperPlayerViewConfig
();
...
@@ -41,13 +41,33 @@ class _TestSuperPlayerState extends State<TestSuperPlayer> {
...
@@ -41,13 +41,33 @@ class _TestSuperPlayerState extends State<TestSuperPlayer> {
void
initState
()
{
void
initState
()
{
super
.
initState
();
super
.
initState
();
_getLiveListData
();
_getLiveListData
();
WidgetsBinding
.
instance
?.
addObserver
(
this
);
debugPrint
(
"= initState =
${window.padding.top}
,
${window.physicalSize.width}
"
);
debugPrint
(
"= initState =
${window.padding.top}
,
${window.physicalSize.width}
"
);
}
}
@override
Future
didChangeAppLifecycleState
(
AppLifecycleState
state
)
async
{
super
.
didChangeAppLifecycleState
(
state
);
print
(
"didChangeAppLifecycleState
$state
"
);
switch
(
state
)
{
case
AppLifecycleState
.
inactive
:
break
;
case
AppLifecycleState
.
resumed
:
_playerController
.
resume
();
break
;
case
AppLifecycleState
.
paused
:
_playerController
.
pause
();
break
;
default
:
break
;
}
}
@override
@override
void
dispose
()
{
void
dispose
()
{
_playerController
.
resetPlayer
();
_playerController
.
resetPlayer
();
super
.
dispose
();
super
.
dispose
();
WidgetsBinding
.
instance
?.
removeObserver
(
this
);
}
}
void
onPressed
(
BuildContext
context
)
{
void
onPressed
(
BuildContext
context
)
{
...
@@ -147,6 +167,8 @@ class _TestSuperPlayerState extends State<TestSuperPlayer> {
...
@@ -147,6 +167,8 @@ class _TestSuperPlayerState extends State<TestSuperPlayer> {
print
(
"onSuperPlayerBackAction"
);
print
(
"onSuperPlayerBackAction"
);
}
else
{
}
else
{
print
(
evtName
);
print
(
evtName
);
//final Map<dynamic, dynamic> map = event;
//print(map);
}
}
}
}
);
);
...
...
Flutter/example/lib/test_txLiveplayer.dart
浏览文件 @
412c00dd
...
@@ -9,7 +9,7 @@ class TestTXLivePlayer extends StatefulWidget {
...
@@ -9,7 +9,7 @@ class TestTXLivePlayer extends StatefulWidget {
_TestTXPLivelayerState
createState
()
=>
_TestTXPLivelayerState
();
_TestTXPLivelayerState
createState
()
=>
_TestTXPLivelayerState
();
}
}
class
_TestTXPLivelayerState
extends
State
<
TestTXLivePlayer
>
{
class
_TestTXPLivelayerState
extends
State
<
TestTXLivePlayer
>
with
WidgetsBindingObserver
{
TXLivePlayerController
_controller
;
TXLivePlayerController
_controller
;
double
_aspectRatio
=
0
;
double
_aspectRatio
=
0
;
...
@@ -70,9 +70,28 @@ class _TestTXPLivelayerState extends State<TestTXLivePlayer> {
...
@@ -70,9 +70,28 @@ class _TestTXPLivelayerState extends State<TestTXLivePlayer> {
void
initState
()
{
void
initState
()
{
super
.
initState
();
super
.
initState
();
init
();
init
();
WidgetsBinding
.
instance
?.
addObserver
(
this
);
EasyLoading
.
show
(
status:
'loading...'
);
EasyLoading
.
show
(
status:
'loading...'
);
}
}
@override
Future
didChangeAppLifecycleState
(
AppLifecycleState
state
)
async
{
super
.
didChangeAppLifecycleState
(
state
);
print
(
"didChangeAppLifecycleState
$state
"
);
switch
(
state
)
{
case
AppLifecycleState
.
inactive
:
break
;
case
AppLifecycleState
.
resumed
:
_controller
.
resume
();
break
;
case
AppLifecycleState
.
paused
:
_controller
.
pause
();
break
;
default
:
break
;
}
}
@override
@override
Widget
build
(
BuildContext
context
)
{
Widget
build
(
BuildContext
context
)
{
return
Container
(
return
Container
(
...
@@ -227,6 +246,7 @@ class _TestTXPLivelayerState extends State<TestTXLivePlayer> {
...
@@ -227,6 +246,7 @@ class _TestTXPLivelayerState extends State<TestTXLivePlayer> {
void
dispose
()
{
void
dispose
()
{
_controller
.
dispose
();
_controller
.
dispose
();
super
.
dispose
();
super
.
dispose
();
WidgetsBinding
.
instance
?.
removeObserver
(
this
);
EasyLoading
.
dismiss
();
EasyLoading
.
dismiss
();
}
}
...
...
Flutter/example/lib/test_txvodplayer.dart
浏览文件 @
412c00dd
...
@@ -14,7 +14,7 @@ class TestTXVodPlayer extends StatefulWidget {
...
@@ -14,7 +14,7 @@ class TestTXVodPlayer extends StatefulWidget {
_TestTXPVodlayerState
createState
()
=>
_TestTXPVodlayerState
();
_TestTXPVodlayerState
createState
()
=>
_TestTXPVodlayerState
();
}
}
class
_TestTXPVodlayerState
extends
State
<
TestTXVodPlayer
>
{
class
_TestTXPVodlayerState
extends
State
<
TestTXVodPlayer
>
with
WidgetsBindingObserver
{
TXVodPlayerController
_controller
;
TXVodPlayerController
_controller
;
double
_aspectRatio
=
0
;
double
_aspectRatio
=
0
;
...
@@ -72,9 +72,28 @@ class _TestTXPVodlayerState extends State<TestTXVodPlayer> {
...
@@ -72,9 +72,28 @@ class _TestTXPVodlayerState extends State<TestTXVodPlayer> {
void
initState
()
{
void
initState
()
{
super
.
initState
();
super
.
initState
();
init
();
init
();
WidgetsBinding
.
instance
?.
addObserver
(
this
);
EasyLoading
.
show
(
status:
'loading...'
);
EasyLoading
.
show
(
status:
'loading...'
);
}
}
@override
Future
didChangeAppLifecycleState
(
AppLifecycleState
state
)
async
{
super
.
didChangeAppLifecycleState
(
state
);
print
(
"didChangeAppLifecycleState
$state
"
);
switch
(
state
)
{
case
AppLifecycleState
.
inactive
:
break
;
case
AppLifecycleState
.
resumed
:
_controller
.
resume
();
break
;
case
AppLifecycleState
.
paused
:
_controller
.
pause
();
break
;
default
:
break
;
}
}
@override
@override
Widget
build
(
BuildContext
context
)
{
Widget
build
(
BuildContext
context
)
{
return
Container
(
return
Container
(
...
@@ -269,6 +288,7 @@ class _TestTXPVodlayerState extends State<TestTXVodPlayer> {
...
@@ -269,6 +288,7 @@ class _TestTXPVodlayerState extends State<TestTXVodPlayer> {
void
dispose
()
{
void
dispose
()
{
_controller
.
dispose
();
_controller
.
dispose
();
super
.
dispose
();
super
.
dispose
();
WidgetsBinding
.
instance
?.
removeObserver
(
this
);
EasyLoading
.
dismiss
();
EasyLoading
.
dismiss
();
}
}
...
...
Flutter/lib/Core/superplayerview_controller.dart
浏览文件 @
412c00dd
...
@@ -61,5 +61,17 @@ class SuperPlayerPlatformViewController {
...
@@ -61,5 +61,17 @@ class SuperPlayerPlatformViewController {
Future
<
void
>
resetPlayer
()
async
{
Future
<
void
>
resetPlayer
()
async
{
await
_channel
.
invokeMethod
(
"resetPlayer"
);
await
_channel
.
invokeMethod
(
"resetPlayer"
);
}
}
Future
<
void
>
pause
()
async
{
await
_channel
.
invokeMethod
(
"pause"
);
}
Future
<
void
>
resume
()
async
{
await
_channel
.
invokeMethod
(
"resume"
);
}
Future
<
void
>
stop
()
async
{
await
_channel
.
invokeMethod
(
"stop"
);
}
}
}
\ No newline at end of file
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论