获取相册里所选视频对应的nsurl

协议:<UINavigationControllerDelegate,UIImagePickerControllerDelegate>

-(IBAction)fbShareVideo:(id)sender{

    

    UIImagePickerController * pick = [[UIImagePickerController alloc] init];
    pick.delegate = self;
    pick.sourceType  = UIImagePickerControllerSourceTypePhotoLibrary;
    pick.mediaTypes = [UIImagePickerController availableMediaTypesForSourceType:UIImagePickerControllerSourceTypePhotoLibrary];//设置媒体种类
    [self presentViewController:pick animated:YES completion:nil];
  NSLog(@"zoulama,class-%@-->%@",self,self.picker);

}

//----方法1

//成功获得相片还是视频后的回调
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info{
    

    __weak typeof(self) weakSelf = self;
    NSURL *videoURL = [info objectForKey:UIImagePickerControllerReferenceURL];
    NSLog(@"kong d:-->%@",videoURL);


    [[Platform defaultPlatform] fbShareVideoUrl:videoURL completion:^(NSDictionary *resultData, NSError *error, BOOL isCancle) {
        NSLog(@"sdk fbShare completed share:%@\n error:%@,iscancle:%zd", resultData,error,isCancle);
        [self performSelector:@selector(closeThePick:) withObject:picker afterDelay:0 inModes:[NSArray arrayWithObjects:NSDefaultRunLoopMode, nil]];

    }];

}

- (void)closeThePick:(UIImagePickerController *)picker{
    NSLog(@"=---------");
    NSLog(@"2zoulama,class-%@-->%@",self,self.picker);
    [picker dismissViewControllerAnimated:YES completion:nil];
}
- (void)fbShare:(NSURL *)videoURL{
    [[Platform defaultPlatform] fbShareVideoUrl:videoURL completion:^(NSDictionary *resultData, NSError *error, BOOL isCancle) {
        NSLog(@"sdk fbShare completed share:%@\n error:%@,iscancle:%zd", resultData,error,isCancle);
        //    [weakSelf closeThePick];
    }];

}

//方法2

//成功获得相片还是视频后的回调
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info{
 

    NSURL *videoURL = [info objectForKey:UIImagePickerControllerReferenceURL];

    NSLog(@"kong d:-->%@",videoURL);
    [picker dismissViewControllerAnimated:YES completion:^{

    [self performSelector:@selector(fbShare:) withObject:videoURL afterDelay:0 inModes:[NSArray arrayWithObjects:NSDefaultRunLoopMode, nil]];

    }];


}
- (void)fbShare:(NSURL *)videoURL{
    [[Platform defaultPlatform] fbShareVideoUrl:videoURL completion:^(NSDictionary *resultData, NSError *error, BOOL isCancle) {
        NSLog(@"sdk fbShare completed share:%@\n error:%@,iscancle:%zd", resultData,error,isCancle);
    }];
    
}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值