hyzp_ybqx-Commit001:代码刚转换好,编译通过
This commit is contained in:
@@ -0,0 +1,221 @@
|
||||
|
||||
///App.Car_Dwinfo.GetList 获取分页列表数据
|
||||
Map mapDwinfo = {
|
||||
"ret": 200,
|
||||
"data": {
|
||||
"items": [
|
||||
{
|
||||
"id": 1,
|
||||
"dwip": "172.16.3.1",
|
||||
"dwmc": "锦绣花园",
|
||||
"dwbh": 1,
|
||||
"dwinfo": "振兴大道锦绣花园附近",
|
||||
"dwzb": "104.607091|28.807061",
|
||||
"dwms": "振兴大道锦绣花园附近,识别孜岩、红坝路入城排放黑烟车辆",
|
||||
"dwzt": "正常",
|
||||
"video12": "/rtp/gb_play_34020000001320001012_34020000001320001012",
|
||||
"video13": "/rtp/gb_play_34020000001320001014_34020000001320001014",
|
||||
"video14": "/rtp/gb_play_34020000001320001013_34020000001320001013",
|
||||
"video15": "/rtp/gb_play_34020000001320001015_34020000001320001015",
|
||||
"video16": "/rtp/gb_play_34020000001320001016_34020000001320001016",
|
||||
"play_urlhead": "rtmp://125.64.218.67:9901"
|
||||
},
|
||||
{
|
||||
"id": 2,
|
||||
"dwip": "172.16.3.2",
|
||||
"dwmc": "石马溪桥",
|
||||
"dwbh": 2,
|
||||
"dwinfo": "宜飞路石马溪大桥附近",
|
||||
"dwzb": "104.589904|28.787078",
|
||||
"dwms": "宜飞路石马溪大桥附近,识别屏山、菜坝入城排放黑烟车辆",
|
||||
"dwzt": "正常",
|
||||
"video12": "/rtp/gb_play_34020000001320002012_34020000001320002012",
|
||||
"video13": "/rtp/gb_play_34020000001320002013_34020000001320002013",
|
||||
"video14": null,
|
||||
"video15": null,
|
||||
"video16": "/rtp/gb_play_34020000001320002016_34020000001320002016",
|
||||
"play_urlhead": "rtmp://125.64.218.67:9901"
|
||||
},
|
||||
{
|
||||
"id": 3,
|
||||
"dwip": "172.16.3.3",
|
||||
"dwmc": "森林小区",
|
||||
"dwbh": 3,
|
||||
"dwinfo": "岷江南路森林小区附近",
|
||||
"dwzb": "104.603919|28.765568",
|
||||
"dwms": "岷江南路森林小区附近,识别宜宾南收费站出城排放黑烟车辆",
|
||||
"dwzt": "正常",
|
||||
"video12": "/rtp/gb_play_34020000001320003012_34020000001320003012",
|
||||
"video13": "/rtp/gb_play_34020000001320003013_34020000001320003013",
|
||||
"video14": null,
|
||||
"video15": null,
|
||||
"video16": "/rtp/gb_play_34020000001320003016_34020000001320003016",
|
||||
"play_urlhead": "rtmp://125.64.218.67:9901"
|
||||
},
|
||||
{
|
||||
"id": 4,
|
||||
"dwip": "172.16.3.4",
|
||||
"dwmc": "南山星城",
|
||||
"dwbh": 4,
|
||||
"dwinfo": "一曼路南山星城南区附近",
|
||||
"dwzb": "104.556797|28.718901",
|
||||
"dwms": "一曼路南山星城南区附近,识别进入叙州区新城区排放黑烟车辆",
|
||||
"dwzt": "正常",
|
||||
"video12": "/rtp/gb_play_34020000001320004012_34020000001320004012",
|
||||
"video13": "/rtp/gb_play_34020000001320004013_34020000001320004013",
|
||||
"video14": null,
|
||||
"video15": null,
|
||||
"video16": "/rtp/gb_play_34020000001320004016_34020000001320004016",
|
||||
"play_urlhead": "rtmp://125.64.218.67:9901"
|
||||
},
|
||||
{
|
||||
"id": 5,
|
||||
"dwip": "172.16.3.5",
|
||||
"dwmc": "育才学校",
|
||||
"dwbh": 5,
|
||||
"dwinfo": "陵园路宜宾育才学校附近",
|
||||
"dwzb": "104.533476|28.699059",
|
||||
"dwms": "陵园路宜宾育才学校附近,识别叙州区老城区出城车辆排放黑烟",
|
||||
"dwzt": "正常",
|
||||
"video12": "/rtp/gb_play_34020000001320005012_34020000001320005012",
|
||||
"video13": "/rtp/gb_play_34020000001320005013_34020000001320005013",
|
||||
"video14": null,
|
||||
"video15": null,
|
||||
"video16": "/rtp/gb_play_34020000001320005016_34020000001320005016",
|
||||
"play_urlhead": "rtmp://125.64.218.67:9901"
|
||||
},
|
||||
{
|
||||
"id": 6,
|
||||
"dwip": "172.16.3.6",
|
||||
"dwmc": "七星花园",
|
||||
"dwbh": 6,
|
||||
"dwinfo": "七星路东段七星花园小区附近",
|
||||
"dwzb": "104.662376|28.755488",
|
||||
"dwms": "七星路东段七星花园小区附近,识别高县入城排放黑烟车辆",
|
||||
"dwzt": "正常",
|
||||
"video12": "/rtp/gb_play_34020000001320006012_34020000001320006012",
|
||||
"video13": "/rtp/gb_play_34020000001320006013_34020000001320006013",
|
||||
"video14": null,
|
||||
"video15": null,
|
||||
"video16": "/rtp/gb_play_34020000001320006016_34020000001320006016",
|
||||
"play_urlhead": "rtmp://125.64.218.67:9901"
|
||||
},
|
||||
{
|
||||
"id": 7,
|
||||
"dwip": "172.16.3.7",
|
||||
"dwmc": "市财政局",
|
||||
"dwbh": 7,
|
||||
"dwinfo": "南六路宜宾市财政局附近",
|
||||
"dwzb": "104.616581|28.731942",
|
||||
"dwms": "南六路宜宾市财政局附近,识别高县入城排放黑烟车辆",
|
||||
"dwzt": "正常",
|
||||
"video12": "/rtp/gb_play_34020000001320007012_34020000001320007012",
|
||||
"video13": "/rtp/gb_play_34020000001320007013_34020000001320007013",
|
||||
"video14": null,
|
||||
"video15": null,
|
||||
"video16": "/rtp/gb_play_34020000001320007016_34020000001320007016",
|
||||
"play_urlhead": "rtmp://125.64.218.67:9901"
|
||||
},
|
||||
{
|
||||
"id": 8,
|
||||
"dwip": "172.16.3.8",
|
||||
"dwmc": "宜威路",
|
||||
"dwbh": 8,
|
||||
"dwinfo": "宜威路7km+800m附近",
|
||||
"dwzb": "104.687767|28.731159",
|
||||
"dwms": "宜威路7km+800m附近,识别珙县、筠连入城排放黑烟车辆",
|
||||
"dwzt": "正常",
|
||||
"video12": "/rtp/gb_play_34020000001320008012_34020000001320008012",
|
||||
"video13": "/rtp/gb_play_34020000001320008013_34020000001320008013",
|
||||
"video14": null,
|
||||
"video15": null,
|
||||
"video16": "/rtp/gb_play_34020000001320008016_34020000001320008016",
|
||||
"play_urlhead": "rtmp://125.64.218.67:9901"
|
||||
},
|
||||
{
|
||||
"id": 9,
|
||||
"dwip": "172.16.3.9",
|
||||
"dwmc": "宜长路",
|
||||
"dwbh": 9,
|
||||
"dwinfo": "新宜长路13km+700m附近",
|
||||
"dwzb": "104.717384|28.763214",
|
||||
"dwms": "新宜长路13km+700m附近,识别长宁、江安方向排放黑烟车辆",
|
||||
"dwzt": "正常",
|
||||
"video12": "/rtp/gb_play_34020000001320009012_34020000001320009012",
|
||||
"video13": "/rtp/gb_play_34020000001320009013_34020000001320009013",
|
||||
"video14": null,
|
||||
"video15": null,
|
||||
"video16": "/rtp/gb_play_34020000001320009016_34020000001320009016",
|
||||
"play_urlhead": "rtmp://125.64.218.67:9901"
|
||||
},
|
||||
{
|
||||
"id": 10,
|
||||
"dwip": "172.16.3.10",
|
||||
"dwmc": "临港马家湾",
|
||||
"dwbh": 10,
|
||||
"dwinfo": "长江北路四段马家湾附近",
|
||||
"dwzb": "104.759928|28.816636",
|
||||
"dwms": "长江北路四段马家湾附近,识别南溪方向入城排放黑烟车辆",
|
||||
"dwzt": "正常",
|
||||
"video12": "/rtp/gb_play_34020000001320010012_34020000001320010012",
|
||||
"video13": "/rtp/gb_play_34020000001320010013_34020000001320010013",
|
||||
"video14": null,
|
||||
"video15": null,
|
||||
"video16": "/rtp/gb_play_34020000001320010016_34020000001320010016",
|
||||
"play_urlhead": "rtmp://125.64.218.67:9901"
|
||||
},
|
||||
{
|
||||
"id": 11,
|
||||
"dwip": "172.16.3.11",
|
||||
"dwmc": "环城路",
|
||||
"dwbh": 11,
|
||||
"dwinfo": "环城路方水中心学校附近",
|
||||
"dwzb": "104.641112|28.814636",
|
||||
"dwms": "环城路方水中心学校附近,识别自观斗山隧道入城排放黑烟车辆",
|
||||
"dwzt": "正常",
|
||||
"video12": "/rtp/gb_play_34020000001320011012_34020000001320011012",
|
||||
"video13": "/rtp/gb_play_34020000001320011013_34020000001320011013",
|
||||
"video14": null,
|
||||
"video15": null,
|
||||
"video16": "/rtp/gb_play_34020000001320011016_34020000001320011016",
|
||||
"play_urlhead": "rtmp://125.64.218.67:9901"
|
||||
},
|
||||
{
|
||||
"id": 12,
|
||||
"dwip": "172.16.3.12",
|
||||
"dwmc": "陶瓷厂",
|
||||
"dwbh": 12,
|
||||
"dwinfo": "S206省道美莲陶瓷厂附近",
|
||||
"dwzb": "104.63116|28.804407",
|
||||
"dwms": "S206省道美莲陶瓷厂附近,识别省道206入城排放黑烟车辆",
|
||||
"dwzt": "正常",
|
||||
"video12": "/rtp/gb_play_34020000001320012012_34020000001320012012",
|
||||
"video13": "/rtp/gb_play_34020000001320012013_34020000001320012013",
|
||||
"video14": null,
|
||||
"video15": null,
|
||||
"video16": "/rtp/gb_play_34020000001320012016_34020000001320012016",
|
||||
"play_urlhead": "rtmp://125.64.218.67:9901"
|
||||
},
|
||||
{
|
||||
"id": 13,
|
||||
"dwip": "172.16.3.13",
|
||||
"dwmc": "鑫菁英",
|
||||
"dwbh": 13,
|
||||
"dwinfo": "外江路鑫菁英小区附近",
|
||||
"dwzb": "104.623547|28.74798",
|
||||
"dwms": "外江路鑫菁英小区附近,识别中坝大桥往高铁站排放黑烟车辆",
|
||||
"dwzt": "正常",
|
||||
"video12": "/rtp/gb_play_34020000001320013012_34020000001320013012",
|
||||
"video13": "/rtp/gb_play_34020000001320013013_34020000001320013013",
|
||||
"video14": null,
|
||||
"video15": null,
|
||||
"video16": "/rtp/gb_play_34020000001320013016_34020000001320013016",
|
||||
"play_urlhead": "rtmp://125.64.218.67:9901"
|
||||
}
|
||||
],
|
||||
"total": 13,
|
||||
"page": 1,
|
||||
"perpage": 20
|
||||
},
|
||||
"msg": ""
|
||||
};
|
||||
@@ -0,0 +1,105 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'superplayer_home.dart';
|
||||
|
||||
//import 'tc_player.dart';
|
||||
import 'data_file.dart';
|
||||
|
||||
void main() {
|
||||
runApp(MyApp());
|
||||
}
|
||||
|
||||
class MyApp extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return MaterialApp(
|
||||
home: HomePage(),
|
||||
theme: ThemeData(primarySwatch: Colors.blue),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class HomePage extends StatefulWidget {
|
||||
@override
|
||||
_HomePageState createState() => _HomePageState();
|
||||
}
|
||||
|
||||
class _HomePageState extends State<HomePage> {
|
||||
var crashInfo;
|
||||
bool isLoadOk = false;
|
||||
List<Widget> listButton = [];
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
getListButton().then((value) {
|
||||
setState(() {});
|
||||
});
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: const Text('LiteAVSDK播放 plugin example app'),
|
||||
),
|
||||
body: Center(
|
||||
child: ListView(
|
||||
children: listButton,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
var isLoad = false;
|
||||
|
||||
void showMsg(String msg) {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (context) {
|
||||
return AlertDialog(
|
||||
content: Text(msg),
|
||||
actions: [
|
||||
FlatButton(
|
||||
onPressed: () {
|
||||
Navigator.pop(context);
|
||||
},
|
||||
child: Text("我知道了"))
|
||||
],
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
Future getListButton() async {
|
||||
List listDw = mapDwinfo['data']['items'];
|
||||
|
||||
List<Widget> _listButton = [];
|
||||
_listButton.addAll([
|
||||
getPlayUrl(
|
||||
'http://www.yibinu.edu.cn/__local/5/35/DF/264049B7E978EEE2F5849688986_05D4A6FE_152CDB8C.mp4?e=.mp4',
|
||||
'yibinu'),
|
||||
getPlayUrl('https://yongling8808.github.io/test/video/movie/movie.mp4', '网络视频'),
|
||||
getPlayUrl(
|
||||
'http://125.64.218.67:9908/video/2_6063_20210410_155327_川QKK380.mp4', '违章视频-川QKK380'),
|
||||
getPlayUrl(
|
||||
'http://125.64.218.67:9908/video/2_6063_20210409_140608_川Q31715.mp4', '违章视频-川Q31715'),
|
||||
]);
|
||||
|
||||
for (Map item in listDw) {
|
||||
_listButton.add(
|
||||
getPlayUrl(item["play_urlhead"] + item["video16"], '${item["dwbh"]}.' + item["dwmc"]));
|
||||
}
|
||||
|
||||
listButton = _listButton;
|
||||
}
|
||||
|
||||
Widget getPlayUrl(String _url, text) {
|
||||
return RaisedButton(
|
||||
child: Text("LiteAVSDK播放-$text"),
|
||||
onPressed: () async {
|
||||
Navigator.of(context).push(MaterialPageRoute(
|
||||
builder: (context) => SuperPlayerPage(url: _url, loop: 0, title: text)));
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,162 @@
|
||||
import 'dart:convert';
|
||||
import 'dart:ui';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_superplayer/flutter_superplayer.dart';
|
||||
|
||||
const _kControlViewTypes = [kControlViewTypeDefault, kControlViewTypeWithout];
|
||||
|
||||
class SuperPlayerPage extends StatefulWidget {
|
||||
SuperPlayerPage({@required this.url, this.loop = 1, this.title = 'Tencent Player', Key key})
|
||||
: super(key: key);
|
||||
String url;
|
||||
String title;
|
||||
int loop; //设置播放循环,默认播放器的循环次数是1, 即不循环播放。如果设置循环次数0,表示无限循环。
|
||||
|
||||
@override
|
||||
_SuperPlayerPageState createState() => _SuperPlayerPageState();
|
||||
}
|
||||
|
||||
class _SuperPlayerPageState extends State<SuperPlayerPage> with SuperPlayerListener {
|
||||
SuperPlayerController _playerController = SuperPlayerController();
|
||||
|
||||
String _sdkVersion = 'Unknown';
|
||||
List<String> _logs = [];
|
||||
bool bFullScreen = false;
|
||||
|
||||
String _controlViewType = _kControlViewTypes.first;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
//initPlatformState();
|
||||
// Future.delayed(const Duration(milliseconds: 1000), () {
|
||||
// _playerController.playWithModel(SuperPlayerModel(url: widget.url));
|
||||
// setState(() {
|
||||
// });
|
||||
// });
|
||||
init();
|
||||
}
|
||||
|
||||
Future<void> init() async {
|
||||
await _playerController.addListener(this);
|
||||
await initPlatformState();
|
||||
if (!mounted) return;
|
||||
print('mounted = ${mounted}');
|
||||
// 开启调试日志
|
||||
//await FTXPlayerController.setConsoleEnabled(true);
|
||||
// 初始化播放器
|
||||
//await _controller.initialize(onlyAudio: true);
|
||||
await _playerController.uiHideDanmu();
|
||||
//设置播放循环,默认播放器的循环次数是1, 即不循环播放。如果设置循环次数0,表示无限循环。
|
||||
if (0 == widget.loop) {
|
||||
await _playerController.setLoop(true);
|
||||
}
|
||||
await _playerController.playWithModel(testSuperPlayerModel);
|
||||
//_controller.play("http://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4");
|
||||
// _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 {
|
||||
// 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.
|
||||
Future<void> initPlatformState() async {
|
||||
String sdkVersion;
|
||||
// Platform messages may fail, so we use a try/catch PlatformException.
|
||||
try {
|
||||
sdkVersion = await FlutterSuperPlayer.sdkVersion;
|
||||
} on PlatformException {
|
||||
sdkVersion = 'Failed to get platform version.';
|
||||
}
|
||||
print('sdkVersion = ${sdkVersion}');
|
||||
print('mounted = ${mounted}');
|
||||
|
||||
// If the widget was removed from the tree while the asynchronous platform
|
||||
// message was in flight, we want to discard the reply rather than calling
|
||||
// setState to update our non-existent appearance.
|
||||
if (!mounted) return;
|
||||
|
||||
setState(() {
|
||||
_sdkVersion = sdkVersion;
|
||||
});
|
||||
}
|
||||
|
||||
void _addLog(String method, dynamic data) {
|
||||
_logs.add('>>>$method');
|
||||
if (data != null) {
|
||||
_logs.add(data is Map ? json.encode(data) : data);
|
||||
}
|
||||
_logs.add(' ');
|
||||
|
||||
setState(() {});
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
body: Align(
|
||||
alignment: Alignment(0, 0),
|
||||
child: Container(
|
||||
padding:
|
||||
EdgeInsets.only(top: bFullScreen ? 0 : MediaQueryData.fromWindow(window).padding.top),
|
||||
alignment: Alignment(0, 0),
|
||||
width: MediaQuery.of(context).size.width,
|
||||
child: SuperPlayerView(
|
||||
controller: _playerController,
|
||||
controlViewType: _controlViewType,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
void onClickFloatCloseBtn() {
|
||||
_addLog('onClickFloatCloseBtn', {});
|
||||
}
|
||||
|
||||
@override
|
||||
void onClickSmallReturnBtn() {
|
||||
_addLog('onClickSmallReturnBtn', {});
|
||||
Navigator.maybePop(context);
|
||||
}
|
||||
|
||||
@override
|
||||
void onFullScreenChange(bool isFullScreen) {
|
||||
_addLog('onFullScreenChange', {'isFullScreen': isFullScreen});
|
||||
bFullScreen = !bFullScreen;
|
||||
setState(() {});
|
||||
}
|
||||
|
||||
@override
|
||||
void onPlayProgressChange(int current, int duration) {
|
||||
_addLog('onPlayProgressChange', {'current': current, 'duration': duration});
|
||||
}
|
||||
|
||||
@override
|
||||
void onPlayStateChange(int playState) {
|
||||
_addLog('onPlayStateChange', {'playState': playState});
|
||||
}
|
||||
|
||||
@override
|
||||
void onStartFloatWindowPlay() {
|
||||
_addLog('onStartFloatWindowPlay', {});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user