|
|
|
@ -1,7 +1,6 @@
|
|
|
|
import 'dart:async';
|
|
|
|
import 'dart:async';
|
|
|
|
import 'dart:convert';
|
|
|
|
import 'dart:convert';
|
|
|
|
import 'dart:ui';
|
|
|
|
import 'dart:ui';
|
|
|
|
import 'dart:io';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import 'package:fijkplayer/fijkplayer.dart';
|
|
|
|
import 'package:fijkplayer/fijkplayer.dart';
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
@ -14,12 +13,13 @@ import 'package:hyzp_ybqx/components/dioFun.dart';
|
|
|
|
import 'package:hyzp_ybqx/provider/player_ratio.dart';
|
|
|
|
import 'package:hyzp_ybqx/provider/player_ratio.dart';
|
|
|
|
import 'package:hyzp_ybqx/provider/player_region.dart';
|
|
|
|
import 'package:hyzp_ybqx/provider/player_region.dart';
|
|
|
|
import 'package:provider/provider.dart';
|
|
|
|
import 'package:provider/provider.dart';
|
|
|
|
import 'package:fijkplayer/fijkplayer.dart';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import '../components/commonFun.dart';
|
|
|
|
import '../components/commonFun.dart';
|
|
|
|
import '../services/Storage.dart';
|
|
|
|
import '../services/Storage.dart';
|
|
|
|
import '../my_fijkPanel_fix/my_panel3.dart';
|
|
|
|
import '../my_fijkPanel_fix/my_panel3.dart';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const _kControlViewTypes = [kControlViewTypeDefault, kControlViewTypeWithout];
|
|
|
|
|
|
|
|
|
|
|
|
class SuperPlayerPage extends StatefulWidget {
|
|
|
|
class SuperPlayerPage extends StatefulWidget {
|
|
|
|
SuperPlayerPage(
|
|
|
|
SuperPlayerPage(
|
|
|
|
{@required this.url,
|
|
|
|
{@required this.url,
|
|
|
|
@ -62,10 +62,6 @@ class _SuperPlayerPageState extends State<SuperPlayerPage>
|
|
|
|
setSphericalCameraDio(id: widget.id, dwip: widget.dwip, cmdCode: 1);
|
|
|
|
setSphericalCameraDio(id: widget.id, dwip: widget.dwip, cmdCode: 1);
|
|
|
|
_playerController.release(); // 必须显示释放视频播放资源,否则即使退出视频播放页面后台还在获取视频流
|
|
|
|
_playerController.release(); // 必须显示释放视频播放资源,否则即使退出视频播放页面后台还在获取视频流
|
|
|
|
super.dispose();
|
|
|
|
super.dispose();
|
|
|
|
_ijkPlayer.release();
|
|
|
|
|
|
|
|
_playerController.resetPlayer();
|
|
|
|
|
|
|
|
_playerController.release();
|
|
|
|
|
|
|
|
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
@override
|
|
|
|
@ -119,7 +115,6 @@ class _SuperPlayerPageState extends State<SuperPlayerPage>
|
|
|
|
// await _playerController.setOption(FijkOption.hostCategory, "request-screen-on", 1);
|
|
|
|
// await _playerController.setOption(FijkOption.hostCategory, "request-screen-on", 1);
|
|
|
|
// await _playerController.setOption(FijkOption.hostCategory, "request-audio-focus", 1);
|
|
|
|
// await _playerController.setOption(FijkOption.hostCategory, "request-audio-focus", 1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await _playerController.setDataSource(widget.url, autoPlay: true).catchError((e) {
|
|
|
|
await _playerController.setDataSource(widget.url, autoPlay: true).catchError((e) {
|
|
|
|
print("setDataSource error: $e");
|
|
|
|
print("setDataSource error: $e");
|
|
|
|
@ -154,7 +149,15 @@ class _SuperPlayerPageState extends State<SuperPlayerPage>
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
SuperPlayerModel get testSuperPlayerModel {
|
|
|
|
SuperPlayerModel get testSuperPlayerModel {
|
|
|
|
return SuperPlayerModel(url: widget.url);
|
|
|
|
// int appId = 1252463788;
|
|
|
|
|
|
|
|
// String fileId = "5285890781763144364";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SuperPlayerModel superPlayerModel = SuperPlayerModel(
|
|
|
|
|
|
|
|
url: widget.url,
|
|
|
|
|
|
|
|
// appId: appId,
|
|
|
|
|
|
|
|
// videoId: SuperPlayerVideoId(fileId: fileId),
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
return superPlayerModel;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Platform messages are asynchronous, so we initialize in an async method.
|
|
|
|
// Platform messages are asynchronous, so we initialize in an async method.
|
|
|
|
@ -214,6 +217,7 @@ class _SuperPlayerPageState extends State<SuperPlayerPage>
|
|
|
|
double _outerRadius = 270;
|
|
|
|
double _outerRadius = 270;
|
|
|
|
double _innerRadius = _outerRadius / 2;
|
|
|
|
double _innerRadius = _outerRadius / 2;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//double barHeight = bFullScreen ? 0 : MediaQueryData.fromWindow(window).padding.top;
|
|
|
|
return Scaffold(
|
|
|
|
return Scaffold(
|
|
|
|
appBar: bFullScreen
|
|
|
|
appBar: bFullScreen
|
|
|
|
? null
|
|
|
|
? null
|
|
|
|
@ -224,9 +228,13 @@ class _SuperPlayerPageState extends State<SuperPlayerPage>
|
|
|
|
automaticallyImplyLeading: false,
|
|
|
|
automaticallyImplyLeading: false,
|
|
|
|
centerTitle: true,
|
|
|
|
centerTitle: true,
|
|
|
|
titleSpacing: 0.0,
|
|
|
|
titleSpacing: 0.0,
|
|
|
|
|
|
|
|
//设置title的左边距
|
|
|
|
flexibleSpace: Container(
|
|
|
|
flexibleSpace: Container(
|
|
|
|
|
|
|
|
//SizedBox(height: ScreenUtil().statusBarHeight), //显示顶部状态栏
|
|
|
|
|
|
|
|
// SizedBox(height: ScreenUtil().setHeight(10)), //显示顶部状态栏
|
|
|
|
padding: EdgeInsets.only(top: ScreenUtil().statusBarHeight), //留出顶部状态栏高度
|
|
|
|
padding: EdgeInsets.only(top: ScreenUtil().statusBarHeight), //留出顶部状态栏高度
|
|
|
|
child: Container(
|
|
|
|
child: Container(
|
|
|
|
|
|
|
|
//height: ScreenUtil().setHeight(173),
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
gradient: LinearGradient(
|
|
|
|
gradient: LinearGradient(
|
|
|
|
begin: Alignment.centerLeft,
|
|
|
|
begin: Alignment.centerLeft,
|
|
|
|
@ -237,6 +245,12 @@ class _SuperPlayerPageState extends State<SuperPlayerPage>
|
|
|
|
],
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
|
|
|
|
// decoration: BoxDecoration(
|
|
|
|
|
|
|
|
// gradient: LinearGradient(colors: [
|
|
|
|
|
|
|
|
// Color(0xFF0018EB),
|
|
|
|
|
|
|
|
// Color(0xFF01C1D9),
|
|
|
|
|
|
|
|
// ], begin: Alignment.bottomCenter, end: Alignment.topCenter),
|
|
|
|
|
|
|
|
// ),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
title: Padding(
|
|
|
|
title: Padding(
|
|
|
|
@ -249,7 +263,7 @@ class _SuperPlayerPageState extends State<SuperPlayerPage>
|
|
|
|
iconData: Icons.chevron_left_outlined,
|
|
|
|
iconData: Icons.chevron_left_outlined,
|
|
|
|
onPress: () {
|
|
|
|
onPress: () {
|
|
|
|
getingDwVideo = false;
|
|
|
|
getingDwVideo = false;
|
|
|
|
pop();
|
|
|
|
Navigator.pop(context);
|
|
|
|
},
|
|
|
|
},
|
|
|
|
),
|
|
|
|
),
|
|
|
|
Expanded(
|
|
|
|
Expanded(
|
|
|
|
@ -266,12 +280,16 @@ class _SuperPlayerPageState extends State<SuperPlayerPage>
|
|
|
|
),
|
|
|
|
),
|
|
|
|
body: WillPopScope(
|
|
|
|
body: WillPopScope(
|
|
|
|
child: Container(
|
|
|
|
child: Container(
|
|
|
|
|
|
|
|
// height: ScreenUtil().screenHeight -
|
|
|
|
|
|
|
|
// ScreenUtil().statusBarHeight -
|
|
|
|
|
|
|
|
// ScreenUtil().bottomBarHeight,
|
|
|
|
color: Color.fromRGBO(224, 224, 224, 1),
|
|
|
|
color: Color.fromRGBO(224, 224, 224, 1),
|
|
|
|
child: Column(
|
|
|
|
child: Column(
|
|
|
|
children: <Widget>[
|
|
|
|
children: <Widget>[
|
|
|
|
//第2行组件,视频播放区
|
|
|
|
//第2行组件,视频播放区
|
|
|
|
Center(
|
|
|
|
Center(
|
|
|
|
child: Container(
|
|
|
|
child: Container(
|
|
|
|
|
|
|
|
//padding: EdgeInsets.only(top: barHeight),
|
|
|
|
alignment: Alignment(0, -1),
|
|
|
|
alignment: Alignment(0, -1),
|
|
|
|
width: MediaQuery.of(context).size.width,
|
|
|
|
width: MediaQuery.of(context).size.width,
|
|
|
|
height: MediaQuery.of(context).size.width * (9 / 16),
|
|
|
|
height: MediaQuery.of(context).size.width * (9 / 16),
|
|
|
|
@ -315,6 +333,7 @@ class _SuperPlayerPageState extends State<SuperPlayerPage>
|
|
|
|
children: [
|
|
|
|
children: [
|
|
|
|
SizedBox(width: ScreenUtil().setWidth(btn_left)),
|
|
|
|
SizedBox(width: ScreenUtil().setWidth(btn_left)),
|
|
|
|
getRoundButton(
|
|
|
|
getRoundButton(
|
|
|
|
|
|
|
|
//(bPlaying) ? '暂停' : '播放',
|
|
|
|
text: playerRegionProvide.playerText,
|
|
|
|
text: playerRegionProvide.playerText,
|
|
|
|
icon: playerRegionProvide.playerIcon,
|
|
|
|
icon: playerRegionProvide.playerIcon,
|
|
|
|
diameter: 130,
|
|
|
|
diameter: 130,
|
|
|
|
@ -467,27 +486,41 @@ class _SuperPlayerPageState extends State<SuperPlayerPage>
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
),
|
|
|
|
),
|
|
|
|
|
|
|
|
// child: GridView.custom(
|
|
|
|
|
|
|
|
// // padding: EdgeInsets.only(
|
|
|
|
|
|
|
|
// // left: ScreenUtil().setWidth(35), right: ScreenUtil().setWidth(35)),
|
|
|
|
|
|
|
|
// gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
|
|
|
|
|
|
|
|
// crossAxisCount: btnCount3,
|
|
|
|
|
|
|
|
// mainAxisSpacing: 0,
|
|
|
|
|
|
|
|
// crossAxisSpacing: 1,
|
|
|
|
|
|
|
|
// childAspectRatio: ratio3,
|
|
|
|
|
|
|
|
// ),
|
|
|
|
|
|
|
|
// childrenDelegate: SliverChildBuilderDelegate((context, position) {
|
|
|
|
|
|
|
|
// return getItemContainer(listData[position]);
|
|
|
|
|
|
|
|
// }, childCount: btnCount3)),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
|
|
|
|
//SizedBox(height: ScreenUtil().setHeight(49)),
|
|
|
|
|
|
|
|
//Divider(color: Colors.blue),
|
|
|
|
|
|
|
|
//第4行组件,分隔栏
|
|
|
|
|
|
|
|
// Container(
|
|
|
|
|
|
|
|
// //height: 11,
|
|
|
|
|
|
|
|
// height: ScreenUtil().setHeight(28),
|
|
|
|
|
|
|
|
// color: Color.fromRGBO(224, 224, 224, 1),
|
|
|
|
|
|
|
|
// ),
|
|
|
|
],
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
onWillPop: () {
|
|
|
|
onWillPop: () {
|
|
|
|
|
|
|
|
Playing = false;
|
|
|
|
|
|
|
|
getingDwVideo = false;
|
|
|
|
// 云台控制代码:1:停止动作、3:启动雨刷、11:焦距变大、12:焦距变小
|
|
|
|
// 云台控制代码:1:停止动作、3:启动雨刷、11:焦距变大、12:焦距变小
|
|
|
|
setSphericalCameraDio(id: widget.id, dwip: widget.dwip, cmdCode: 1);
|
|
|
|
setSphericalCameraDio(id: widget.id, dwip: widget.dwip, cmdCode: 1);
|
|
|
|
pop();
|
|
|
|
Navigator.pop(context); //关闭弹框,播放输入视频地址
|
|
|
|
},
|
|
|
|
},
|
|
|
|
),
|
|
|
|
),
|
|
|
|
);
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
pop() async {
|
|
|
|
|
|
|
|
Playing = false;
|
|
|
|
|
|
|
|
getingDwVideo = false;
|
|
|
|
|
|
|
|
_ijkPlayer.removeListener(() {});
|
|
|
|
|
|
|
|
await _playerController.removeListener(this);
|
|
|
|
|
|
|
|
Navigator.pop(context);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
@override
|
|
|
|
void onClickFloatCloseBtn() {
|
|
|
|
void onClickFloatCloseBtn() {
|
|
|
|
_addLog('onClickFloatCloseBtn', {});
|
|
|
|
_addLog('onClickFloatCloseBtn', {});
|
|
|
|
@ -496,14 +529,13 @@ class _SuperPlayerPageState extends State<SuperPlayerPage>
|
|
|
|
@override
|
|
|
|
@override
|
|
|
|
void onClickSmallReturnBtn() {
|
|
|
|
void onClickSmallReturnBtn() {
|
|
|
|
_addLog('onClickSmallReturnBtn', {});
|
|
|
|
_addLog('onClickSmallReturnBtn', {});
|
|
|
|
pop();
|
|
|
|
Navigator.maybePop(context);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
@override
|
|
|
|
void onFullScreenChange(bool isFullScreen) {
|
|
|
|
void onFullScreenChange(bool isFullScreen) {
|
|
|
|
_addLog('onFullScreenChange', {'isFullScreen': isFullScreen});
|
|
|
|
_addLog('onFullScreenChange', {'isFullScreen': isFullScreen});
|
|
|
|
if (bFullScreen == isFullScreen) return;
|
|
|
|
bFullScreen = !bFullScreen;
|
|
|
|
bFullScreen = isFullScreen;
|
|
|
|
|
|
|
|
setState(() {});
|
|
|
|
setState(() {});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@ -542,12 +574,6 @@ class _SuperPlayerPageState extends State<SuperPlayerPage>
|
|
|
|
_addLog('onStartFloatWindowPlay', {});
|
|
|
|
_addLog('onStartFloatWindowPlay', {});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void _fijkValueListener() {
|
|
|
|
|
|
|
|
FijkValue value = _ijkPlayer.value;
|
|
|
|
|
|
|
|
onPlayStateChange(value.state == FijkState.started ? 1 : 2);
|
|
|
|
|
|
|
|
onFullScreenChange(value.fullScreen);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//生成圆形按钮部件,基于图标
|
|
|
|
//生成圆形按钮部件,基于图标
|
|
|
|
Widget getRoundButton(
|
|
|
|
Widget getRoundButton(
|
|
|
|
{double diameter = 144,
|
|
|
|
{double diameter = 144,
|
|
|
|
@ -606,7 +632,13 @@ class _SuperPlayerPageState extends State<SuperPlayerPage>
|
|
|
|
child: Image.asset(image_path,
|
|
|
|
child: Image.asset(image_path,
|
|
|
|
fit: BoxFit.fitWidth,
|
|
|
|
fit: BoxFit.fitWidth,
|
|
|
|
width: ScreenUtil().setWidth(imageSize),
|
|
|
|
width: ScreenUtil().setWidth(imageSize),
|
|
|
|
|
|
|
|
//height: ScreenUtil().setWidth(iconSize),
|
|
|
|
color: Color.fromRGBO(52, 157, 237, 1)),
|
|
|
|
color: Color.fromRGBO(52, 157, 237, 1)),
|
|
|
|
|
|
|
|
// child: Icon(
|
|
|
|
|
|
|
|
// icon,
|
|
|
|
|
|
|
|
// size: ScreenUtil().setWidth(iconSize),
|
|
|
|
|
|
|
|
// color: Color.fromRGBO(52, 157, 237, 1),
|
|
|
|
|
|
|
|
// ),
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
color: color_bkg,
|
|
|
|
color: color_bkg,
|
|
|
|
borderRadius: BorderRadius.all(Radius.circular(200)),
|
|
|
|
borderRadius: BorderRadius.all(Radius.circular(200)),
|
|
|
|
|