修复:
1.让图片转码能够成功的获取到文件名称,在相关联页面传递phasset资源; 2.修改图片、视频转码页面的视图背景颜色为clear
This commit is contained in:
parent
b5ebe769f1
commit
ed3bb0f1d8
@ -311,11 +311,12 @@ class CCHomeController: BaseController, LLCycleScrollViewDelegate {
|
|||||||
view.show()
|
view.show()
|
||||||
|
|
||||||
//选择图片
|
//选择图片
|
||||||
view.selectedImageHandler = { [self] data in
|
view.selectedImageHandler = { [self] data,asset in
|
||||||
print("回调")
|
print("回调")
|
||||||
|
|
||||||
let vc = CCSpatialPhotoDisplayController()
|
let vc = CCSpatialPhotoDisplayController()
|
||||||
vc.photoOriginalData = data
|
vc.photoOriginalData = data
|
||||||
|
vc.imageAsset = asset
|
||||||
self.navigationController?.pushViewController(vc, animated: true)
|
self.navigationController?.pushViewController(vc, animated: true)
|
||||||
}
|
}
|
||||||
//选择视频
|
//选择视频
|
||||||
@ -408,8 +409,8 @@ extension CCHomeController: TZImagePickerControllerDelegate,UINavigationControll
|
|||||||
|
|
||||||
|
|
||||||
//选择图片
|
//选择图片
|
||||||
spaceAlbumPopView.selectedImageHandler = { [self] data in
|
spaceAlbumPopView.selectedImageHandler = { [self] data,asset in
|
||||||
gotoPhotoTransformVC(data: data, url: nil)
|
gotoPhotoTransformVC(data: data, url: nil,asset: asset)
|
||||||
}
|
}
|
||||||
//选择视频
|
//选择视频
|
||||||
spaceAlbumPopView.selectedVideoHandler = { [self] url in
|
spaceAlbumPopView.selectedVideoHandler = { [self] url in
|
||||||
@ -419,10 +420,11 @@ extension CCHomeController: TZImagePickerControllerDelegate,UINavigationControll
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
func gotoPhotoTransformVC(data:Data?,url:URL?) {
|
func gotoPhotoTransformVC(data:Data?,url:URL?,asset:PHAsset?) {
|
||||||
let vc = VRPhotoTransformController()
|
let vc = VRPhotoTransformController()
|
||||||
vc.sourceImageData = data
|
vc.sourceImageData = data
|
||||||
vc.sourceImageURL = url
|
vc.sourceImageURL = url
|
||||||
|
vc.imageAsset = asset
|
||||||
self.navigationController?.pushViewController(vc, animated: true)
|
self.navigationController?.pushViewController(vc, animated: true)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -484,7 +486,7 @@ extension CCHomeController: TZImagePickerControllerDelegate,UINavigationControll
|
|||||||
print("选择图片 Selected iamge URL: \(String(describing: imageUrl))")
|
print("选择图片 Selected iamge URL: \(String(describing: imageUrl))")
|
||||||
//PHAsset
|
//PHAsset
|
||||||
// let phAsset : PHAsset = info[UIImagePickerController.InfoKey.phAsset] as! PHAsset
|
// let phAsset : PHAsset = info[UIImagePickerController.InfoKey.phAsset] as! PHAsset
|
||||||
gotoPhotoTransformVC(data: nil, url: imageUrl)
|
gotoPhotoTransformVC(data: nil, url: imageUrl,asset: info[.phAsset] as? PHAsset)
|
||||||
|
|
||||||
break
|
break
|
||||||
case "public.movie":
|
case "public.movie":
|
||||||
|
|||||||
@ -30,7 +30,7 @@ class CCSpatialPhotoDisplayController: BaseController {
|
|||||||
//图片源数据
|
//图片源数据
|
||||||
var photoOriginalURL:URL?
|
var photoOriginalURL:URL?
|
||||||
var photoOriginalData:Data?
|
var photoOriginalData:Data?
|
||||||
|
var imageAsset:PHAsset?
|
||||||
|
|
||||||
var imgData:Data?
|
var imgData:Data?
|
||||||
//空间视频 交叉眼 红蓝立体 高斯模糊
|
//空间视频 交叉眼 红蓝立体 高斯模糊
|
||||||
@ -199,6 +199,7 @@ class CCSpatialPhotoDisplayController: BaseController {
|
|||||||
//右边按钮
|
//右边按钮
|
||||||
let transVC = VRPhotoTransformController()
|
let transVC = VRPhotoTransformController()
|
||||||
transVC.sourceImageData = photoOriginalData
|
transVC.sourceImageData = photoOriginalData
|
||||||
|
transVC.imageAsset = imageAsset
|
||||||
self.navigationController?.pushViewController(transVC, animated: true)
|
self.navigationController?.pushViewController(transVC, animated: true)
|
||||||
}else if sender.tag == 202 {
|
}else if sender.tag == 202 {
|
||||||
//中间按钮
|
//中间按钮
|
||||||
|
|||||||
@ -519,11 +519,13 @@ class CCSpatialShootController: BaseController {
|
|||||||
spaceAlbumPopView.show()
|
spaceAlbumPopView.show()
|
||||||
|
|
||||||
//选择图片
|
//选择图片
|
||||||
spaceAlbumPopView.selectedImageHandler = { [self] data in
|
spaceAlbumPopView.selectedImageHandler = { [self] data,asset in
|
||||||
print("回调")
|
print("回调")
|
||||||
|
|
||||||
let vc = CCSpatialPhotoDisplayController()
|
let vc = CCSpatialPhotoDisplayController()
|
||||||
vc.photoOriginalData = data
|
vc.photoOriginalData = data
|
||||||
|
vc.imageAsset = asset
|
||||||
|
|
||||||
self.navigationController?.pushViewController(vc, animated: true)
|
self.navigationController?.pushViewController(vc, animated: true)
|
||||||
}
|
}
|
||||||
//选择视频
|
//选择视频
|
||||||
|
|||||||
@ -8,13 +8,13 @@
|
|||||||
import UIKit
|
import UIKit
|
||||||
import DeviceKit
|
import DeviceKit
|
||||||
import SVProgressHUD
|
import SVProgressHUD
|
||||||
|
import Photos
|
||||||
class VRPhotoTransformController: BaseController {
|
class VRPhotoTransformController: BaseController {
|
||||||
|
|
||||||
// var heroAsset1:AVAsset?
|
// var heroAsset1:AVAsset?
|
||||||
|
|
||||||
var sourceImageData:Data?
|
var sourceImageData:Data?
|
||||||
|
var imageAsset:PHAsset?
|
||||||
|
|
||||||
var sourceImageURL:URL?
|
var sourceImageURL:URL?
|
||||||
var outputImageURL:URL?
|
var outputImageURL:URL?
|
||||||
@ -54,11 +54,11 @@ class VRPhotoTransformController: BaseController {
|
|||||||
mImgView = UIImageView()
|
mImgView = UIImageView()
|
||||||
mImgView?.frame = CGRect(x: 24, y: Int(SafeAreaTop_Height) + 24, width: Int(SCREEN_Width) - 48, height: (Int(SCREEN_Width) - 48) * 200/345)
|
mImgView?.frame = CGRect(x: 24, y: Int(SafeAreaTop_Height) + 24, width: Int(SCREEN_Width) - 48, height: (Int(SCREEN_Width) - 48) * 200/345)
|
||||||
self.view.addSubview(mImgView!)
|
self.view.addSubview(mImgView!)
|
||||||
mImgView?.backgroundColor = UIColor.hexStringToColor(hexString: "#666666")
|
// mImgView?.backgroundColor = UIColor.hexStringToColor(hexString: "#666666")
|
||||||
mImgView!.clipsToBounds = true
|
mImgView!.clipsToBounds = true
|
||||||
mImgView!.layer.cornerRadius = 8
|
mImgView!.layer.cornerRadius = 8
|
||||||
|
mImgView!.contentMode = .scaleAspectFit
|
||||||
|
mImgView!.backgroundColor = UIColor.clear
|
||||||
outputImageURL = URL.documentsDirectory.appending(path:"output11114.jpg")
|
outputImageURL = URL.documentsDirectory.appending(path:"output11114.jpg")
|
||||||
|
|
||||||
if (sourceImageURL != nil) {
|
if (sourceImageURL != nil) {
|
||||||
@ -92,7 +92,15 @@ class VRPhotoTransformController: BaseController {
|
|||||||
let imgSize:Int = sourceImageData?.count ?? 0
|
let imgSize:Int = sourceImageData?.count ?? 0
|
||||||
// size 表示数据的大小,单位为字节
|
// size 表示数据的大小,单位为字节
|
||||||
let imgMbSize = Double(imgSize) / 1024 / 1024
|
let imgMbSize = Double(imgSize) / 1024 / 1024
|
||||||
let imgTitle = sourceImageURL?.pathComponents.last ?? "xx"
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
mBottomBtn = UIButton.init(type: UIButton.ButtonType.custom)
|
mBottomBtn = UIButton.init(type: UIButton.ButtonType.custom)
|
||||||
self.view.addSubview(mBottomBtn!)
|
self.view.addSubview(mBottomBtn!)
|
||||||
mBottomBtn!.backgroundColor = UIColor.hexStringToColor(hexString: "#5326D6")
|
mBottomBtn!.backgroundColor = UIColor.hexStringToColor(hexString: "#5326D6")
|
||||||
@ -116,25 +124,32 @@ class VRPhotoTransformController: BaseController {
|
|||||||
mCenView?.backgroundColor = UIColor.colorWithRGB(_r: 18, _g: 7, _b: 68)
|
mCenView?.backgroundColor = UIColor.colorWithRGB(_r: 18, _g: 7, _b: 68)
|
||||||
|
|
||||||
mCenLab1 = UILabel()
|
mCenLab1 = UILabel()
|
||||||
mCenLab1!.bounds = CGRect(x: 0, y: 0, width: 100, height: 0)
|
mCenLab1!.bounds = CGRect(x: 0, y: 0, width: 200, height: 0)
|
||||||
mCenLab1!.textColor = UIColor.hexStringToColor(hexString: "#ffffff")
|
mCenLab1!.textColor = UIColor.hexStringToColor(hexString: "#ffffff")
|
||||||
mCenLab1!.font = UIFont.systemFont(ofSize: 14)
|
mCenLab1!.font = UIFont.systemFont(ofSize: 14)
|
||||||
mCenView!.addSubview(mCenLab1!)
|
mCenView!.addSubview(mCenLab1!)
|
||||||
mCenLab1!.text = "20240121020131292.MOV"
|
mCenLab1!.text = "--"
|
||||||
mCenLab1!.sizeToFit()
|
mCenLab1!.sizeToFit()
|
||||||
if(mCenLab1!.width > mCenView!.width - 140){
|
if(mCenLab1!.width > mCenView!.width - 140){
|
||||||
mCenLab1!.width = mCenView!.width - 140
|
mCenLab1!.width = mCenView!.width - 140
|
||||||
}
|
}
|
||||||
mCenLab1!.top = 12
|
mCenLab1!.top = 12
|
||||||
mCenLab1!.left = 16
|
mCenLab1!.left = 16
|
||||||
|
imageAsset?.requestContentEditingInput(with: nil) { [self] (contentEditingInput, info) in
|
||||||
|
guard let contentEditingInput = contentEditingInput else {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
let fileName = contentEditingInput.fullSizeImageURL?.lastPathComponent
|
||||||
|
mCenLab1!.text = fileName
|
||||||
|
mCenLab1!.sizeToFit()
|
||||||
|
}
|
||||||
|
|
||||||
mCenLab2 = UILabel()
|
mCenLab2 = UILabel()
|
||||||
mCenLab2!.bounds = CGRect(x: 0, y: 0, width: 100, height: 0)
|
mCenLab2!.bounds = CGRect(x: 0, y: 0, width: 100, height: 0)
|
||||||
mCenLab2!.textColor = UIColor.hexStringToColor(hexString: "#67617A")
|
mCenLab2!.textColor = UIColor.hexStringToColor(hexString: "#67617A")
|
||||||
mCenLab2!.font = UIFont.systemFont(ofSize: 12)
|
mCenLab2!.font = UIFont.systemFont(ofSize: 12)
|
||||||
mCenView!.addSubview(mCenLab2!)
|
mCenView!.addSubview(mCenLab2!)
|
||||||
mCenLab2!.text = "\(imgWidth) x \(imgHeight) · \(imgMbSize)"
|
|
||||||
mCenLab2!.text = String(format: "%.f x %.f · %.1f MB",imgWidth,imgHeight,imgMbSize)
|
mCenLab2!.text = String(format: "%.f x %.f · %.1f MB",imgWidth,imgHeight,imgMbSize)
|
||||||
mCenLab2!.sizeToFit()
|
mCenLab2!.sizeToFit()
|
||||||
if(mCenLab2!.width > mCenView!.width - 140){
|
if(mCenLab2!.width > mCenView!.width - 140){
|
||||||
|
|||||||
@ -101,7 +101,8 @@ class VRVideoTransformController: BaseController {
|
|||||||
mAvPlayer?.view.frame = CGRect(x: 24, y: Int(SafeAreaTop_Height) + 24, width: Int(SCREEN_Width) - 48, height: (Int(SCREEN_Width) - 48) * 200/345)
|
mAvPlayer?.view.frame = CGRect(x: 24, y: Int(SafeAreaTop_Height) + 24, width: Int(SCREEN_Width) - 48, height: (Int(SCREEN_Width) - 48) * 200/345)
|
||||||
self.addChild(mAvPlayer!)
|
self.addChild(mAvPlayer!)
|
||||||
self.view.addSubview(mAvPlayer!.view)
|
self.view.addSubview(mAvPlayer!.view)
|
||||||
mAvPlayer?.view.backgroundColor = UIColor.hexStringToColor(hexString: "#666666")
|
// mAvPlayer?.view.backgroundColor = UIColor.hexStringToColor(hexString: "#666666")
|
||||||
|
mAvPlayer?.view.backgroundColor = UIColor.clear
|
||||||
mAvPlayer!.view.clipsToBounds = true
|
mAvPlayer!.view.clipsToBounds = true
|
||||||
mAvPlayer!.view.layer.cornerRadius = 8
|
mAvPlayer!.view.layer.cornerRadius = 8
|
||||||
|
|
||||||
|
|||||||
@ -30,7 +30,7 @@ class CCSpaceAlbumFliterPopView: UIView {
|
|||||||
var fetchResult: PHFetchResult<PHAsset>!
|
var fetchResult: PHFetchResult<PHAsset>!
|
||||||
var photos: [UIImage] = []
|
var photos: [UIImage] = []
|
||||||
|
|
||||||
var selectedImageHandler: ((Data) -> Void)?
|
var selectedImageHandler: ((Data,PHAsset) -> Void)?
|
||||||
var selectedVideoHandler: ((URL) -> Void)?
|
var selectedVideoHandler: ((URL) -> Void)?
|
||||||
|
|
||||||
lazy var menuView: CCPopMenuView = {
|
lazy var menuView: CCPopMenuView = {
|
||||||
@ -494,17 +494,18 @@ extension CCSpaceAlbumFliterPopView:UICollectionViewDataSource, UICollectionView
|
|||||||
if asset.mediaType == .image {
|
if asset.mediaType == .image {
|
||||||
//选择的是图片
|
//选择的是图片
|
||||||
let imageData = self.getImageData(for: asset)
|
let imageData = self.getImageData(for: asset)
|
||||||
|
|
||||||
// 关闭
|
// 关闭
|
||||||
if Thread.isMainThread {
|
if Thread.isMainThread {
|
||||||
self.hide()
|
self.hide()
|
||||||
if let imageData = imageData {
|
if let imageData = imageData {
|
||||||
self.selectedImageHandler?(imageData)
|
self.selectedImageHandler?(imageData,asset)
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
DispatchQueue.main.async {
|
DispatchQueue.main.async {
|
||||||
self.hide()
|
self.hide()
|
||||||
if let imageData = imageData {
|
if let imageData = imageData {
|
||||||
self.selectedImageHandler?(imageData)
|
self.selectedImageHandler?(imageData,asset)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user