Fix Bug: SuperPlayer
SuperPlayer在 iOS 上无法播放 rtmp,换用 fijkplayer
This commit is contained in:
@@ -19,6 +19,7 @@ PODS:
|
|||||||
- audioplayers (0.0.1):
|
- audioplayers (0.0.1):
|
||||||
- Flutter
|
- Flutter
|
||||||
- BaiduMapKit (5.4.0)
|
- BaiduMapKit (5.4.0)
|
||||||
|
- BIJKPlayer (0.7.16)
|
||||||
- camera (0.0.1):
|
- camera (0.0.1):
|
||||||
- Flutter
|
- Flutter
|
||||||
- city_pickers (0.0.1):
|
- city_pickers (0.0.1):
|
||||||
@@ -27,6 +28,9 @@ PODS:
|
|||||||
- Flutter
|
- Flutter
|
||||||
- disable_screenshots (0.0.1):
|
- disable_screenshots (0.0.1):
|
||||||
- Flutter
|
- Flutter
|
||||||
|
- fijkplayer (0.8.8):
|
||||||
|
- BIJKPlayer (~> 0.7.10)
|
||||||
|
- Flutter
|
||||||
- Flutter (1.0.0)
|
- Flutter (1.0.0)
|
||||||
- flutter_bmfbase (0.0.1):
|
- flutter_bmfbase (0.0.1):
|
||||||
- BaiduMapKit (= 5.4.0)
|
- BaiduMapKit (= 5.4.0)
|
||||||
@@ -83,6 +87,7 @@ DEPENDENCIES:
|
|||||||
- city_pickers (from `.symlinks/plugins/city_pickers/ios`)
|
- city_pickers (from `.symlinks/plugins/city_pickers/ios`)
|
||||||
- device_info (from `.symlinks/plugins/device_info/ios`)
|
- device_info (from `.symlinks/plugins/device_info/ios`)
|
||||||
- disable_screenshots (from `.symlinks/plugins/disable_screenshots/ios`)
|
- disable_screenshots (from `.symlinks/plugins/disable_screenshots/ios`)
|
||||||
|
- fijkplayer (from `.symlinks/plugins/fijkplayer/ios`)
|
||||||
- Flutter (from `Flutter`)
|
- Flutter (from `Flutter`)
|
||||||
- flutter_bmfbase (from `.symlinks/plugins/flutter_bmfbase/ios`)
|
- flutter_bmfbase (from `.symlinks/plugins/flutter_bmfbase/ios`)
|
||||||
- flutter_bmfmap (from `.symlinks/plugins/flutter_bmfmap/ios`)
|
- flutter_bmfmap (from `.symlinks/plugins/flutter_bmfmap/ios`)
|
||||||
@@ -105,6 +110,7 @@ SPEC REPOS:
|
|||||||
trunk:
|
trunk:
|
||||||
- AFNetworking
|
- AFNetworking
|
||||||
- BaiduMapKit
|
- BaiduMapKit
|
||||||
|
- BIJKPlayer
|
||||||
- FMDB
|
- FMDB
|
||||||
- Masonry
|
- Masonry
|
||||||
- TXLiteAVSDK_Professional
|
- TXLiteAVSDK_Professional
|
||||||
@@ -122,6 +128,8 @@ EXTERNAL SOURCES:
|
|||||||
:path: ".symlinks/plugins/device_info/ios"
|
:path: ".symlinks/plugins/device_info/ios"
|
||||||
disable_screenshots:
|
disable_screenshots:
|
||||||
:path: ".symlinks/plugins/disable_screenshots/ios"
|
:path: ".symlinks/plugins/disable_screenshots/ios"
|
||||||
|
fijkplayer:
|
||||||
|
:path: ".symlinks/plugins/fijkplayer/ios"
|
||||||
Flutter:
|
Flutter:
|
||||||
:path: Flutter
|
:path: Flutter
|
||||||
flutter_bmfbase:
|
flutter_bmfbase:
|
||||||
@@ -162,10 +170,12 @@ SPEC CHECKSUMS:
|
|||||||
app_installer: 6c31be407728fb6d67cce038fd8547e563e6982c
|
app_installer: 6c31be407728fb6d67cce038fd8547e563e6982c
|
||||||
audioplayers: 53f0f30789b10ab2009771c6c79def00980945e4
|
audioplayers: 53f0f30789b10ab2009771c6c79def00980945e4
|
||||||
BaiduMapKit: 40a4382633859bd569d40da9f9a2e98a277dd28b
|
BaiduMapKit: 40a4382633859bd569d40da9f9a2e98a277dd28b
|
||||||
|
BIJKPlayer: 4c5d66e5cb99ae5bade6f22a4fcc031722a81c64
|
||||||
camera: a0ca5080336f7af47b88436e5e26da3dee5568f0
|
camera: a0ca5080336f7af47b88436e5e26da3dee5568f0
|
||||||
city_pickers: b0370f4c35c201723b5b7fcce10ec29b59d5bc35
|
city_pickers: b0370f4c35c201723b5b7fcce10ec29b59d5bc35
|
||||||
device_info: d7d233b645a32c40dfdc212de5cf646ca482f175
|
device_info: d7d233b645a32c40dfdc212de5cf646ca482f175
|
||||||
disable_screenshots: 3f3a1881efa341fcdad395fb2b25e11a9a7bce0b
|
disable_screenshots: 3f3a1881efa341fcdad395fb2b25e11a9a7bce0b
|
||||||
|
fijkplayer: 0d3793a2822d030ef5bba77f904bff1f7a91a115
|
||||||
Flutter: 0e3d915762c693b495b44d77113d4970485de6ec
|
Flutter: 0e3d915762c693b495b44d77113d4970485de6ec
|
||||||
flutter_bmfbase: 8ac2c94f3f110daec8e499dc13f8a983b0c8ee40
|
flutter_bmfbase: 8ac2c94f3f110daec8e499dc13f8a983b0c8ee40
|
||||||
flutter_bmfmap: 57030919b16b5353649fbea77b6143129f7a4ff1
|
flutter_bmfmap: 57030919b16b5353649fbea77b6143129f7a4ff1
|
||||||
|
|||||||
@@ -35,6 +35,9 @@
|
|||||||
<key>UISupportedInterfaceOrientations</key>
|
<key>UISupportedInterfaceOrientations</key>
|
||||||
<array>
|
<array>
|
||||||
<string>UIInterfaceOrientationPortrait</string>
|
<string>UIInterfaceOrientationPortrait</string>
|
||||||
|
<string>UIInterfaceOrientationLandscapeLeft</string>
|
||||||
|
<string>UIInterfaceOrientationLandscapeRight</string>
|
||||||
|
<string>UIInterfaceOrientationPortraitUpsideDown</string>
|
||||||
</array>
|
</array>
|
||||||
<key>UISupportedInterfaceOrientations~ipad</key>
|
<key>UISupportedInterfaceOrientations~ipad</key>
|
||||||
<array>
|
<array>
|
||||||
|
|||||||
@@ -2145,7 +2145,6 @@ Future getDwspUrlNew(
|
|||||||
print('判断_dwspUrl是否是视频地址?');
|
print('判断_dwspUrl是否是视频地址?');
|
||||||
print('_dwspUrl : ${_dwspUrl}');
|
print('_dwspUrl : ${_dwspUrl}');
|
||||||
if (!isVideoUrl(_dwspUrl)) {
|
if (!isVideoUrl(_dwspUrl)) {
|
||||||
print('_dwspUrl非视频地址?');
|
|
||||||
Fluttertoast.showToast(
|
Fluttertoast.showToast(
|
||||||
msg: '获取 $getingDwmc 点位视频地址失败,请稍后重试。',
|
msg: '获取 $getingDwmc 点位视频地址失败,请稍后重试。',
|
||||||
toastLength: Toast.LENGTH_SHORT,
|
toastLength: Toast.LENGTH_SHORT,
|
||||||
@@ -2154,7 +2153,6 @@ Future getDwspUrlNew(
|
|||||||
//正在获取点位视频标志,禁止重入
|
//正在获取点位视频标志,禁止重入
|
||||||
getingDwVideo = false;
|
getingDwVideo = false;
|
||||||
} else {
|
} else {
|
||||||
print('_dwspUrl非视频地址?');
|
|
||||||
print('开始播放视频地址');
|
print('开始播放视频地址');
|
||||||
playUrl(index: indexRecord, url: _dwspUrl, context: context);
|
playUrl(index: indexRecord, url: _dwspUrl, context: context);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,11 +44,11 @@ EXTERNAL SOURCES:
|
|||||||
|
|
||||||
SPEC CHECKSUMS:
|
SPEC CHECKSUMS:
|
||||||
AFNetworking: 7864c38297c79aaca1500c33288e429c3451fdce
|
AFNetworking: 7864c38297c79aaca1500c33288e429c3451fdce
|
||||||
Flutter: 434fef37c0980e73bb6479ef766c45957d4b510c
|
Flutter: 0e3d915762c693b495b44d77113d4970485de6ec
|
||||||
flutter_superplayer: 50d64a438d4e917295d7c8d8124bcc239f323dad
|
flutter_superplayer: 50d64a438d4e917295d7c8d8124bcc239f323dad
|
||||||
Masonry: 678fab65091a9290e40e2832a55e7ab731aad201
|
Masonry: 678fab65091a9290e40e2832a55e7ab731aad201
|
||||||
TXLiteAVSDK_Professional: 165018e2f0570d2608d7ea2b785fc273558f9920
|
TXLiteAVSDK_Professional: 165018e2f0570d2608d7ea2b785fc273558f9920
|
||||||
|
|
||||||
PODFILE CHECKSUM: b1f7a399522c118a74b177b13c01eca692aa7e6d
|
PODFILE CHECKSUM: b1f7a399522c118a74b177b13c01eca692aa7e6d
|
||||||
|
|
||||||
COCOAPODS: 1.10.1
|
COCOAPODS: 1.11.2
|
||||||
|
|||||||
@@ -151,6 +151,7 @@
|
|||||||
9705A1C41CF9048500538489 /* Embed Frameworks */,
|
9705A1C41CF9048500538489 /* Embed Frameworks */,
|
||||||
3B06AD1E1E4923F5004D2608 /* Thin Binary */,
|
3B06AD1E1E4923F5004D2608 /* Thin Binary */,
|
||||||
EFF62BD560582B20FF73FC03 /* [CP] Copy Pods Resources */,
|
EFF62BD560582B20FF73FC03 /* [CP] Copy Pods Resources */,
|
||||||
|
BF68C3AC7529D977444CE650 /* [CP] Embed Pods Frameworks */,
|
||||||
);
|
);
|
||||||
buildRules = (
|
buildRules = (
|
||||||
);
|
);
|
||||||
@@ -258,6 +259,23 @@
|
|||||||
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
|
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
|
||||||
showEnvVarsInLog = 0;
|
showEnvVarsInLog = 0;
|
||||||
};
|
};
|
||||||
|
BF68C3AC7529D977444CE650 /* [CP] Embed Pods Frameworks */ = {
|
||||||
|
isa = PBXShellScriptBuildPhase;
|
||||||
|
buildActionMask = 2147483647;
|
||||||
|
files = (
|
||||||
|
);
|
||||||
|
inputFileListPaths = (
|
||||||
|
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-input-files.xcfilelist",
|
||||||
|
);
|
||||||
|
name = "[CP] Embed Pods Frameworks";
|
||||||
|
outputFileListPaths = (
|
||||||
|
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-output-files.xcfilelist",
|
||||||
|
);
|
||||||
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
|
shellPath = /bin/sh;
|
||||||
|
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n";
|
||||||
|
showEnvVarsInLog = 0;
|
||||||
|
};
|
||||||
EFF62BD560582B20FF73FC03 /* [CP] Copy Pods Resources */ = {
|
EFF62BD560582B20FF73FC03 /* [CP] Copy Pods Resources */ = {
|
||||||
isa = PBXShellScriptBuildPhase;
|
isa = PBXShellScriptBuildPhase;
|
||||||
buildActionMask = 2147483647;
|
buildActionMask = 2147483647;
|
||||||
|
|||||||
+66
-162
@@ -1,6 +1,7 @@
|
|||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
import 'dart:ui';
|
import 'dart:ui';
|
||||||
|
import 'dart:io';
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
@@ -12,12 +13,11 @@ 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';
|
||||||
|
|
||||||
const _kControlViewTypes = [kControlViewTypeDefault, kControlViewTypeWithout];
|
|
||||||
|
|
||||||
class SuperPlayerPage extends StatefulWidget {
|
class SuperPlayerPage extends StatefulWidget {
|
||||||
SuperPlayerPage(
|
SuperPlayerPage(
|
||||||
{@required this.url,
|
{@required this.url,
|
||||||
@@ -38,31 +38,28 @@ class SuperPlayerPage extends StatefulWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class _SuperPlayerPageState extends State<SuperPlayerPage> with SuperPlayerListener {
|
class _SuperPlayerPageState extends State<SuperPlayerPage> with SuperPlayerListener {
|
||||||
SuperPlayerController _playerController = SuperPlayerController();
|
final SuperPlayerController _playerController = SuperPlayerController();
|
||||||
|
final FijkPlayer _ijkPlayer = FijkPlayer();
|
||||||
|
|
||||||
String _sdkVersion = 'Unknown';
|
String _sdkVersion = 'Unknown';
|
||||||
List<String> _logs = [];
|
List<String> _logs = [];
|
||||||
bool bFullScreen = false;
|
bool bFullScreen = false;
|
||||||
|
|
||||||
String _controlViewType = _kControlViewTypes.first;
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void dispose() {
|
void dispose() {
|
||||||
Playing = false;
|
Playing = 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);
|
||||||
super.dispose();
|
super.dispose();
|
||||||
|
_ijkPlayer.release();
|
||||||
|
_playerController.resetPlayer();
|
||||||
|
_playerController.release();
|
||||||
|
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
//initPlatformState();
|
|
||||||
// Future.delayed(const Duration(milliseconds: 1000), () {
|
|
||||||
// _playerController.playWithModel(SuperPlayerModel(url: widget.url));
|
|
||||||
// setState(() {
|
|
||||||
// });
|
|
||||||
// });
|
|
||||||
init();
|
init();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -70,38 +67,26 @@ class _SuperPlayerPageState extends State<SuperPlayerPage> with SuperPlayerListe
|
|||||||
await _playerController.addListener(this);
|
await _playerController.addListener(this);
|
||||||
await initPlatformState();
|
await initPlatformState();
|
||||||
if (!mounted) return;
|
if (!mounted) return;
|
||||||
print('mounted = ${mounted}');
|
|
||||||
// 开启调试日志
|
|
||||||
//await FTXPlayerController.setConsoleEnabled(true);
|
|
||||||
// 初始化播放器
|
|
||||||
//await _controller.initialize(onlyAudio: true);
|
|
||||||
|
|
||||||
await _playerController.uiHideDanmu(); // 隐藏弹幕
|
if (_useIJKPlayer) {
|
||||||
//设置播放循环,默认播放器的循环次数是1, 即不循环播放。如果设置循环次数0,表示无限循环。
|
await _playerController.removeListener(this);
|
||||||
if (0 == widget.loop) {
|
_ijkPlayer.addListener(_fijkValueListener);
|
||||||
await _playerController.setLoop(true);
|
_ijkPlayer.setDataSource(widget.url, autoPlay: true);
|
||||||
|
} else {
|
||||||
|
await _playerController.uiHideDanmu();
|
||||||
|
if (0 == widget.loop) {
|
||||||
|
await _playerController.setLoop(true);
|
||||||
|
}
|
||||||
|
await _playerController.playWithModel(testSuperPlayerModel);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
await _playerController.playWithModel(testSuperPlayerModel);
|
bool get _useIJKPlayer {
|
||||||
//_controller.play("http://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4");
|
return Platform.isIOS && widget.url.startsWith("rtmp");
|
||||||
// _controller
|
|
||||||
// .play('rtmp://125.64.218.67:9901/rtp/gb_play_34020000001320003016_34020000001320003016');
|
|
||||||
// 设置循环播放
|
|
||||||
//await _controller.setLoop(true);
|
|
||||||
// 开始播放
|
|
||||||
//await _controller.play("http://125.64.218.67:9908/video/2_6063_20210409_140608_川Q31715.mp4");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SuperPlayerModel get testSuperPlayerModel {
|
SuperPlayerModel get testSuperPlayerModel {
|
||||||
// int appId = 1252463788;
|
return SuperPlayerModel(url: widget.url);
|
||||||
// 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.
|
||||||
@@ -157,7 +142,6 @@ class _SuperPlayerPageState extends State<SuperPlayerPage> with SuperPlayerListe
|
|||||||
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
|
||||||
@@ -168,13 +152,9 @@ class _SuperPlayerPageState extends State<SuperPlayerPage> with SuperPlayerListe
|
|||||||
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,
|
||||||
@@ -185,12 +165,6 @@ class _SuperPlayerPageState extends State<SuperPlayerPage> with SuperPlayerListe
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
// decoration: BoxDecoration(
|
|
||||||
// gradient: LinearGradient(colors: [
|
|
||||||
// Color(0xFF0018EB),
|
|
||||||
// Color(0xFF01C1D9),
|
|
||||||
// ], begin: Alignment.bottomCenter, end: Alignment.topCenter),
|
|
||||||
// ),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
title: Padding(
|
title: Padding(
|
||||||
@@ -203,7 +177,7 @@ class _SuperPlayerPageState extends State<SuperPlayerPage> with SuperPlayerListe
|
|||||||
iconData: Icons.chevron_left_outlined,
|
iconData: Icons.chevron_left_outlined,
|
||||||
onPress: () {
|
onPress: () {
|
||||||
getingDwVideo = false;
|
getingDwVideo = false;
|
||||||
Navigator.pop(context);
|
pop();
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
Expanded(
|
Expanded(
|
||||||
@@ -220,16 +194,12 @@ class _SuperPlayerPageState extends State<SuperPlayerPage> with SuperPlayerListe
|
|||||||
),
|
),
|
||||||
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),
|
||||||
@@ -237,11 +207,7 @@ class _SuperPlayerPageState extends State<SuperPlayerPage> with SuperPlayerListe
|
|||||||
child: Stack(
|
child: Stack(
|
||||||
children: [
|
children: [
|
||||||
_playState <= 2 ? getMoreWidget(strokeWidth: 3.0) : SizedBox.shrink(),
|
_playState <= 2 ? getMoreWidget(strokeWidth: 3.0) : SizedBox.shrink(),
|
||||||
SuperPlayerView(
|
_useIJKPlayer ? FijkView(player: _ijkPlayer) : SuperPlayerView(controller: _playerController)
|
||||||
controller: _playerController,
|
|
||||||
controlViewType: _kControlViewTypes[0],
|
|
||||||
),
|
|
||||||
//_playState < 3 ? SizedBox.shrink() : getMoreWidget(strokeWidth: 3.0),
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -254,7 +220,6 @@ class _SuperPlayerPageState extends State<SuperPlayerPage> with SuperPlayerListe
|
|||||||
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,
|
||||||
@@ -407,41 +372,27 @@ class _SuperPlayerPageState extends State<SuperPlayerPage> with SuperPlayerListe
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
// 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);
|
||||||
Navigator.pop(context); //关闭弹框,播放输入视频地址
|
pop();
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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', {});
|
||||||
@@ -450,7 +401,7 @@ class _SuperPlayerPageState extends State<SuperPlayerPage> with SuperPlayerListe
|
|||||||
@override
|
@override
|
||||||
void onClickSmallReturnBtn() {
|
void onClickSmallReturnBtn() {
|
||||||
_addLog('onClickSmallReturnBtn', {});
|
_addLog('onClickSmallReturnBtn', {});
|
||||||
Navigator.maybePop(context);
|
pop();
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -496,6 +447,12 @@ class _SuperPlayerPageState extends State<SuperPlayerPage> with SuperPlayerListe
|
|||||||
_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,
|
||||||
@@ -554,13 +511,7 @@ class _SuperPlayerPageState extends State<SuperPlayerPage> with SuperPlayerListe
|
|||||||
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)),
|
||||||
@@ -576,44 +527,37 @@ class _SuperPlayerPageState extends State<SuperPlayerPage> with SuperPlayerListe
|
|||||||
|
|
||||||
bool bPlaying = true;
|
bool bPlaying = true;
|
||||||
|
|
||||||
void playOrPause() {
|
Future<void> playOrPause() async {
|
||||||
//state : 1 播放状态,2 暂停状态
|
//state : 1 播放状态,2 暂停状态
|
||||||
_playerController.getPlayState().then((state) {
|
int state;
|
||||||
print('state = $state');
|
if (_useIJKPlayer) {
|
||||||
if (1 == state) {
|
state = _ijkPlayer.state == FijkState.started ? 1 : 2;
|
||||||
bPlaying = false;
|
} else {
|
||||||
_playerController.pause();
|
state = await _playerController.getPlayState();
|
||||||
} else {
|
}
|
||||||
bPlaying = true;
|
|
||||||
_playerController.resume();
|
if (1 == state) {
|
||||||
}
|
bPlaying = false;
|
||||||
playerRegionProvide.changePlayerState(bPlaying);
|
_useIJKPlayer ? _ijkPlayer.pause() : _playerController.pause();
|
||||||
Storage.setString('bPlaying', bPlaying ? 'true' : 'false');
|
} else {
|
||||||
setState(() {});
|
bPlaying = true;
|
||||||
});
|
_useIJKPlayer ? _ijkPlayer.start() : _playerController.resume();
|
||||||
|
}
|
||||||
|
playerRegionProvide.changePlayerState(bPlaying);
|
||||||
|
Storage.setString('bPlaying', bPlaying ? 'true' : 'false');
|
||||||
|
setState(() {});
|
||||||
}
|
}
|
||||||
|
|
||||||
void restartPlay(String url) async {
|
void restartPlay(String url) async {
|
||||||
_playState = 4;
|
_playState = 4;
|
||||||
bPlaying = true;
|
bPlaying = true;
|
||||||
_playerController.resetPlayer();
|
if (_useIJKPlayer) {
|
||||||
_playerController.resume();
|
await _ijkPlayer.reset();
|
||||||
// //writeCurrentPosFile();
|
_ijkPlayer.setDataSource(widget.url, autoPlay: true);
|
||||||
// await player.stop();
|
} else {
|
||||||
// await player.reset();
|
_playerController.resetPlayer();
|
||||||
// await player.setOption(FijkOption.playerCategory, "mediacodec-all-videos", 1);
|
_playerController.resume();
|
||||||
// await player.setOption(FijkOption.hostCategory, "enable-snapshot", 1);
|
}
|
||||||
// await player.setOption(FijkOption.hostCategory, "request-screen-on", 1);
|
|
||||||
// await player.setOption(FijkOption.hostCategory, "request-audio-focus", 1);
|
|
||||||
// await player.setOption(FijkOption.hostCategory, "enable-accurate-seek", 1);
|
|
||||||
// await player.setOption(FijkOption.hostCategory, "max-buffer-size", 500 * 1024);
|
|
||||||
// await player.setDataSource(url, autoPlay: true).catchError((e) {
|
|
||||||
// print("setDataSource error: $e");
|
|
||||||
// });
|
|
||||||
// await player.setLoop(widget.loop); //设置播放循环,默认播放器的循环次数是1, 即不循环播放。如果设置循环次数0,表示无限循环。
|
|
||||||
// bPlaying = true;
|
|
||||||
// setState(() {});
|
|
||||||
// playerRegionProvide.changePlayerState(bPlaying);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//生成播放控制区第2行按钮List
|
//生成播放控制区第2行按钮List
|
||||||
@@ -624,24 +568,6 @@ class _SuperPlayerPageState extends State<SuperPlayerPage> with SuperPlayerListe
|
|||||||
double _marginVer = 8;
|
double _marginVer = 8;
|
||||||
|
|
||||||
List<Widget> list = [
|
List<Widget> list = [
|
||||||
// getRoundButton(
|
|
||||||
// diameter: _diameter,
|
|
||||||
// iconSize: _iconSize,
|
|
||||||
// text: '快退',
|
|
||||||
// icon: Icons.fast_rewind,
|
|
||||||
// onPress: () {
|
|
||||||
// fastSeek(false);
|
|
||||||
// },
|
|
||||||
// ),
|
|
||||||
// getRoundButton(
|
|
||||||
// diameter: _diameter,
|
|
||||||
// iconSize: _iconSize,
|
|
||||||
// text: '快进',
|
|
||||||
// icon: Icons.fast_forward,
|
|
||||||
// onPress: () {
|
|
||||||
// fastSeek(true);
|
|
||||||
// },
|
|
||||||
// ),
|
|
||||||
getRoundButton(
|
getRoundButton(
|
||||||
diameter: _diameter,
|
diameter: _diameter,
|
||||||
iconSize: _iconSize,
|
iconSize: _iconSize,
|
||||||
@@ -650,8 +576,6 @@ class _SuperPlayerPageState extends State<SuperPlayerPage> with SuperPlayerListe
|
|||||||
text: '放大',
|
text: '放大',
|
||||||
icon: Icons.zoom_in,
|
icon: Icons.zoom_in,
|
||||||
onPress: () {
|
onPress: () {
|
||||||
//print('Icons.videocam');
|
|
||||||
//_inputDialog(context2);
|
|
||||||
if (10 >= playerRatioProvide.scale) {
|
if (10 >= playerRatioProvide.scale) {
|
||||||
playerRatioProvide.changeScale(playerRatioProvide.scale + 0.5);
|
playerRatioProvide.changeScale(playerRatioProvide.scale + 0.5);
|
||||||
}
|
}
|
||||||
@@ -665,27 +589,11 @@ class _SuperPlayerPageState extends State<SuperPlayerPage> with SuperPlayerListe
|
|||||||
text: '缩小',
|
text: '缩小',
|
||||||
icon: Icons.zoom_out,
|
icon: Icons.zoom_out,
|
||||||
onPress: () {
|
onPress: () {
|
||||||
//print('Icons.videocam');
|
|
||||||
//_getFileDialog(context2);
|
|
||||||
if (1 < playerRatioProvide.scale) {
|
if (1 < playerRatioProvide.scale) {
|
||||||
playerRatioProvide.changeScale(playerRatioProvide.scale - 0.5);
|
playerRatioProvide.changeScale(playerRatioProvide.scale - 0.5);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
// _getIconAndTextButton(
|
|
||||||
// '还原',
|
|
||||||
// Icons.reply,
|
|
||||||
// Colors.orange,
|
|
||||||
// () {
|
|
||||||
// //print('Icons.videocam');
|
|
||||||
// //_getFileDialog(context2);
|
|
||||||
// // 更新当前位置
|
|
||||||
// playerRatioProvide.changeScale(1.0);
|
|
||||||
// playerRatioProvide.changeOffset(Offset(0, 0));
|
|
||||||
// playerRatioProvide.changeDeltaX(0.0);
|
|
||||||
// playerRatioProvide.changeDeltaY(0.0);
|
|
||||||
// },
|
|
||||||
// ),
|
|
||||||
getRoundButton(
|
getRoundButton(
|
||||||
diameter: _diameter,
|
diameter: _diameter,
|
||||||
iconSize: _iconSize,
|
iconSize: _iconSize,
|
||||||
@@ -694,9 +602,6 @@ class _SuperPlayerPageState extends State<SuperPlayerPage> with SuperPlayerListe
|
|||||||
text: '截图',
|
text: '截图',
|
||||||
icon: Icons.camera_alt,
|
icon: Icons.camera_alt,
|
||||||
onPress: () {
|
onPress: () {
|
||||||
//通过上面定义的key,才能准确调用该类型的该对象的方法
|
|
||||||
//_myFijkPanelWidgetBuilderStateKey.currentState.takeSnapshot();
|
|
||||||
//_fijkPanelWidgetBuilder.currentState..takeSnapshot();
|
|
||||||
takeSnapshot();
|
takeSnapshot();
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
@@ -708,8 +613,7 @@ class _SuperPlayerPageState extends State<SuperPlayerPage> with SuperPlayerListe
|
|||||||
text: '全屏',
|
text: '全屏',
|
||||||
icon: Icons.fullscreen,
|
icon: Icons.fullscreen,
|
||||||
onPress: () {
|
onPress: () {
|
||||||
//player.enterFullScreen();
|
_useIJKPlayer ? _ijkPlayer.enterFullScreen() : _playerController.toFullScreen();
|
||||||
_playerController.toFullScreen();
|
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -211,6 +211,13 @@ packages:
|
|||||||
url: "https://pub.flutter-io.cn"
|
url: "https://pub.flutter-io.cn"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.1.3"
|
version: "0.1.3"
|
||||||
|
fijkplayer:
|
||||||
|
dependency: "direct main"
|
||||||
|
description:
|
||||||
|
name: fijkplayer
|
||||||
|
url: "https://pub.flutter-io.cn"
|
||||||
|
source: hosted
|
||||||
|
version: "0.8.8"
|
||||||
file:
|
file:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
|||||||
+1
-1
@@ -79,7 +79,7 @@ dependencies:
|
|||||||
cupertino_icons: ^1.0.0
|
cupertino_icons: ^1.0.0
|
||||||
|
|
||||||
# hyzp_ybqx00_yibin Project Adds
|
# hyzp_ybqx00_yibin Project Adds
|
||||||
# fijkplayer: ^0.8.7
|
fijkplayer: ^0.8.7
|
||||||
path_provider: ^1.6.14
|
path_provider: ^1.6.14
|
||||||
#permission_handler: ^3.3.0
|
#permission_handler: ^3.3.0
|
||||||
permission_handler: ^5.0.1+1
|
permission_handler: ^5.0.1+1
|
||||||
|
|||||||
Reference in New Issue
Block a user