|
@@ -1,6 +1,7 @@
|
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter/material.dart';
|
|
|
import 'package:flutter_ijkplayer/flutter_ijkplayer.dart';
|
|
import 'package:flutter_ijkplayer/flutter_ijkplayer.dart';
|
|
|
import 'package:photo/photo.dart';
|
|
import 'package:photo/photo.dart';
|
|
|
|
|
+import 'package:photo_manager/photo_manager.dart';
|
|
|
|
|
|
|
|
void main() => runApp(MyApp());
|
|
void main() => runApp(MyApp());
|
|
|
|
|
|
|
@@ -67,8 +68,8 @@ class HomePageState extends State<HomePage> {
|
|
|
child: Icon(Icons.play_arrow),
|
|
child: Icon(Icons.play_arrow),
|
|
|
onPressed: () async {
|
|
onPressed: () async {
|
|
|
await controller.setDataSource(
|
|
await controller.setDataSource(
|
|
|
- // 'https://www.sample-videos.com/video123/mp4/720/big_buck_bunny_720p_20mb.mp4',
|
|
|
|
|
- 'rtmp://172.16.100.245/live1',
|
|
|
|
|
|
|
+ 'https://www.sample-videos.com/video123/mp4/720/big_buck_bunny_720p_20mb.mp4',
|
|
|
|
|
+ // 'rtmp://172.16.100.245/live1',
|
|
|
// 'https://www.sample-videos.com/video123/flv/720/big_buck_bunny_720p_10mb.flv',
|
|
// 'https://www.sample-videos.com/video123/flv/720/big_buck_bunny_720p_10mb.flv',
|
|
|
// 'http://184.72.239.149/vod/smil:BigBuckBunny.smil/playlist.m3u8',
|
|
// 'http://184.72.239.149/vod/smil:BigBuckBunny.smil/playlist.m3u8',
|
|
|
// "file:///sdcard/Download/Sample1.mp4",
|
|
// "file:///sdcard/Download/Sample1.mp4",
|
|
@@ -81,12 +82,48 @@ class HomePageState extends State<HomePage> {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
void _pickVideo() async {
|
|
void _pickVideo() async {
|
|
|
- var list = await PhotoPicker.pickAsset(
|
|
|
|
|
|
|
+ List<AssetEntity> imgList = await PhotoPicker.pickAsset(
|
|
|
|
|
+ // BuildContext required
|
|
|
context: context,
|
|
context: context,
|
|
|
|
|
+
|
|
|
|
|
+ /// The following are optional parameters.
|
|
|
|
|
+ themeColor: Colors.green,
|
|
|
|
|
+ // the title color and bottom color
|
|
|
|
|
+ padding: 1.0,
|
|
|
|
|
+ // item padding
|
|
|
|
|
+ dividerColor: Colors.grey,
|
|
|
|
|
+ // divider color
|
|
|
|
|
+ disableColor: Colors.grey.shade300,
|
|
|
|
|
+ // the check box disable color
|
|
|
|
|
+ itemRadio: 0.88,
|
|
|
|
|
+ // the content item radio
|
|
|
|
|
+ maxSelected: 8,
|
|
|
|
|
+ // max picker image count
|
|
|
|
|
+ // provider: I18nProvider.english,
|
|
|
|
|
+ provider: I18nProvider.chinese,
|
|
|
|
|
+ // i18n provider ,default is chinese. , you can custom I18nProvider or use ENProvider()
|
|
|
|
|
+ rowCount: 3,
|
|
|
|
|
+ // item row count
|
|
|
|
|
+ textColor: Colors.white,
|
|
|
|
|
+ // text color
|
|
|
|
|
+ thumbSize: 160,
|
|
|
|
|
+ // preview thumb size , default is 64
|
|
|
|
|
+ sortDelegate: SortDelegate.common,
|
|
|
|
|
+ // default is common ,or you make custom delegate to sort your gallery
|
|
|
|
|
+ checkBoxBuilderDelegate: DefaultCheckBoxBuilderDelegate(
|
|
|
|
|
+ activeColor: Colors.white,
|
|
|
|
|
+ unselectedColor: Colors.white,
|
|
|
|
|
+ ),
|
|
|
|
|
+ // default is DefaultCheckBoxBuilderDelegate ,or you make custom delegate to create checkbox
|
|
|
|
|
+
|
|
|
|
|
+ badgeDelegate: const DurationBadgeDelegate(),
|
|
|
|
|
+ // badgeDelegate to show badge widget
|
|
|
|
|
+
|
|
|
pickType: PickType.onlyVideo,
|
|
pickType: PickType.onlyVideo,
|
|
|
);
|
|
);
|
|
|
- if (list != null && list.isNotEmpty) {
|
|
|
|
|
- var asset = list[0];
|
|
|
|
|
|
|
+
|
|
|
|
|
+ if (imgList != null && imgList.isNotEmpty) {
|
|
|
|
|
+ var asset = imgList[0];
|
|
|
var fileUri = (await asset.file).uri;
|
|
var fileUri = (await asset.file).uri;
|
|
|
playUri(fileUri.toString());
|
|
playUri(fileUri.toString());
|
|
|
}
|
|
}
|