Commit c3c18b7a authored by CZ1004's avatar CZ1004

【优化】优化视频压缩逻辑

parent 4a1b6582
{
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"filename" : "btn_add_contact.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "btn_add_contact@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "btn_add_contact@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"filename" : "ic_beifen.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "ic_beifen@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "ic_beifen@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"filename" : "ic_close_similar.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "ic_close_similar@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "ic_close_similar@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"filename" : "ic_delete_duplicates.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "ic_delete_duplicates@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "ic_delete_duplicates@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"filename" : "ic_delete_email.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "ic_delete_email@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "ic_delete_email@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"filename" : "ic_hebing.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "ic_hebing@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "ic_hebing@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"filename" : "ic_no_duolicates.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "ic_no_duolicates@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "ic_no_duolicates@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"filename" : "ic_ok_duolicates.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "ic_ok_duolicates@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "ic_ok_duolicates@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"filename" : "ic_unsel_com_red.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "ic_unsel_com_red@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "ic_unsel_com_red@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"filename" : "icon_return_setting_nor.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "icon_return_setting_nor@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "icon_return_setting_nor@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"filename" : "img_contacts.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "img_contacts@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "img_contacts@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
......@@ -140,10 +140,7 @@ extension BaseNavViewController:UIViewControllerTransitioningDelegate {
}
func animationController(forDismissed dismissed: UIViewController) -> UIViewControllerAnimatedTransitioning? {
return nil
}
}
......
......@@ -146,7 +146,20 @@ class CompressSelectCell : UICollectionViewCell {
@objc func selectClick(){
self.choose = !self.choose
let vc = PMShowImgVideoController()
vc.getVideoURLFromLocalIdentifier(localIdentifier: self.model?.localIdentifier ?? "") {[weak self] url, error in
guard let self else {return}
if url != nil{
self.choose = !self.choose
}else{
let alert = UIAlertController(title: nil, message: "ICloud video cannot be compressed", preferredStyle: .alert)
self.responderViewController()?.present(alert, animated: true, completion: nil)
// 1 秒后关闭弹窗
DispatchQueue.main.asyncAfter(deadline: .now() + 1) {
alert.dismiss(animated: true, completion: nil)
}
}
}
}
......@@ -204,8 +217,6 @@ class CompressSelectCell : UICollectionViewCell {
make.height.width.equalTo(80)
}
}
required init?(coder: NSCoder) {
......@@ -219,10 +230,6 @@ class CompressSelectCell : UICollectionViewCell {
if self.currentMediaType == .compressPhoto {
// // 如果是图片
// let vc : PreViewController = PreViewController()
// vc.imageIdent = self.model!.localIdentifier
// self.responderViewController()?.navigationController?.pushViewController(vc, animated: true)
// 点击之后跳转详情页面
if let tempModel = self.model {
let vc = PMShowImgVideoController()
......@@ -236,12 +243,9 @@ class CompressSelectCell : UICollectionViewCell {
vc.homeDataSource = [dataSource]
self.responderViewController()?.navigationController?.pushViewController(vc, animated: true)
}
}else{
// 如果是视频
// let vc : PreVideoController = PreVideoController(localIdentifier: self.model!.localIdentifier)
// self.responderViewController()?.navigationController?.pushViewController(vc, animated: true)
if let tempModel = self.model {
// 获取视频的图片
PhotoAndVideoMananger.mananger.getVideoImageByIdent(ident: tempModel) { image in
......@@ -271,7 +275,6 @@ class CompressSelectCell : UICollectionViewCell {
}
}
}
} errorHandler: {
DispatchQueue.main.async {
let alert = UIAlertController(title: nil, message: "Get Video image failure", preferredStyle: .alert)
......@@ -285,8 +288,8 @@ class CompressSelectCell : UICollectionViewCell {
}
}
}
}
}
}
}
......@@ -83,7 +83,7 @@ class CompressCompletedViewController : BaseViewController{
let label = UILabel()
label.text = "511MB"
label.textColor = UIColor(red: 0, green: 0.51, blue: 1, alpha: 1)
label.textAlignment = .center
label.textAlignment = .right
label.font = UIFont.systemFont(ofSize: 14, weight: .bold)
label.layer.borderColor = UIColor(red: 0, green: 0.51, blue: 1, alpha: 1).cgColor
label.backgroundColor = .clear
......@@ -119,7 +119,7 @@ class CompressCompletedViewController : BaseViewController{
let label = UILabel()
label.text = "1.0%"
label.textColor = UIColor(red: 0, green: 0.51, blue: 1, alpha: 1)
label.textAlignment = .center
label.textAlignment = .right
label.font = UIFont.systemFont(ofSize: 14, weight: .bold)
label.layer.borderColor = UIColor(red: 0, green: 0.51, blue: 1, alpha: 1).cgColor
label.backgroundColor = .clear
......@@ -200,19 +200,19 @@ class CompressCompletedViewController : BaseViewController{
self.tipTopLabel.snp.makeConstraints { make in
make.top.equalToSuperview().offset(20)
make.width.equalTo(198)
make.width.equalTo(120)
make.height.equalTo(22)
make.left.equalTo(self.topImageView.snp.right).offset(8)
}
self.detailTipToplabel.snp.makeConstraints { make in
make.top.equalTo(self.tipTopLabel.snp.bottom).offset(0)
make.width.equalTo(198)
make.width.equalTo(120)
make.height.equalTo(17)
make.left.equalTo(self.topImageView.snp.right).offset(8)
}
self.sizeToplabel.snp.makeConstraints { make in
make.top.equalToSuperview().offset(26)
make.width.equalTo(64)
make.left.equalTo(self.detailTipToplabel.snp.right).offset(5)
make.height.equalTo(28)
make.right.equalToSuperview().offset(-20)
}
......@@ -224,19 +224,19 @@ class CompressCompletedViewController : BaseViewController{
self.tipBottomLabel.snp.makeConstraints { make in
make.top.equalToSuperview().offset(75)
make.width.equalTo(198)
make.width.equalTo(120)
make.height.equalTo(22)
make.left.equalTo(self.bottomImageView.snp.right).offset(8)
}
self.detailTipBottomlabel.snp.makeConstraints { make in
make.top.equalTo(self.tipBottomLabel.snp.bottom).offset(0)
make.width.equalTo(198)
make.width.equalTo(120)
make.height.equalTo(17)
make.left.equalTo(self.bottomImageView.snp.right).offset(8)
}
self.sizeBottomlabel.snp.makeConstraints { make in
make.top.equalToSuperview().offset(81)
make.width.equalTo(64)
make.left.equalTo(self.detailTipBottomlabel.snp.right).offset(5)
make.height.equalTo(28)
make.right.equalToSuperview().offset(-20)
}
......
......@@ -258,7 +258,7 @@ class CompressQualityController : BaseViewController{
}else{
// 压缩视频
var compressAllSize : Double = 0.0
manager.compressVideos(models: self.model!, quality: Float(currentQulity)) { (identifier, progress) in
CompressViewModel.compressVideos(models: self.model!, quality: Float(currentQulity)) { (identifier, progress) in
compressingView.animationView.setProgress(CGFloat(progress), animated: false, duration: 0.1)
} completion: { (outputURLs, errors) in
for (index, outputURL) in outputURLs.enumerated() {
......@@ -268,6 +268,7 @@ class CompressQualityController : BaseViewController{
if let fileSize = attributes[.size] as? Int64 {
compressAllSize = compressAllSize + Double(fileSize)
}
Print("---------压缩后的大小:\(compressAllSize)")
} catch {
Print("获取视频文件大小失败")
}
......@@ -275,12 +276,12 @@ class CompressQualityController : BaseViewController{
} else if let error = errors[index] {
print("Error compressing video \(index): \(error.localizedDescription)")
}
// 不管成功失败都跳转下一页
self.updateNextView(compressAllSize,compressingView,[],outputURLs)
}
self.updateNextView(compressAllSize,compressingView,[],outputURLs)
}
}
}
actionBlock()
......
......@@ -9,6 +9,16 @@
"heightImage": "tabbar_secret_hight",
"text":"Secret Space",
},
{
"normalImage": "ic_contacts_home_pre",
"heightImage": "tabbar_contacts_hight",
"text":"Contacts",
},
{
"normalImage": "ic_email_home_pre",
"heightImage": "tabbar_email_hight",
"text":"Email Cleaner",
},
{
"normalImage": "ic_cmpress_home_pre",
"heightImage": "tabbar_cmpress_high",
......
......@@ -2,6 +2,8 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>NSContactsUsageDescription</key>
<string>Phone Manager needs access to your contacts to find and merge duplicate contacts</string>
<key>NSUserTrackingUsageDescription</key>
<string>We need your permission to track your usage habits in order to provide a more personalized advertising experience</string>
<key>NSAppTransportSecurity</key>
......
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