565 lines
22 KiB
Objective-C
565 lines
22 KiB
Objective-C
//
|
||
// ShouYeView.m
|
||
// ProductApp
|
||
//
|
||
// Created by pgj on 2025/4/2.
|
||
//
|
||
|
||
#import "ShouYeView.h"
|
||
#import "ShouYeViewCollectionViewCell.h"
|
||
#import "UrlXiaZaiViewController.h"
|
||
#import "ZhiBoHuiFangViewController.h"
|
||
#import "ShiPingHaoViewController.h"
|
||
#import "ShiPingEditHomeViewController.h"
|
||
#import "WYCamaImageTools.h"
|
||
|
||
#import "ShiPingTiQuYinPingViewController.h"
|
||
#import "HuiYuanZXViewController.h"
|
||
#import "ShouYeBigCollectionViewCell.h"
|
||
|
||
#import "TZImagePickerController.h"
|
||
|
||
#import "XZM3SaveManager.h"
|
||
#import "ShiPingEditJGViewController.h"
|
||
|
||
#import "TongZhiTSView.h"
|
||
|
||
#import "ZhiNengShiPingViewController.h"
|
||
|
||
@interface ShouYeView ()<UICollectionViewDelegate,UICollectionViewDataSource,SDCycleScrollViewDelegate,WYCamaImageToolsDelegate>
|
||
///
|
||
@property (nonatomic , strong) NSMutableArray *arrTop;
|
||
///
|
||
@property (nonatomic , strong) TongZhiTSView *viewtz;
|
||
///
|
||
@property (nonatomic , strong) UIView *viewsh;
|
||
///
|
||
@property (nonatomic , strong) UICollectionView *collect;
|
||
///
|
||
@property (nonatomic , strong) NSMutableArray *arrdata;
|
||
|
||
//轮播
|
||
@property (nonatomic, strong) SDCycleScrollView *cleScrollView;
|
||
|
||
@property (nonatomic, strong) WYCamaImageTools *tools;
|
||
|
||
@property (nonatomic , assign) int typefunction;
|
||
|
||
@end
|
||
|
||
@implementation ShouYeView
|
||
|
||
-(id)initWithFrame:(CGRect)frame
|
||
{
|
||
if(self = [super initWithFrame:frame])
|
||
{
|
||
UIScrollView *scvback = [[UIScrollView alloc] init];
|
||
[self addSubview:scvback];
|
||
[scvback mas_makeConstraints:^(MASConstraintMaker *make) {
|
||
make.left.top.offset(0);
|
||
make.width.height.equalTo(self);
|
||
}];
|
||
if (@available(iOS 11.0, *)) {
|
||
scvback.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
|
||
}else{
|
||
self.viewController.automaticallyAdjustsScrollViewInsets =NO;
|
||
}
|
||
|
||
TongZhiTSView *viewtz = [[TongZhiTSView alloc] init];
|
||
[viewtz setBackgroundColor:RGBCOLOR(255, 234, 234)];
|
||
[scvback addSubview:viewtz];
|
||
[viewtz mas_makeConstraints:^(MASConstraintMaker *make) {
|
||
make.left.width.equalTo(scvback);
|
||
make.top.offset(KMagrinTop+5);
|
||
make.height.offset(30);
|
||
}];
|
||
_viewtz = viewtz;
|
||
// viewtz.arrdata = @[@"视频号出现故障,预计2天后完善,请耐心等待",@"视频号出现故障,预计2天后完善,请耐心等待1",@"视频号出现故障,预计2天后完善,请耐心等待2"];
|
||
[viewtz setHidden:YES];
|
||
|
||
self.arrTop = [NSMutableArray new];
|
||
float f_w = (UISCREEN_WIDTH-44)/3.0;
|
||
NSArray *arr = @[@"链接提取",@"视频号",@"直播回放"];
|
||
NSArray *arrinfo = @[@"涵盖大多数平台",@"支持微信视频号",@"支持微信直播回放"];
|
||
UIView *viewlast = nil;
|
||
for(int i = 0 ; i < arr.count; i++)
|
||
{
|
||
UIImage *image = [UIImage imageNamed:[NSString stringWithFormat:@"sy_%@",arr[i]]];
|
||
UIImageView *imgvitem = [[UIImageView alloc] init];
|
||
[imgvitem setImage:image];
|
||
[scvback addSubview:imgvitem];
|
||
[imgvitem mas_makeConstraints:^(MASConstraintMaker *make) {
|
||
make.top.offset(NavHeight);
|
||
make.left.offset(12+(f_w+10)*i);
|
||
make.width.offset(f_w);
|
||
make.height.offset(f_w*image.size.height/image.size.width);
|
||
}];
|
||
[imgvitem setHidden:YES];
|
||
[imgvitem setUserInteractionEnabled:YES];
|
||
viewlast = imgvitem;
|
||
[self.arrTop addObject:imgvitem];
|
||
|
||
UILabel *lbinfo = [[UILabel alloc] init];
|
||
[lbinfo setText:arrinfo[i]];
|
||
[lbinfo setTextColor:RGBACOLOR(20, 20, 20, 0.6)];
|
||
[lbinfo setTextAlignment:NSTextAlignmentCenter];
|
||
[lbinfo setFont:[UIFont systemFontOfSize:12]];
|
||
[imgvitem addSubview:lbinfo];
|
||
[lbinfo mas_makeConstraints:^(MASConstraintMaker *make) {
|
||
make.left.right.equalTo(imgvitem);
|
||
make.bottom.equalTo(imgvitem).offset(-12);
|
||
}];
|
||
|
||
UILabel *lbtitle = [[UILabel alloc] init];
|
||
[lbtitle setText:arr[i]];
|
||
[lbtitle setTextColor:RGBCOLOR(20, 20, 20)];
|
||
[lbtitle setTextAlignment:NSTextAlignmentCenter];
|
||
[lbtitle setFont:[UIFont fontWithName:@"AlimamaShuHeiTi-Bold" size:16]];
|
||
[imgvitem addSubview:lbtitle];
|
||
[lbtitle mas_makeConstraints:^(MASConstraintMaker *make) {
|
||
make.left.right.equalTo(imgvitem);
|
||
make.bottom.equalTo(lbinfo.mas_top).offset(-4);
|
||
}];
|
||
|
||
UIButton *btitem = [[UIButton alloc] init];
|
||
[imgvitem addSubview:btitem];
|
||
[btitem mas_makeConstraints:^(MASConstraintMaker *make) {
|
||
make.edges.equalTo(imgvitem);
|
||
}];
|
||
[btitem setTag:i];
|
||
[btitem addTarget:self action:@selector(spAction:) forControlEvents:UIControlEventTouchUpInside];
|
||
}
|
||
|
||
UIView *viewsh = [[UIView alloc] init];
|
||
[viewsh setBackgroundColor:RGBCOLOR(20, 20, 20)];
|
||
[scvback addSubview:viewsh];
|
||
[viewsh mas_makeConstraints:^(MASConstraintMaker *make) {
|
||
make.top.offset(0);
|
||
make.left.offset(0);
|
||
make.width.offset(UISCREEN_WIDTH);
|
||
make.bottom.equalTo(viewlast.mas_bottom).offset(20);
|
||
}];
|
||
_viewsh = viewsh;
|
||
|
||
UIImageView *imgvlog = [[UIImageView alloc] init];
|
||
[imgvlog setImage:[UIImage imageNamed:@"logicon"]];
|
||
[viewsh addSubview:imgvlog];
|
||
[imgvlog mas_makeConstraints:^(MASConstraintMaker *make) {
|
||
make.width.height.offset(80);
|
||
make.centerX.equalTo(viewsh);
|
||
make.top.offset(KMagrinTop+10);
|
||
}];
|
||
[imgvlog.layer setMasksToBounds:YES];
|
||
[imgvlog.layer setCornerRadius:6];
|
||
|
||
UILabel *lbname = [[UILabel alloc] init];
|
||
[lbname setText:@"极光视频"];
|
||
[lbname setTextColor:[UIColor whiteColor]];
|
||
[lbname setTextAlignment:NSTextAlignmentCenter];
|
||
[lbname setFont:[UIFont fontWithName:@"AlimamaShuHeiTi-Bold" size:36]];
|
||
[viewsh addSubview:lbname];
|
||
[lbname mas_makeConstraints:^(MASConstraintMaker *make) {
|
||
make.top.equalTo(imgvlog.mas_bottom);
|
||
make.centerX.equalTo(viewsh);
|
||
}];
|
||
|
||
[scvback bringSubviewToFront:self.viewtz];
|
||
|
||
UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init];
|
||
layout.minimumLineSpacing = 0;
|
||
layout.minimumInteritemSpacing = 0;
|
||
UICollectionView *collect = [[UICollectionView alloc] initWithFrame:CGRectZero collectionViewLayout:layout];
|
||
[collect setScrollEnabled:NO];
|
||
[collect setDelegate:self];
|
||
[collect setDataSource:self];
|
||
[collect setBackgroundColor:[UIColor clearColor]];
|
||
[scvback addSubview:collect];
|
||
[collect mas_makeConstraints:^(MASConstraintMaker *make) {
|
||
make.left.offset(12);
|
||
make.width.equalTo(scvback).offset(-24);
|
||
make.top.equalTo(viewlast.mas_bottom).offset(20);
|
||
make.height.offset(70*4+40+140);
|
||
}];
|
||
[collect registerClass:[ShouYeViewCollectionViewCell class] forCellWithReuseIdentifier:@"ShouYeViewCollectionViewCell"];
|
||
[collect registerClass:[ShouYeBigCollectionViewCell class] forCellWithReuseIdentifier:@"ShouYeBigCollectionViewCell"];
|
||
|
||
_collect = collect;
|
||
|
||
[self getdata];
|
||
|
||
|
||
SDCycleScrollView *cleScrollView = [SDCycleScrollView cycleScrollViewWithFrame:CGRectZero imageNamesGroup:@[]];
|
||
cleScrollView.scrollDirection = UICollectionViewScrollDirectionHorizontal;
|
||
cleScrollView.delegate = self;
|
||
cleScrollView.backgroundColor = [UIColor clearColor];
|
||
cleScrollView.titleLabelBackgroundColor = [UIColor clearColor];
|
||
cleScrollView.titleLabelTextColor = [UIColor darkGrayColor];
|
||
cleScrollView.titleLabelTextFont = [UIFont systemFontOfSize:[Tools sizeFont:14]];
|
||
cleScrollView.autoScrollTimeInterval = 3.0;
|
||
cleScrollView.bannerImageViewContentMode = UIViewContentModeScaleAspectFill;
|
||
[cleScrollView setShowPageControl:NO];
|
||
[scvback addSubview:cleScrollView];
|
||
[cleScrollView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||
make.left.width.equalTo(collect);
|
||
make.top.equalTo(collect.mas_bottom).offset(20);
|
||
make.height.offset(100*(UISCREEN_WIDTH-24)/351.0);
|
||
}];
|
||
[cleScrollView.layer setMasksToBounds:YES];
|
||
[cleScrollView.layer setCornerRadius:10];
|
||
_cleScrollView = cleScrollView;
|
||
[scvback mas_makeConstraints:^(MASConstraintMaker *make) {
|
||
make.bottom.equalTo(cleScrollView).offset(20);
|
||
}];
|
||
[self refShowBanner];
|
||
}
|
||
return self;
|
||
}
|
||
-(void)refShowBanner
|
||
{
|
||
NSArray *arrbanner = [[UserDetailModel shareModel].config objectForKey:@"client.banner.urls"];
|
||
|
||
NSMutableArray *arrurl = [NSMutableArray new];
|
||
if([arrbanner isKindOfClass:[NSArray class]])
|
||
{
|
||
for(NSDictionary *dic in arrbanner)
|
||
{
|
||
if([[dic objectForKey:@"page"] isEqualToString:@"Cash_Task"])
|
||
{
|
||
if([UserDetailModel zhiFuState]==YES && [[[[UserDetailModel shareModel] config] objectForKey:@"client.cashtask.enable"] intValue] == 1)
|
||
{
|
||
[arrurl addObject:[Tools isStringnil:[dic objectForKey:@"image"]]];
|
||
}
|
||
}
|
||
else if([[dic objectForKey:@"page"] containsString:@"recharge"])
|
||
{
|
||
NSString *str = [[UserDetailModel shareModel].config objectForKey:@"client.pay.enable"];
|
||
if([str intValue] != 0 && [UserDetailModel shareModel].vip.intValue != 3)
|
||
{
|
||
[arrurl addObject:[Tools isStringnil:[dic objectForKey:@"image"]]];
|
||
}
|
||
}
|
||
else if([[dic objectForKey:@"page"] isEqualToString:@"check_Task"])
|
||
{
|
||
// [arrurl addObject:[Tools isStringnil:[dic objectForKey:@"image"]]];
|
||
}
|
||
else
|
||
{
|
||
[arrurl addObject:[Tools isStringnil:[dic objectForKey:@"image"]]];
|
||
}
|
||
}
|
||
}
|
||
self.cleScrollView.imageURLStringsGroup = arrurl;
|
||
|
||
}
|
||
-(void)refShowData
|
||
{
|
||
if([UserDetailModel zhiFuState])
|
||
{
|
||
[self.viewsh setHidden:YES];
|
||
for(UIView *view in self.arrTop)
|
||
{
|
||
[view setHidden:NO];
|
||
}
|
||
}
|
||
}
|
||
-(void)showTSData:(NSArray *)arr
|
||
{
|
||
[self.viewtz setHidden:YES];
|
||
if([arr isKindOfClass:[NSArray class]])
|
||
{
|
||
if(arr.count>0)
|
||
{
|
||
[self.viewtz setHidden:NO];
|
||
self.viewtz.arrdata = arr;
|
||
}
|
||
}
|
||
}
|
||
-(void)getdata
|
||
{
|
||
self.arrdata = [NSMutableArray new];
|
||
|
||
NSArray *arr = @[@"智能视频",@"视频时长剪切",@"视频加水印",@"加背景音乐",@"视频裁剪",@"视频转音频",@"去背景音乐",@"视频倒放",@"视频拼接"];
|
||
NSArray *arrinfo = @[@"素材一键生成视频",@"轻松裁剪多余部分",@"快捷留下专属标记",@"赋予不同的声音",@"留下一切美好瞬间",@"提取视频中的音频",@"无声世界更有意境",@"趣味视频生成",@"一键拼接视频"];
|
||
///视频去除音频 视频时长剪切
|
||
for(int i = 0 ; i < arr.count; i++)
|
||
{
|
||
baseInfoModel *model = [baseInfoModel new];
|
||
model.title = arr[i];
|
||
model.info = arrinfo[i];
|
||
[self.arrdata addObject:model];
|
||
}
|
||
|
||
}
|
||
-(void)spAction:(UIButton *)sender
|
||
{
|
||
switch (sender.tag) {
|
||
case 0:
|
||
{
|
||
UrlXiaZaiViewController *vc = [UrlXiaZaiViewController new];
|
||
[self.viewController.navigationController pushViewController:vc animated:YES];
|
||
}
|
||
break;
|
||
case 1:
|
||
{
|
||
ShiPingHaoViewController *vc = [ShiPingHaoViewController new];
|
||
[self.viewController.navigationController pushViewController:vc animated:YES];
|
||
}
|
||
break;
|
||
case 2:
|
||
{
|
||
ZhiBoHuiFangViewController *vc = [ZhiBoHuiFangViewController new];
|
||
[self.viewController.navigationController pushViewController:vc animated:YES];
|
||
}
|
||
break;
|
||
default:
|
||
break;
|
||
}
|
||
}
|
||
|
||
#pragma mark - SDCycleScrollViewDelegate
|
||
/** 图片滚动回调 */
|
||
- (void)cycleScrollView:(SDCycleScrollView *)cycleScrollView didScrollToIndex:(NSInteger)index
|
||
{
|
||
|
||
}
|
||
/** 点击图片回调 */
|
||
- (void)cycleScrollView:(SDCycleScrollView *)cycleScrollView didSelectItemAtIndex:(NSInteger)index
|
||
{
|
||
NSArray *arrbanner = [[UserDetailModel shareModel].config objectForKey:@"client.banner.urls"];
|
||
NSDictionary *dic = arrbanner[index];
|
||
if([[dic objectForKey:@"page"] containsString:@"recharge"])
|
||
{
|
||
NSString *str = [[UserDetailModel shareModel].config objectForKey:@"client.pay.enable"];
|
||
if([str intValue] == 0 || [UserDetailModel shareModel].vip.intValue == 3)
|
||
{
|
||
return;
|
||
}
|
||
if([UserDetailModel pushDengLuVC:self.viewController ispush:YES]==NO)return;;
|
||
HuiYuanZXViewController *vc = [[HuiYuanZXViewController alloc] init];
|
||
vc.source = @"banner";
|
||
[self.viewController.navigationController pushViewController:vc animated:YES];
|
||
[UserDetailModel pushActionInfo:0 key:@"client.jump.to.member.recharge" value:@"banner" extra:@""];
|
||
}
|
||
}
|
||
#pragma mark - UICollectionView
|
||
- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section
|
||
{
|
||
return self.arrdata.count;
|
||
}
|
||
- (__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
|
||
{
|
||
if(indexPath.row==0)
|
||
{
|
||
ShouYeBigCollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"ShouYeBigCollectionViewCell" forIndexPath:indexPath];
|
||
cell.model = self.arrdata[indexPath.row];
|
||
return cell;
|
||
}
|
||
else
|
||
{
|
||
ShouYeViewCollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"ShouYeViewCollectionViewCell" forIndexPath:indexPath];
|
||
cell.model = self.arrdata[indexPath.row];
|
||
return cell;
|
||
}
|
||
}
|
||
//定义每个section的间距
|
||
- (UIEdgeInsets)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout insetForSectionAtIndex:(NSInteger)section{
|
||
|
||
return UIEdgeInsetsMake(0, 0, 0, 0);
|
||
}
|
||
//纵向cell间距
|
||
- (CGFloat)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout minimumLineSpacingForSectionAtIndex:(NSInteger)section{
|
||
return 10;
|
||
}
|
||
//cell 间距
|
||
- (CGFloat)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout ForSectionAtIndex:(NSInteger)section{
|
||
return 10;
|
||
}
|
||
// 定义每个UICollectionViewCell 的大小
|
||
- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath
|
||
{
|
||
if(indexPath.row==0)
|
||
{
|
||
return CGSizeMake(UISCREEN_WIDTH-24, 130);
|
||
}
|
||
else
|
||
{
|
||
return CGSizeMake((UISCREEN_WIDTH-34)/2.0, 70);
|
||
}
|
||
}
|
||
-(void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath
|
||
{
|
||
///[@"视频加水印",@"MD5去重",@"视频裁剪",@"视频转音频",@"去背景音乐",@"视频时长剪切" @"视频倒放",@"视频拼接" 1开始
|
||
baseInfoModel *model = self.arrdata[indexPath.row];
|
||
[UserDetailModel pushActionInfo:0 key:@"click.go.to.vc" value:model.title extra:@""];
|
||
if([model.title isEqualToString:@"视频转音频"])
|
||
{
|
||
ShiPingTiQuYinPingViewController *vc = [ShiPingTiQuYinPingViewController new];
|
||
[self.viewController.navigationController pushViewController:vc animated:YES];
|
||
}
|
||
else if([model.title isEqualToString:@"智能视频"])
|
||
{
|
||
ZhiNengShiPingViewController *vc = [ZhiNengShiPingViewController new];
|
||
[self.viewController.navigationController pushViewController:vc animated:YES];
|
||
}
|
||
else if([model.title isEqualToString:@"视频拼接"])
|
||
{
|
||
[self pinJieVideoSelect];
|
||
}
|
||
else
|
||
{
|
||
self.typefunction = [self getFunctionTag:model.title];
|
||
self.tools.isvideo = YES;
|
||
[self.tools choosePicWithViewController:self.viewController chooseType:ChooseTypeAlbum];
|
||
}
|
||
}
|
||
|
||
-(void)pinJieVideoSelect
|
||
{
|
||
TZImagePickerController *imagePickerVc = [[TZImagePickerController alloc] initWithMaxImagesCount:4 columnNumber:4 delegate:nil pushPhotoPickerVc:YES];
|
||
imagePickerVc.isSelectOriginalPhoto = NO;
|
||
imagePickerVc.allowTakePicture = YES; // 在内部显示拍照按钮
|
||
imagePickerVc.navigationBar.barTintColor = [UIColor blackColor];
|
||
imagePickerVc.minImagesCount = 2;
|
||
imagePickerVc.maxImagesCount = 4;
|
||
imagePickerVc.oKButtonTitleColorDisabled = [UIColor lightGrayColor];
|
||
imagePickerVc.oKButtonTitleColorNormal = [UIColor greenColor];
|
||
imagePickerVc.navigationBar.translucent = NO;
|
||
// 3. 设置是否可以选择视频/图片/原图
|
||
imagePickerVc.allowPickingVideo = YES;
|
||
imagePickerVc.presetName=AVAssetExportPresetHighestQuality;
|
||
imagePickerVc.allowPickingImage = NO;
|
||
|
||
imagePickerVc.allowPickingMultipleVideo = YES;
|
||
imagePickerVc.maxCropVideoDuration = 600;
|
||
|
||
imagePickerVc.allowPickingOriginalPhoto = NO;
|
||
// 4. 照片排列按修改时间升序
|
||
imagePickerVc.sortAscendingByModificationDate = NO;
|
||
// 你可以通过block或者代理,来得到用户选择的照片.
|
||
[imagePickerVc setDidFinishPickingPhotosHandle:^(NSArray<UIImage *> *photos, NSArray *assets, BOOL isSelectOriginalPhoto) {
|
||
if(assets.count>1)
|
||
{
|
||
[KCSPHUDAlterView showView];
|
||
NSMutableArray *arrtemp = [NSMutableArray new];
|
||
__block int icc = 0;
|
||
for(PHAsset *aset in assets)
|
||
{
|
||
|
||
[self getVideoUrl:aset back:^(NSURL *url) {
|
||
icc+=1;
|
||
if(url)
|
||
{
|
||
[arrtemp addObject:url];
|
||
}
|
||
if(icc == assets.count)
|
||
{
|
||
if(arrtemp.count!=icc)
|
||
{
|
||
[KCSPHUDAlterView dismis];
|
||
[HXHud showMessage:@"视频合并失败,请重新选择视频" afterDelayType:0];
|
||
return;
|
||
}
|
||
NSString *outputPath = [Tools audioRecordingPath:[NSString stringWithFormat:@"%@.mp4",[Tools getCurrentTime:@"yyyyMMddHHmmss"]]];
|
||
[[XZM3SaveManager shareManager] MergeToValue:arrtemp outUrl:[NSURL fileURLWithPath:outputPath] back:^(NSURL * _Nonnull backurl) {
|
||
dispatch_async(dispatch_get_main_queue(), ^{
|
||
[KCSPHUDAlterView dismis];
|
||
if(backurl)
|
||
{
|
||
ShiPingEditJGViewController *vc = [[ShiPingEditJGViewController alloc] init];
|
||
vc.urlvideo = backurl;
|
||
[self.viewController.navigationController pushViewController:vc animated:NO];
|
||
}
|
||
else
|
||
{
|
||
[HXHud showMessage:@"视频合并失败,请重新选择视频" afterDelayType:0];
|
||
}
|
||
});
|
||
} progess:^(float progress) {
|
||
|
||
}];
|
||
}
|
||
}];
|
||
}
|
||
}
|
||
|
||
}];
|
||
[self.viewController presentViewController:imagePickerVc animated:YES completion:^{
|
||
|
||
}];
|
||
}
|
||
///获取相册视频地址
|
||
-(void)getVideoUrl:(PHAsset *)phAsset back:(void(^)(NSURL *url))backValue
|
||
{
|
||
PHVideoRequestOptions *options = [[PHVideoRequestOptions alloc] init];
|
||
options.version = PHVideoRequestOptionsVersionCurrent;
|
||
options.deliveryMode = PHVideoRequestOptionsDeliveryModeAutomatic;
|
||
options.networkAccessAllowed = true;
|
||
|
||
PHImageManager *manager = [PHImageManager defaultManager];
|
||
[manager requestAVAssetForVideo:phAsset options:options resultHandler:^(AVAsset * _Nullable asset, AVAudioMix * _Nullable audioMix, NSDictionary * _Nullable info) {
|
||
AVURLAsset *urlAsset = (AVURLAsset *)asset;
|
||
NSURL *url = urlAsset.URL;
|
||
backValue(url);
|
||
}];
|
||
|
||
}
|
||
|
||
-(int)getFunctionTag:(NSString *)name
|
||
{
|
||
///1水印 2MD5 3裁剪 5去背景
|
||
int back = 1;
|
||
if([name isEqualToString:@"视频加水印"])
|
||
{
|
||
back = 1;
|
||
}
|
||
else if([name isEqualToString:@"MD5去重"])
|
||
{
|
||
back = 2;
|
||
}
|
||
else if([name isEqualToString:@"视频裁剪"])
|
||
{
|
||
back = 3;
|
||
}
|
||
else if([name isEqualToString:@"去背景音乐"])
|
||
{
|
||
back = 5;
|
||
}
|
||
else if([name isEqualToString:@"视频时长剪切"])
|
||
{
|
||
back = 6;
|
||
}
|
||
else if([name isEqualToString:@"加背景音乐"])
|
||
{
|
||
back = 7;
|
||
}
|
||
else if([name isEqualToString:@"视频倒放"])
|
||
{
|
||
back = 8;
|
||
}
|
||
else if([name isEqualToString:@"视频拼接"])
|
||
{
|
||
back = 9;
|
||
}
|
||
else if([name isEqualToString:@"智能视频"])
|
||
{
|
||
back = 10;
|
||
}
|
||
return back;
|
||
}
|
||
|
||
- (void)didEndChooseVideo:(NSURL *)videourl
|
||
{
|
||
ShiPingEditHomeViewController *vc = [ShiPingEditHomeViewController new];
|
||
vc.urlvideo = videourl;
|
||
vc.type = self.typefunction;
|
||
[self.viewController.navigationController pushViewController:vc animated:YES];
|
||
}
|
||
|
||
- (WYCamaImageTools *)tools {
|
||
if (!_tools) {
|
||
_tools = [[WYCamaImageTools alloc] init];
|
||
_tools.delegate = self;
|
||
}return _tools;
|
||
}
|
||
@end
|