Commit 23f700a2 authored by 林生雨's avatar 林生雨

commit

parent a2d54ab0
...@@ -6,18 +6,16 @@ ...@@ -6,18 +6,16 @@
</component> </component>
<component name="ChangeListManager"> <component name="ChangeListManager">
<list default="true" id="5be6bbb5-7d6e-4540-a24f-d2b3bf78b3ba" name="Default Changelist" comment=""> <list default="true" id="5be6bbb5-7d6e-4540-a24f-d2b3bf78b3ba" name="Default Changelist" comment="">
<change afterPath="$PROJECT_DIR$/example/ios/.symlinks/plugins/gengmei_flutter_plugin/example/lib/AlbumModel/Anim.dart" afterDir="false" />
<change afterPath="$PROJECT_DIR$/example/ios/.symlinks/plugins/gengmei_flutter_plugin/example/lib/AlbumModel/page/preview/AlbumPreviewModel.dart" afterDir="false" />
<change afterPath="$PROJECT_DIR$/example/ios/.symlinks/plugins/gengmei_flutter_plugin/example/lib/AlbumModel/page/preview/AlbumPreviewPage.dart" afterDir="false" />
<change afterPath="$PROJECT_DIR$/example/lib/AlbumModel/Anim.dart" afterDir="false" />
<change afterPath="$PROJECT_DIR$/example/lib/AlbumModel/page/preview/AlbumPreviewModel.dart" afterDir="false" />
<change afterPath="$PROJECT_DIR$/example/lib/AlbumModel/page/preview/AlbumPreviewPage.dart" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" /> <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/example/ios/.symlinks/plugins/gengmei_flutter_plugin/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/example/ios/.symlinks/plugins/gengmei_flutter_plugin/.idea/workspace.xml" afterDir="false" /> <change beforePath="$PROJECT_DIR$/example/ios/.symlinks/plugins/gengmei_flutter_plugin/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/example/ios/.symlinks/plugins/gengmei_flutter_plugin/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/example/ios/.symlinks/plugins/gengmei_flutter_plugin/example/lib/AlbumModel/page/album/AlbumModel.dart" beforeDir="false" afterPath="$PROJECT_DIR$/example/ios/.symlinks/plugins/gengmei_flutter_plugin/example/lib/AlbumModel/page/album/AlbumModel.dart" afterDir="false" /> <change beforePath="$PROJECT_DIR$/example/ios/.symlinks/plugins/gengmei_flutter_plugin/example/lib/AlbumModel/page/album/AlbumModel.dart" beforeDir="false" afterPath="$PROJECT_DIR$/example/ios/.symlinks/plugins/gengmei_flutter_plugin/example/lib/AlbumModel/page/album/AlbumModel.dart" afterDir="false" />
<change beforePath="$PROJECT_DIR$/example/ios/.symlinks/plugins/gengmei_flutter_plugin/ios/Classes/GengmeiFlutterPlugin.m" beforeDir="false" afterPath="$PROJECT_DIR$/example/ios/.symlinks/plugins/gengmei_flutter_plugin/ios/Classes/GengmeiFlutterPlugin.m" afterDir="false" />
<change beforePath="$PROJECT_DIR$/example/ios/.symlinks/plugins/gengmei_flutter_plugin/lib/ScanImagePlugn.dart" beforeDir="false" afterPath="$PROJECT_DIR$/example/ios/.symlinks/plugins/gengmei_flutter_plugin/lib/ScanImagePlugn.dart" afterDir="false" />
<change beforePath="$PROJECT_DIR$/example/ios/.symlinks/plugins/gengmei_flutter_plugin/lib/gengmei_flutter_plugin.dart" beforeDir="false" afterPath="$PROJECT_DIR$/example/ios/.symlinks/plugins/gengmei_flutter_plugin/lib/gengmei_flutter_plugin.dart" afterDir="false" />
<change beforePath="$PROJECT_DIR$/example/lib/AlbumModel/page/album/AlbumModel.dart" beforeDir="false" afterPath="$PROJECT_DIR$/example/lib/AlbumModel/page/album/AlbumModel.dart" afterDir="false" /> <change beforePath="$PROJECT_DIR$/example/lib/AlbumModel/page/album/AlbumModel.dart" beforeDir="false" afterPath="$PROJECT_DIR$/example/lib/AlbumModel/page/album/AlbumModel.dart" afterDir="false" />
<change beforePath="$PROJECT_DIR$/example/lib/AlbumModel/page/album/AlbumPage.dart" beforeDir="false" afterPath="$PROJECT_DIR$/example/lib/AlbumModel/page/album/AlbumPage.dart" afterDir="false" />
<change beforePath="$PROJECT_DIR$/ios/Classes/GengmeiFlutterPlugin.m" beforeDir="false" afterPath="$PROJECT_DIR$/ios/Classes/GengmeiFlutterPlugin.m" afterDir="false" /> <change beforePath="$PROJECT_DIR$/ios/Classes/GengmeiFlutterPlugin.m" beforeDir="false" afterPath="$PROJECT_DIR$/ios/Classes/GengmeiFlutterPlugin.m" afterDir="false" />
<change beforePath="$PROJECT_DIR$/lib/ScanImagePlugn.dart" beforeDir="false" afterPath="$PROJECT_DIR$/lib/ScanImagePlugn.dart" afterDir="false" />
<change beforePath="$PROJECT_DIR$/lib/gengmei_flutter_plugin.dart" beforeDir="false" afterPath="$PROJECT_DIR$/lib/gengmei_flutter_plugin.dart" afterDir="false" />
</list> </list>
<ignored path="$PROJECT_DIR$/.dart_tool/" /> <ignored path="$PROJECT_DIR$/.dart_tool/" />
<ignored path="$PROJECT_DIR$/.idea/" /> <ignored path="$PROJECT_DIR$/.idea/" />
...@@ -40,8 +38,8 @@ ...@@ -40,8 +38,8 @@
<file pinned="false" current-in-tab="true"> <file pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/example/lib/AlbumModel/page/album/AlbumModel.dart"> <entry file="file://$PROJECT_DIR$/example/lib/AlbumModel/page/album/AlbumModel.dart">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="396"> <state relative-caret-position="164">
<caret line="369" selection-start-line="369" selection-end-line="369" /> <caret line="356" selection-start-line="356" selection-end-line="356" />
<folding> <folding>
<element signature="e#46#66#0" expanded="true" /> <element signature="e#46#66#0" expanded="true" />
</folding> </folding>
...@@ -97,8 +95,8 @@ ...@@ -97,8 +95,8 @@
<file pinned="false" current-in-tab="false"> <file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/lib/ScanImagePlugn.dart"> <entry file="file://$PROJECT_DIR$/lib/ScanImagePlugn.dart">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="325"> <state relative-caret-position="204">
<caret line="49" selection-start-line="49" selection-end-line="52" selection-end-column="3" /> <caret line="54" column="55" selection-start-line="54" selection-start-column="39" selection-end-line="54" selection-end-column="55" />
<folding> <folding>
<element signature="e#45#86#0" expanded="true" /> <element signature="e#45#86#0" expanded="true" />
</folding> </folding>
...@@ -109,8 +107,8 @@ ...@@ -109,8 +107,8 @@
<file pinned="false" current-in-tab="false"> <file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/lib/gengmei_flutter_plugin.dart"> <entry file="file://$PROJECT_DIR$/lib/gengmei_flutter_plugin.dart">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="291"> <state relative-caret-position="401">
<caret line="29" column="35" selection-start-line="29" selection-start-column="21" selection-end-line="29" selection-end-column="35" /> <caret line="34" column="41" selection-start-line="34" selection-start-column="41" selection-end-line="34" selection-end-column="41" />
<folding> <folding>
<element signature="e#0#20#0" expanded="true" /> <element signature="e#0#20#0" expanded="true" />
</folding> </folding>
...@@ -197,18 +195,18 @@ ...@@ -197,18 +195,18 @@
<option value="$PROJECT_DIR$/lib/SharedPlugin.dart" /> <option value="$PROJECT_DIR$/lib/SharedPlugin.dart" />
<option value="$PROJECT_DIR$/example/lib/main.dart" /> <option value="$PROJECT_DIR$/example/lib/main.dart" />
<option value="$PROJECT_DIR$/example/lib/AlbumModel/repository/AlbumRepository.dart" /> <option value="$PROJECT_DIR$/example/lib/AlbumModel/repository/AlbumRepository.dart" />
<option value="$PROJECT_DIR$/lib/ScanImagePlugn.dart" />
<option value="$PROJECT_DIR$/lib/gengmei_flutter_plugin.dart" />
<option value="$PROJECT_DIR$/example/lib/AlbumModel/page/preview/AlbumPreviewModel.dart" /> <option value="$PROJECT_DIR$/example/lib/AlbumModel/page/preview/AlbumPreviewModel.dart" />
<option value="$PROJECT_DIR$/example/lib/AlbumModel/page/album/AlbumPage.dart" /> <option value="$PROJECT_DIR$/example/lib/AlbumModel/page/album/AlbumPage.dart" />
<option value="$PROJECT_DIR$/example/lib/AlbumModel/page/preview/AlbumPreviewPage.dart" /> <option value="$PROJECT_DIR$/example/lib/AlbumModel/page/preview/AlbumPreviewPage.dart" />
<option value="$PROJECT_DIR$/lib/gengmei_flutter_plugin.dart" />
<option value="$PROJECT_DIR$/lib/ScanImagePlugn.dart" />
<option value="$PROJECT_DIR$/example/lib/AlbumModel/page/album/AlbumModel.dart" /> <option value="$PROJECT_DIR$/example/lib/AlbumModel/page/album/AlbumModel.dart" />
</list> </list>
</option> </option>
</component> </component>
<component name="ProjectFrameBounds" extendedState="6"> <component name="ProjectFrameBounds" extendedState="6">
<option name="x" value="-79" /> <option name="x" value="91" />
<option name="y" value="24" /> <option name="y" value="23" />
<option name="width" value="1440" /> <option name="width" value="1440" />
<option name="height" value="811" /> <option name="height" value="811" />
</component> </component>
...@@ -263,15 +261,6 @@ ...@@ -263,15 +261,6 @@
<item name="page" type="462c0819:PsiDirectoryNode" /> <item name="page" type="462c0819:PsiDirectoryNode" />
<item name="album" type="462c0819:PsiDirectoryNode" /> <item name="album" type="462c0819:PsiDirectoryNode" />
</path> </path>
<path>
<item name="gengmei_flutter_plugin" type="b2602c69:ProjectViewProjectNode" />
<item name="gengmei_flutter_plugin" type="462c0819:PsiDirectoryNode" />
<item name="example" type="462c0819:PsiDirectoryNode" />
<item name="lib" type="462c0819:PsiDirectoryNode" />
<item name="AlbumModel" type="462c0819:PsiDirectoryNode" />
<item name="page" type="462c0819:PsiDirectoryNode" />
<item name="preview" type="462c0819:PsiDirectoryNode" />
</path>
<path> <path>
<item name="gengmei_flutter_plugin" type="b2602c69:ProjectViewProjectNode" /> <item name="gengmei_flutter_plugin" type="b2602c69:ProjectViewProjectNode" />
<item name="gengmei_flutter_plugin" type="462c0819:PsiDirectoryNode" /> <item name="gengmei_flutter_plugin" type="462c0819:PsiDirectoryNode" />
...@@ -587,26 +576,6 @@ ...@@ -587,26 +576,6 @@
</state> </state>
</provider> </provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/lib/ScanImagePlugn.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="325">
<caret line="49" selection-start-line="49" selection-end-line="52" selection-end-column="3" />
<folding>
<element signature="e#45#86#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/lib/gengmei_flutter_plugin.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="291">
<caret line="29" column="35" selection-start-line="29" selection-start-column="21" selection-end-line="29" selection-end-column="35" />
<folding>
<element signature="e#0#20#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/example/lib/AlbumModel/Anim.dart"> <entry file="file://$PROJECT_DIR$/example/lib/AlbumModel/Anim.dart">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-1390" /> <state relative-caret-position="-1390" />
...@@ -639,10 +608,30 @@ ...@@ -639,10 +608,30 @@
</state> </state>
</provider> </provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/lib/gengmei_flutter_plugin.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="401">
<caret line="34" column="41" selection-start-line="34" selection-start-column="41" selection-end-line="34" selection-end-column="41" />
<folding>
<element signature="e#0#20#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/lib/ScanImagePlugn.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="204">
<caret line="54" column="55" selection-start-line="54" selection-start-column="39" selection-end-line="54" selection-end-column="55" />
<folding>
<element signature="e#45#86#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/example/lib/AlbumModel/page/album/AlbumModel.dart"> <entry file="file://$PROJECT_DIR$/example/lib/AlbumModel/page/album/AlbumModel.dart">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="396"> <state relative-caret-position="164">
<caret line="369" selection-start-line="369" selection-end-line="369" /> <caret line="356" selection-start-line="356" selection-end-line="356" />
<folding> <folding>
<element signature="e#46#66#0" expanded="true" /> <element signature="e#46#66#0" expanded="true" />
</folding> </folding>
......
...@@ -96,12 +96,11 @@ class AlbumModel { ...@@ -96,12 +96,11 @@ class AlbumModel {
// } // }
// }); // });
// } // }
compute(paseAlbum, event).then((value){ compute(paseAlbum, event).then((value) {
_mainValue = value; _mainValue = value;
albumLive.notifyView(_mainValue[_nowDirName]); albumLive.notifyView(_mainValue[_nowDirName]);
}); });
// _mainValue=newMap; // _mainValue=newMap;
// var list = map[_nowDirName]; // var list = map[_nowDirName];
// _mainValue.forEach((k, itemList) { // _mainValue.forEach((k, itemList) {
...@@ -133,7 +132,6 @@ class AlbumModel { ...@@ -133,7 +132,6 @@ class AlbumModel {
// } // }
// } // }
// print("EVENTTTT !! ${tempList.length} ${tempList}"); // print("EVENTTTT !! ${tempList.length} ${tempList}");
} }
void _onError(Object error) { void _onError(Object error) {
...@@ -146,8 +144,7 @@ class AlbumModel { ...@@ -146,8 +144,7 @@ class AlbumModel {
.receiveBroadcastStream() .receiveBroadcastStream()
.listen(_onEvent, onError: _onError); .listen(_onEvent, onError: _onError);
// } // }
AlbumRepository.getInstance().scanPhoneImg() AlbumRepository.getInstance().scanPhoneImg().listen((value) {
.listen((value) {
if (value != null) { if (value != null) {
_mainValue = value; _mainValue = value;
value.forEach((key, eachValue) { value.forEach((key, eachValue) {
...@@ -347,27 +344,33 @@ class AlbumModel { ...@@ -347,27 +344,33 @@ class AlbumModel {
showPop = false; showPop = false;
albumLive.notifyView(_mainValue[dirName]); albumLive.notifyView(_mainValue[dirName]);
} }
bool previewItemClick = false; bool previewItemClick = false;
void previewItem(BuildContext context, int index, String pageName) { void previewItem(BuildContext context, int index, String pageName) {
String path; String path;
if (Platform.isAndroid) { if (Platform.isAndroid) {
path = albumLive.data[index].realPath; path = albumLive.data[index].realPath;
Navigator.push(context, CustomRoute(AlbumPreviewPage(path, pageName))); Navigator.push(context, CustomRoute(AlbumPreviewPage(path, pageName)));
} else { } else {
// Navigator.push( path = albumLive.data[index].path;
// context, CustomRoute(AlbumPreviewPage(albumLive.data[index].path, pageName))); if (albumLive.data[index].isVideo) {
GengmeiFlutterPlugin.playAlbumVideo(path);
} else {
if (previewItemClick) { if (previewItemClick) {
return; return;
} }
previewItemClick = true; previewItemClick = true;
path = albumLive.data[index].path;
iosItem(path, context, (value) { iosItem(path, context, (value) {
var realPath = value["realImagePath"]; var realPath = value["realImagePath"];
Navigator.push( Navigator.push(
context, CustomRoute(AlbumPreviewPage(realPath, pageName))); context, CustomRoute(AlbumPreviewPage(realPath, pageName)));
}); });
} }
// Navigator.push(
// context, CustomRoute(AlbumPreviewPage(albumLive.data[index].path, pageName)));
}
} }
void iosItem(String path, BuildContext context, Function fun) { void iosItem(String path, BuildContext context, Function fun) {
...@@ -375,9 +378,9 @@ class AlbumModel { ...@@ -375,9 +378,9 @@ class AlbumModel {
if (value != null) { if (value != null) {
fun(Map<String, String>.from(value)); fun(Map<String, String>.from(value));
} }
previewItemClick=false; previewItemClick = false;
}).catchError((error) { }).catchError((error) {
previewItemClick=false; previewItemClick = false;
print(error); print(error);
}); });
} }
......
...@@ -4,6 +4,8 @@ ...@@ -4,6 +4,8 @@
#import "Image/AlbumItem.h" #import "Image/AlbumItem.h"
#import "ResultManager.h" #import "ResultManager.h"
#import <ImageIO/ImageIO.h> #import <ImageIO/ImageIO.h>
#import <AVKit/AVKit.h>
#import "MyPlayerViewController.h"
@interface GengmeiFlutterPlugin () <UIActionSheetDelegate,UIImagePickerControllerDelegate,UINavigationControllerDelegate,FlutterStreamHandler> //一定要声明这三个协议,缺一不可 @interface GengmeiFlutterPlugin () <UIActionSheetDelegate,UIImagePickerControllerDelegate,UINavigationControllerDelegate,FlutterStreamHandler> //一定要声明这三个协议,缺一不可
//@property(nonatomic)FlutterResult result; //@property(nonatomic)FlutterResult result;
...@@ -408,6 +410,28 @@ NSString *cacheDirectory; ...@@ -408,6 +410,28 @@ NSString *cacheDirectory;
}else{ }else{
[[ResultManager sharedSingleton] resultSuccess:[NSNumber numberWithLong:resultTemp] :nil]; [[ResultManager sharedSingleton] resultSuccess:[NSNumber numberWithLong:resultTemp] :nil];
} }
}else if([@"play_album_video" isEqualToString:call.method] ){
long resultTemp=self.resultKey;
NSString * path=call.arguments;
if([[self.scanMap allKeys] containsObject:path]){
PHAsset * assets=self.scanMap[path];
MyPlayerViewController* video=[[MyPlayerViewController alloc] init];
[viewController presentViewController:video animated:YES completion:nil];
// video.player= [[AVPlayeralloc]initWithURL:url];
[video playMovie:assets];
[[ResultManager sharedSingleton] resultSuccess:[NSNumber numberWithLong:resultTemp] :@YES];
// PHVideoRequestOptions *options = [[PHVideoRequestOptions alloc] init];
// options.version = PHImageRequestOptionsVersionCurrent;
// options.networkAccessAllowed = true;
// options.deliveryMode = PHVideoRequestOptionsDeliveryModeAutomatic;
// [[PHImageManager defaultManager]requestAVAssetForVideo:assets options:options resultHandler:^(AVAsset * _Nullable asset, AVAudioMix * _Nullable audioMix, NSDictionary * _Nullable info) {
// AVURLAsset *urlAsset = (AVURLAsset *)asset;
// AVPlayerViewController* video=[[AVPlayerViewController alloc] init];
// [viewController presentViewController:video animated:YES completion:nil];
// [video playMovie:urlAsset.URL];
// [[ResultManager sharedSingleton] resultSuccess:[NSNumber numberWithLong:resultTemp] :@YES];
// }];
}
}else{ }else{
result(FlutterMethodNotImplemented); result(FlutterMethodNotImplemented);
} }
......
//
// AVPlayerViewController.h
// Pods
//
// Created by Apple on 2019/11/1.
//
#ifndef AVPlayerViewController_h
#define AVPlayerViewController_h
#endif /* AVPlayerViewController_h */
#import <AssetsLibrary/AssetsLibrary.h>
#import <Photos/Photos.h>
@interface MyPlayerViewController : UIViewController
- (void)playMovie:(PHAsset*) assets;
@end
//
// AVPlayerViewController.m
// gengmei_flutter_plugin
//
// Created by Apple on 2019/11/1.
//
#import <Foundation/Foundation.h>
#import "MyPlayerViewController.h"
#import <AVFoundation/AVFoundation.h>
#import <AVKit/AVKit.h>
#import <AssetsLibrary/AssetsLibrary.h>
#import <Photos/Photos.h>
@interface MyPlayerViewController()
@property(nonatomic)dispatch_queue_t queue;;
@end
@implementation MyPlayerViewController
- (void)viewDidLoad {
[super viewDidLoad];
self.view.backgroundColor = [UIColor whiteColor];
self.queue = dispatch_queue_create("com.gengmei_flutter_plugin", DISPATCH_QUEUE_SERIAL);
// UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
// button.frame = CGRectMake(100, 100, 100, 100);
// [button setTitle:@"TICK" forState:UIControlStateNormal];
// button.backgroundColor = [UIColor brownColor];
// [button addTarget:self action:@selector(playMovie) forControlEvents:UIControlEventTouchUpInside];
// [self.view addSubview:button];
}
- (void)playMovie:(PHAsset*) assets{
dispatch_async(self.queue, ^{
PHVideoRequestOptions *options = [[PHVideoRequestOptions alloc] init];
// options.version = PHImageRequestOptionsVersionCurrent;
options.networkAccessAllowed = true;
// options.deliveryMode = PHVideoRequestOptionsDeliveryModeAutomatic;
[[PHImageManager defaultManager]requestAVAssetForVideo:assets options:options resultHandler:^(AVAsset * _Nullable asset, AVAudioMix * _Nullable audioMix, NSDictionary * _Nullable info) {
dispatch_async(dispatch_get_main_queue(), ^{
AVURLAsset *urlAsset = (AVURLAsset *)asset;
// AVPlayerViewController* video=[[AVPlayerViewController alloc] init];
// [viewController presentViewController:video animated:YES completion:nil];
// [video playMovie:urlAsset.URL];
AVPlayer *player = [AVPlayer playerWithURL:urlAsset.URL];
// 2.创建视频播放视图的控制器
AVPlayerViewController *playerVC = [[AVPlayerViewController alloc]init];
playerVC.player = player;
playerVC.entersFullScreenWhenPlaybackBegins = YES;
playerVC.exitsFullScreenWhenPlaybackEnds = YES;
playerVC.videoGravity = AVLayerVideoGravityResizeAspect;
playerVC.view.center = self.view.center;
playerVC.view.frame = self.view.bounds;
playerVC.showsPlaybackControls = YES;
playerVC.view.translatesAutoresizingMaskIntoConstraints = YES;
// 隐藏 控制控件
// playerVC.showsPlaybackControls = NO;
// [self presentViewController:playerVC animated:YES completion:nil];
// 自定义位置
// playerVC.view.frame = CGRectMake(200, 300, 300, 300);
[self.view addSubview:playerVC.view];
[self addChildViewController:playerVC];
// if (playerVC.readyForDisplay) {
[playerVC.player play];
// }
});
}];
});
// 1.AVPlayer
}
@end
...@@ -47,10 +47,13 @@ class ScanImagePlugn { ...@@ -47,10 +47,13 @@ class ScanImagePlugn {
return await channel.invokeMethod("IOS_IMAGE_BY_PATH", path); return await channel.invokeMethod("IOS_IMAGE_BY_PATH", path);
} }
static Future<Map> ios_album_item( static Future<Map> ios_album_item(MethodChannel channel, String path) async {
MethodChannel channel, String path) async {
return await channel.invokeMethod("IOS_IMAGE_ITEM", path); return await channel.invokeMethod("IOS_IMAGE_ITEM", path);
} }
static Future<bool> playAlbumVideo(MethodChannel channel, String path) async {
return await channel.invokeMethod("play_album_video", path);
}
} }
class ScanImageItem { class ScanImageItem {
......
...@@ -31,6 +31,10 @@ class GengmeiFlutterPlugin { ...@@ -31,6 +31,10 @@ class GengmeiFlutterPlugin {
return await ScanImagePlugn.ios_album_item(_channel, path); return await ScanImagePlugn.ios_album_item(_channel, path);
} }
static Future<bool> playAlbumVideo(String path) async {
return await ScanImagePlugn.playAlbumVideo(_channel, path);
}
static Future<bool> quitPage() async { static Future<bool> quitPage() async {
return await ScanImagePlugn.quitPage(_channel); return await ScanImagePlugn.quitPage(_channel);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment