-
Notifications
You must be signed in to change notification settings - Fork 104
/
main.dart
130 lines (120 loc) · 4.24 KB
/
main.dart
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'page/index.dart';
void main() {
WidgetsFlutterBinding.ensureInitialized();
SystemChrome.setPreferredOrientations([
DeviceOrientation.portraitUp,
]);
runApp(MyApp());
}
class MyApp extends StatefulWidget {
@override
_MyAppState createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
@override
Widget build(BuildContext context) {
return MaterialApp(
theme: ThemeData(primaryColor: Colors.pink),
debugShowCheckedModeBanner: false,
routes: {
'/': (_) => ListPage(),
'window': (_) => WindowVideoPage(),
'full': (_) => FullVideoPage(),
'download': (_) => DownloadPage(),
}
);
}
}
enum PlayType {
network,
asset,
file,
fileId,
}
String networkMp4 = 'http://1252463788.vod2.myqcloud.com/95576ef5vodtransgzp1252463788/e1ab85305285890781763144364/v.f10.mp4';
String liveUrl1 = 'http://liteavapp.qcloud.com/live/liteavdemoplayerstreamid_demo1080p.flv';
String liveUrl2 = 'rtmp://58.200.131.2:1935/livetv/hunantv';
String assetPath = 'static/tencent1.mp4';
String rotateNetworkMp4 = 'http://file.jinxianyun.com/tencentplayer_rotate.mp4';
String invalidMp4 = 'https://123456';
class ListPage extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: Text('腾讯播放器Demo'),),
body: ListView(
children: <Widget>[
ListTile(
title: Text('小窗视频'),
onTap: () {
Navigator.of(context).push(CupertinoPageRoute(builder: (_) => WindowVideoPage(playType: PlayType.network, dataSource: networkMp4,)));
},
),
ListTile(
title: Text('网络视频'),
onTap: () {
Navigator.of(context).push(CupertinoPageRoute(builder: (_) => FullVideoPage(playType: PlayType.network, dataSource: networkMp4,)));
},
),
ListTile(
title: Text('直播1'),
onTap: () {
Navigator.of(context).push(CupertinoPageRoute(builder: (_) => FullVideoPage(playType: PlayType.network, dataSource: liveUrl1, showBottomWidget: false, showClearBtn: false,)));
},
),
ListTile(
title: Text('直播2'),
onTap: () {
Navigator.of(context).push(CupertinoPageRoute(builder: (_) => FullVideoPage(playType: PlayType.network, dataSource: liveUrl2, showBottomWidget: false, showClearBtn: false,)));
},
),
ListTile(
title: Text('file视频'),
onTap: () {
Navigator.of(context).push(CupertinoPageRoute(builder: (_) => FileVideoPage()));
},
),
ListTile(
title: Text('asset视频'),
onTap: () {
Navigator.of(context).push(CupertinoPageRoute(builder: (_) => FullVideoPage(playType: PlayType.asset, dataSource: assetPath,)));
},
),
ListTile(
title: Text('下载播放视频'),
onTap: () {
Navigator.of(context).push(CupertinoPageRoute(builder: (_) => DownloadPage()));
},
),
ListTile(
title: Text('自动切换集'),
onTap: () {
Navigator.of(context).push(CupertinoPageRoute(builder: (_) => AutoChangeNextSourcePage()));
},
),
ListTile(
title: Text('仿抖音'),
onTap: () {
Navigator.of(context).push(CupertinoPageRoute(builder: (_) => TiktokPage()));
},
),
ListTile(
title: Text('带旋转属性的视频'),
onTap: () {
Navigator.of(context).push(CupertinoPageRoute(builder: (_) => FullVideoPage(playType: PlayType.network, dataSource: rotateNetworkMp4,)));
},
),
ListTile(
title: Text('播放无效链接'),
onTap: () {
Navigator.of(context).push(CupertinoPageRoute(builder: (_) => FullVideoPage(playType: PlayType.network, dataSource: invalidMp4,)));
},
),
],
),
);
}
}