Parcourir la source

录音逻辑Fixed && 剔除原有废弃音乐选择相关文件及代码

Chris il y a 5 ans
Parent
commit
1ce98ae0ec
21 fichiers modifiés avec 82 ajouts et 1894 suppressions
  1. 0 72
      RainbowPlanet/RainbowPlanet.xcodeproj/project.pbxproj
  2. 0 52
      RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoFile/Common/MusicPick/AliyunMusicPickViewController.h
  3. 0 810
      RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoFile/Common/MusicPick/AliyunMusicPickViewController.m
  4. 0 71
      RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoFile/Common/MusicPick/Model/AliyunMusicPickModel.h
  5. 0 78
      RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoFile/Common/MusicPick/Model/AliyunMusicPickModel.m
  6. 0 16
      RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoFile/Common/MusicPick/View/AliyunMusicLineView.h
  7. 0 58
      RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoFile/Common/MusicPick/View/AliyunMusicLineView.m
  8. 0 25
      RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoFile/Common/MusicPick/View/AliyunMusicPickCell.h
  9. 0 173
      RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoFile/Common/MusicPick/View/AliyunMusicPickCell.m
  10. 0 13
      RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoFile/Common/MusicPick/View/AliyunMusicPickCoverView.h
  11. 0 64
      RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoFile/Common/MusicPick/View/AliyunMusicPickCoverView.m
  12. 0 35
      RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoFile/Common/MusicPick/View/AliyunMusicPickHeaderView.h
  13. 0 137
      RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoFile/Common/MusicPick/View/AliyunMusicPickHeaderView.m
  14. 0 23
      RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoFile/Common/MusicPick/View/AliyunMusicPickTabView.h
  15. 0 95
      RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoFile/Common/MusicPick/View/AliyunMusicPickTabView.m
  16. 0 19
      RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoFile/Common/MusicPick/View/AliyunMusicPickTopView.h
  17. 0 68
      RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoFile/Common/MusicPick/View/AliyunMusicPickTopView.m
  18. 45 70
      RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoFile/VideoEdit/Controller/AliyunEditViewController.m
  19. 24 11
      RainbowPlanet/RainbowPlanet/Modules/PublishModule/PublishMusicAbout/PublishMusicChooseView.swift
  20. 13 3
      RainbowPlanet/RainbowPlanet/Modules/PublishModule/PublishMusicAbout/PublishMusicVolumnView.swift
  21. 0 1
      RainbowPlanet/RainbowPlanet/Modules/PublishModule/PublishMusicAbout/PublishRecordMusicView.swift

+ 0 - 72
RainbowPlanet/RainbowPlanet.xcodeproj/project.pbxproj

@@ -600,14 +600,6 @@
 		BD6122B922C3639E00D3F513 /* AlivcEditBottomHeaderView.m in Sources */ = {isa = PBXBuildFile; fileRef = BD6122B322C3639E00D3F513 /* AlivcEditBottomHeaderView.m */; };
 		BD6122BA22C3639E00D3F513 /* AliyunEffectFilterView.m in Sources */ = {isa = PBXBuildFile; fileRef = BD6122B422C3639E00D3F513 /* AliyunEffectFilterView.m */; };
 		BD6122BB22C3639E00D3F513 /* AlivcEditIconButton.m in Sources */ = {isa = PBXBuildFile; fileRef = BD6122B822C3639E00D3F513 /* AlivcEditIconButton.m */; };
-		BD6122CF22C364E400D3F513 /* AliyunMusicPickViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = BD6122BE22C364E400D3F513 /* AliyunMusicPickViewController.m */; };
-		BD6122D022C364E400D3F513 /* AliyunMusicPickModel.m in Sources */ = {isa = PBXBuildFile; fileRef = BD6122C022C364E400D3F513 /* AliyunMusicPickModel.m */; };
-		BD6122D122C364E400D3F513 /* AliyunMusicPickTopView.m in Sources */ = {isa = PBXBuildFile; fileRef = BD6122C722C364E400D3F513 /* AliyunMusicPickTopView.m */; };
-		BD6122D222C364E400D3F513 /* AliyunMusicLineView.m in Sources */ = {isa = PBXBuildFile; fileRef = BD6122C822C364E400D3F513 /* AliyunMusicLineView.m */; };
-		BD6122D322C364E400D3F513 /* AliyunMusicPickCell.m in Sources */ = {isa = PBXBuildFile; fileRef = BD6122C922C364E400D3F513 /* AliyunMusicPickCell.m */; };
-		BD6122D422C364E400D3F513 /* AliyunMusicPickTabView.m in Sources */ = {isa = PBXBuildFile; fileRef = BD6122CA22C364E400D3F513 /* AliyunMusicPickTabView.m */; };
-		BD6122D522C364E400D3F513 /* AliyunMusicPickCoverView.m in Sources */ = {isa = PBXBuildFile; fileRef = BD6122CB22C364E400D3F513 /* AliyunMusicPickCoverView.m */; };
-		BD6122D622C364E400D3F513 /* AliyunMusicPickHeaderView.m in Sources */ = {isa = PBXBuildFile; fileRef = BD6122CC22C364E400D3F513 /* AliyunMusicPickHeaderView.m */; };
 		BD6122F822C36A8100D3F513 /* AVAsset+VideoInfo.m in Sources */ = {isa = PBXBuildFile; fileRef = BD6122F122C36A8100D3F513 /* AVAsset+VideoInfo.m */; };
 		BD6122F922C36A8100D3F513 /* UIView+Progress.m in Sources */ = {isa = PBXBuildFile; fileRef = BD6122F422C36A8100D3F513 /* UIView+Progress.m */; };
 		BD6122FA22C36A8100D3F513 /* QUProgressView.m in Sources */ = {isa = PBXBuildFile; fileRef = BD6122F722C36A8100D3F513 /* QUProgressView.m */; };
@@ -1370,22 +1362,6 @@
 		BD6122B622C3639E00D3F513 /* AliyunEffectFilterView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AliyunEffectFilterView.h; sourceTree = "<group>"; };
 		BD6122B722C3639E00D3F513 /* AlivcEditBottomHeaderView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AlivcEditBottomHeaderView.h; sourceTree = "<group>"; };
 		BD6122B822C3639E00D3F513 /* AlivcEditIconButton.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AlivcEditIconButton.m; sourceTree = "<group>"; };
-		BD6122BD22C364E400D3F513 /* AliyunMusicPickViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AliyunMusicPickViewController.h; sourceTree = "<group>"; };
-		BD6122BE22C364E400D3F513 /* AliyunMusicPickViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AliyunMusicPickViewController.m; sourceTree = "<group>"; };
-		BD6122C022C364E400D3F513 /* AliyunMusicPickModel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AliyunMusicPickModel.m; sourceTree = "<group>"; };
-		BD6122C122C364E400D3F513 /* AliyunMusicPickModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AliyunMusicPickModel.h; sourceTree = "<group>"; };
-		BD6122C322C364E400D3F513 /* AliyunMusicPickHeaderView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AliyunMusicPickHeaderView.h; sourceTree = "<group>"; };
-		BD6122C422C364E400D3F513 /* AliyunMusicPickCoverView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AliyunMusicPickCoverView.h; sourceTree = "<group>"; };
-		BD6122C522C364E400D3F513 /* AliyunMusicPickTabView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AliyunMusicPickTabView.h; sourceTree = "<group>"; };
-		BD6122C622C364E400D3F513 /* AliyunMusicPickCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AliyunMusicPickCell.h; sourceTree = "<group>"; };
-		BD6122C722C364E400D3F513 /* AliyunMusicPickTopView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AliyunMusicPickTopView.m; sourceTree = "<group>"; };
-		BD6122C822C364E400D3F513 /* AliyunMusicLineView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AliyunMusicLineView.m; sourceTree = "<group>"; };
-		BD6122C922C364E400D3F513 /* AliyunMusicPickCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AliyunMusicPickCell.m; sourceTree = "<group>"; };
-		BD6122CA22C364E400D3F513 /* AliyunMusicPickTabView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AliyunMusicPickTabView.m; sourceTree = "<group>"; };
-		BD6122CB22C364E400D3F513 /* AliyunMusicPickCoverView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AliyunMusicPickCoverView.m; sourceTree = "<group>"; };
-		BD6122CC22C364E400D3F513 /* AliyunMusicPickHeaderView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AliyunMusicPickHeaderView.m; sourceTree = "<group>"; };
-		BD6122CD22C364E400D3F513 /* AliyunMusicPickTopView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AliyunMusicPickTopView.h; sourceTree = "<group>"; };
-		BD6122CE22C364E400D3F513 /* AliyunMusicLineView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AliyunMusicLineView.h; sourceTree = "<group>"; };
 		BD6122F022C36A8100D3F513 /* AVAsset+VideoInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "AVAsset+VideoInfo.h"; sourceTree = "<group>"; };
 		BD6122F122C36A8100D3F513 /* AVAsset+VideoInfo.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "AVAsset+VideoInfo.m"; sourceTree = "<group>"; };
 		BD6122F322C36A8100D3F513 /* UIView+Progress.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIView+Progress.h"; sourceTree = "<group>"; };
@@ -5230,7 +5206,6 @@
 				BD61227622C35C1000D3F513 /* AlivcShortVideoRoute.m */,
 				BD6122B222C3639E00D3F513 /* FilterAbout */,
 				BD61229F22C3638300D3F513 /* Model */,
-				BD6122BC22C364E400D3F513 /* MusicPick */,
 				BD61226322C3595B00D3F513 /* UIConfig */,
 				BD61227D22C3605B00D3F513 /* ResourceManager */,
 			);
@@ -5365,45 +5340,6 @@
 			path = FilterAbout;
 			sourceTree = "<group>";
 		};
-		BD6122BC22C364E400D3F513 /* MusicPick */ = {
-			isa = PBXGroup;
-			children = (
-				BD6122BD22C364E400D3F513 /* AliyunMusicPickViewController.h */,
-				BD6122BE22C364E400D3F513 /* AliyunMusicPickViewController.m */,
-				BD6122BF22C364E400D3F513 /* Model */,
-				BD6122C222C364E400D3F513 /* View */,
-			);
-			path = MusicPick;
-			sourceTree = "<group>";
-		};
-		BD6122BF22C364E400D3F513 /* Model */ = {
-			isa = PBXGroup;
-			children = (
-				BD6122C122C364E400D3F513 /* AliyunMusicPickModel.h */,
-				BD6122C022C364E400D3F513 /* AliyunMusicPickModel.m */,
-			);
-			path = Model;
-			sourceTree = "<group>";
-		};
-		BD6122C222C364E400D3F513 /* View */ = {
-			isa = PBXGroup;
-			children = (
-				BD6122C322C364E400D3F513 /* AliyunMusicPickHeaderView.h */,
-				BD6122CC22C364E400D3F513 /* AliyunMusicPickHeaderView.m */,
-				BD6122C622C364E400D3F513 /* AliyunMusicPickCell.h */,
-				BD6122C922C364E400D3F513 /* AliyunMusicPickCell.m */,
-				BD6122CD22C364E400D3F513 /* AliyunMusicPickTopView.h */,
-				BD6122C722C364E400D3F513 /* AliyunMusicPickTopView.m */,
-				BD6122CE22C364E400D3F513 /* AliyunMusicLineView.h */,
-				BD6122C822C364E400D3F513 /* AliyunMusicLineView.m */,
-				BD6122C522C364E400D3F513 /* AliyunMusicPickTabView.h */,
-				BD6122CA22C364E400D3F513 /* AliyunMusicPickTabView.m */,
-				BD6122C422C364E400D3F513 /* AliyunMusicPickCoverView.h */,
-				BD6122CB22C364E400D3F513 /* AliyunMusicPickCoverView.m */,
-			);
-			path = View;
-			sourceTree = "<group>";
-		};
 		BD6122EE22C36A8100D3F513 /* Vendor */ = {
 			isa = PBXGroup;
 			children = (
@@ -6048,14 +5984,12 @@
 				BD6122F822C36A8100D3F513 /* AVAsset+VideoInfo.m in Sources */,
 				BD61226022C3561C00D3F513 /* AliyunRateSelectView.m in Sources */,
 				A7C0FDF022B6538200BC1E86 /* CommunityBannerFSPagerViewCell.swift in Sources */,
-				BD6122D522C364E400D3F513 /* AliyunMusicPickCoverView.m in Sources */,
 				BD01B20022BC677900CE9F36 /* PublishVideoRecorderController.swift in Sources */,
 				BDF862AC228E5112000DEF84 /* OrderCommentAddImgCollectionCell.swift in Sources */,
 				BDE376DB22C22A260055E2EA /* UIView+AlivcHelper.m in Sources */,
 				A71AA5152272160A008FF1A5 /* ExpressAddressListTableViewCell.swift in Sources */,
 				A72A72B722321DE000B21995 /* Extension+NSMutableAttributedString.swift in Sources */,
 				A7931E0D22AF874600297D0A /* GenderSelectionViewController.swift in Sources */,
-				BD6122D022C364E400D3F513 /* AliyunMusicPickModel.m in Sources */,
 				A7C0FDF522B65FE000BC1E86 /* FeaturedTopicsCollectionViewCell.swift in Sources */,
 				A7BB6857226965C100AB07A2 /* SelfRecommendationHeaderCollectionReusableView.swift in Sources */,
 				BDE3045F228554CA001D050F /* ProductCartAmountModel.swift in Sources */,
@@ -6075,7 +6009,6 @@
 				BDD4FB1222840597006FE833 /* ShoppingCartPayOrderController.swift in Sources */,
 				BD12203A22AF80AD0051C7C2 /* MessageActivityTableCell.swift in Sources */,
 				A7284404224DBFBD00F82F30 /* UserModel.swift in Sources */,
-				BD6122D422C364E400D3F513 /* AliyunMusicPickTabView.m in Sources */,
 				A7931E1122AF989B00297D0A /* TopicSelectionViewController.swift in Sources */,
 				BD10FC0822C748DA0096A34E /* AlivcAlertView.m in Sources */,
 				A71D2A602265673A00A55D16 /* RegisterLoginView.swift in Sources */,
@@ -6191,7 +6124,6 @@
 				BD13B6DF22BA03BC008BB323 /* PublishTopicHeaderView.swift in Sources */,
 				A7778CB82244E97A00C7C47A /* BindPhoneNumberViewController.swift in Sources */,
 				A754150F224CACF9002480B5 /* SwiftSign.swift in Sources */,
-				BD6122D222C364E400D3F513 /* AliyunMusicLineView.m in Sources */,
 				A71AF0BA226F00F8001730FE /* SearchResultView.swift in Sources */,
 				A7297C6622D72FA4001A7AE6 /* KeyBoardCommentView.swift in Sources */,
 				A77F2CB52232010F001BD3F6 /* ShoppingMallViewController.swift in Sources */,
@@ -6272,7 +6204,6 @@
 				A7BF203122B47CC000396DB3 /* CardContentCommnetTableViewCell.swift in Sources */,
 				A7D07CDA22B7DFAE00186014 /* OtherPersonalCenterHeaderView.swift in Sources */,
 				A72A72AF22321DE000B21995 /* AppInfo.swift in Sources */,
-				BD6122D122C364E400D3F513 /* AliyunMusicPickTopView.m in Sources */,
 				A70B843422911AF600882BC5 /* ProductDetailView.swift in Sources */,
 				A72623D722C26A2A00AEF875 /* MessageListModel.swift in Sources */,
 				A7FF1598228D092A00A85748 /* OrderListModel.swift in Sources */,
@@ -6296,7 +6227,6 @@
 				A7D5F26322C0CF8600F8E9AF /* UserFansModel.swift in Sources */,
 				BD13B6E122BA03BC008BB323 /* PublishSelTopicCollectionCell.swift in Sources */,
 				A70B2C46228840B100B2449F /* ProductDetailHotSellTableViewCell.swift in Sources */,
-				BD6122CF22C364E400D3F513 /* AliyunMusicPickViewController.m in Sources */,
 				A7D5F25F22C0614400F8E9AF /* CommunityTopicCategoryModel.swift in Sources */,
 				A7778CDF22461BAD00C7C47A /* PhoneCountryAreaSectionHeaderView.swift in Sources */,
 				A7AA9F5A22C5FB1E0086498B /* SwiftMoyaNetWorkServiceVirus.swift in Sources */,
@@ -6449,7 +6379,6 @@
 				A738D202225AD6AD00EEE860 /* Extension+UICollectionView.swift in Sources */,
 				BDAF83AA22B388F20004BCC3 /* RecommendDefaultBackCell.swift in Sources */,
 				A71CAB3922C9DF0600D908A8 /* CommunityTopicDetailModel.swift in Sources */,
-				BD6122D322C364E400D3F513 /* AliyunMusicPickCell.m in Sources */,
 				A71AF0BC226F099B001730FE /* ProductHBigTableViewCell.swift in Sources */,
 				BD37E38522CDF91A003A14A2 /* CommunityVideoSelTopicCell.swift in Sources */,
 				BD108C9622A60C2100837DAB /* HGImagePickerCell.swift in Sources */,
@@ -6523,7 +6452,6 @@
 				A7F2D6C622B0DC7B0093000B /* CommunityCommonSectionHeaderView.swift in Sources */,
 				A770E61622D6625700CBD0A4 /* ShareCollectionViewCell.swift in Sources */,
 				BD01B1FA22BC673900CE9F36 /* PublishConfirmPhotoController.swift in Sources */,
-				BD6122D622C364E400D3F513 /* AliyunMusicPickHeaderView.m in Sources */,
 				BD10CD0C22BFCC7C0040796E /* PublishMusicView.swift in Sources */,
 				A7F2D6DF22B25B5D0093000B /* CardContentPicVideoCollectionViewLayout.swift in Sources */,
 				A7D77DF422DDEED10048D5F6 /* FloorHeaderViewFloorHeaderView.swift in Sources */,

+ 0 - 52
RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoFile/Common/MusicPick/AliyunMusicPickViewController.h

@@ -1,52 +0,0 @@
-//
-//  AliyunMusicPickViewController.h
-//  qusdk
-//
-//  Created by Worthy on 2017/6/7.
-//  Copyright © 2017年 Alibaba Group Holding Limited. All rights reserved.
-//
-
-#import <UIKit/UIKit.h>
-#import "AliyunMusicPickModel.h"
-#import "AlivcBaseViewController.h"
-
-@class AliyunMusicPickModel;
-@protocol AliyunMusicPickViewControllerDelegate <NSObject>
-
-/**
- 取消
- */
-- (void)didCancelPick;
-
-/**
- 选择了音乐,并点击了应用按钮响应
-
- @param music 选择的音乐
- @param tab 表明是本地音乐还是在线音乐
- */
-- (void)didSelectMusic:(AliyunMusicPickModel *)music tab:(NSInteger)tab;
-
-@end
-
-@interface AliyunMusicPickViewController : AlivcBaseViewController
-
-/**
- 代理
- */
-@property (nonatomic, weak) id<AliyunMusicPickViewControllerDelegate> delegate;
-
-/**
- 时长
- */
-@property (nonatomic, assign) CGFloat duration;
-
-/**
- 之前应用的音乐 - 用于设置初始值
- */
-@property (nonatomic, strong) AliyunMusicPickModel *selectedMusic;
-
-/**
- 之前应用的音乐的所属 - 用于设置初始值
- */
-@property (nonatomic, assign) NSInteger selectedTab;
-@end

+ 0 - 810
RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoFile/Common/MusicPick/AliyunMusicPickViewController.m

@@ -1,810 +0,0 @@
-//
-//  AliyunMusicPickViewController.m
-//  qusdk
-//
-//  Created by Worthy on 2017/6/7.
-//  Copyright © 2017年 Alibaba Group Holding Limited. All rights reserved.
-//      
-
-#import "AliyunMusicPickViewController.h"
-#import "AliyunMusicPickHeaderView.h"
-#import "AliyunMusicPickCell.h"
-#import <AVFoundation/AVFoundation.h>
-#import "AVAsset+VideoInfo.h"
-#import "AliyunMusicPickTopView.h"
-#import <MediaPlayer/MediaPlayer.h>
-#import <AVFoundation/AVFoundation.h>
-#import "AliyunLibraryMusicImport.h"
-#import "AliyunPathManager.h"
-#import "AliyunMusicPickTabView.h"
-#import "AlivcUIConfig.h"
-#import "MBProgressHUD.h"
-#import "AVC_ShortVideo_Config.h"
-#import <AFNetworking.h>
-#import "AliyunEffectResourceModel.h"
-#import "AliyunEffectInfo.h"
-#import "AliyunDBHelper.h"
-#import "UIView+AlivcHelper.h"
-#import "MBProgressHUD+AlivcHelper.h"
-#import "AlivcMacro.h"
-
-//缓存远程音乐的文件路径
-#define tmpMusicPath [NSTemporaryDirectory() stringByAppendingString:@"tmpMusicPath"]
-//缓存page文件的路径
-#define tmpPagePath [NSTemporaryDirectory() stringByAppendingString:@"tmpPagePath"]
-
-@interface AliyunMusicPickViewController () <UITableViewDelegate, UITableViewDataSource, AliyunMusicPickHeaderViewDelegate, AliyunMusicPickCellDelegate, AliyunMusicPickTopViewDelegate,AliyunMusicPickTabViewDelegate,UITextViewDelegate>
-@property (nonatomic, strong) UITableView *tableView;
-@property (nonatomic, strong) AliyunMusicPickTopView *topView;
-@property (nonatomic, strong) AliyunMusicPickTabView *tabView;
-//@property (nonatomic, strong) NSMutableArray *musics; //当前展示的音乐 远程或者本地
-@property (nonatomic, strong) NSMutableArray *remoteMusics; //远程的音乐列表
-@property (nonatomic, strong) NSMutableArray *iTunesMusics; //本地的音乐列表
-@property (nonatomic, strong) NSMutableArray *downloadingMusics;
-@property (nonatomic, assign) NSInteger selectedSection;
-@property (nonatomic, assign) NSInteger selectedSection_remote;
-@property (nonatomic, assign) NSInteger selectedSection_local;
-@property (nonatomic, strong) AVPlayer *player;
-@property (nonatomic, assign) CGFloat startTime;
-@property (nonatomic, strong) AliyunDBHelper *dbHelper;
-@property (nonatomic, weak) UITextView *bottomTextView;
-/**
- 之前应用的远程音乐 - 用于左右切换设置原先的值
- */
-@property (nonatomic, strong) AliyunMusicPickModel *selectedMusic_remote;
-/**
- 之前应用的本地音乐 - 用于左右切换设置原先的值
- */
-@property (nonatomic, strong) AliyunMusicPickModel *selectedMusic_local;
-
-@property (nonatomic, assign) BOOL isLoading; //是否正在加载
-
-@property (nonatomic, weak) UIActivityIndicatorView *indicatorView;//loading指示器
-
-@property (nonatomic, strong) UIView *emptyTableViewHeader;
-
-@property (nonatomic, strong) UISearchController *searchC;
-
-@end
-
-@implementation AliyunMusicPickViewController
-
-- (void)viewDidLoad {
-    [super viewDidLoad];
-    
-    [self setupSubviews];
-    [self addNotification];
-    
-    //如果有选中的音乐 则恢复历史状态
-    if(self.selectedMusic){
-        [self restoreRemoteMusic];
-    }
-    //初始化
-    self.downloadingMusics = [NSMutableArray array];
-    
-    
-    if (!_duration) {
-        _duration = 8;
-    }
-    [self updateSelectedMusic];
-    [self.tabView setSelectedTab:self.selectedTab];
-    // 弹出本地音乐权限提示框
-    [MPMediaQuery songsQuery];
-}
-
-
-
-- (void)viewDidDisappear:(BOOL)animated{
-    [super viewDidDisappear:animated];
-    if (self.player) {
-        [self.player pause];
-        [self.player.currentItem cancelPendingSeeks];
-        [self.player.currentItem.asset cancelLoading];
-        self.player = nil;
-    }
-    //缓存当时的数组
-    [self storeMusic];
-}
-
-
--(void)viewWillAppear:(BOOL)animated{
-    [super viewWillAppear:animated];
-    [self.navigationController setNavigationBarHidden:YES animated:NO];
-    [self.view bringSubviewToFront:self.bottomTextView];
-    //更新选中的音乐
-    [self updateSelectedMusic];
-    [self.tabView setSelectedTab:self.selectedTab];
-}
-
-
--(BOOL)prefersStatusBarHidden {
-    return YES;
-}
-
--(void)dealloc {
-    [self removeNotification];
-    if (self.player) {
-        [self.player pause];
-        [self.player.currentItem cancelPendingSeeks];
-        [self.player.currentItem.asset cancelLoading];
-        self.player = nil;
-    }
-}
-
-/**
- 还原历史数据
- */
-- (void)restoreRemoteMusic {
-    self.remoteMusics = [NSKeyedUnarchiver unarchiveObjectWithFile:tmpMusicPath];
-    
-}
-
-/**
- 存储历史数据
- */
-- (void)storeMusic {
-    for (AliyunMusicPickModel *model  in self.remoteMusics) {
-        model.expand = NO;
-    }
-    [NSKeyedArchiver archiveRootObject:self.remoteMusics toFile:tmpMusicPath];
-}
-
-/**
- 更新本地,远程选择的音乐
- */
-- (void)updateSelectedMusic{
-    if (self.selectedTab == 0) {
-        self.selectedMusic_remote = self.selectedMusic;
-    }else{
-        self.selectedMusic_local = self.selectedMusic;
-    }
-}
-// 支持设备自动旋转
-- (BOOL)shouldAutorotate
-{
-    return YES;
-}
-
-// 支持竖屏显示
-- (UIInterfaceOrientationMask)supportedInterfaceOrientations
-{
-    return UIInterfaceOrientationMaskPortrait;
-}
--(void)viewDidLayoutSubviews {
-    [super viewDidLayoutSubviews];
-    CGFloat offsetY = 0;
-    if (self.searchC.isActive) {
-        offsetY = 44 + 56;
-    }
-    CGFloat topViewY = SafeTop - offsetY;
-    self.topView.frame = CGRectMake(0, topViewY, ScreenWidth, 44);
-    self.tabView.frame = CGRectMake(0, 44 + topViewY, ScreenWidth, 44);
-    CGFloat tableY = 88 + SafeTop - offsetY;
-    self.tableView.frame = CGRectMake(0, tableY, ScreenWidth, self.view.bounds.size.height  - 30 - tableY-SafeAreaBottom);
-}
-
-- (void)setupSubviews {
-    
-    if (@available(iOS 11.0, *)) {
-        self.tableView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
-    } else {
-        self.automaticallyAdjustsScrollViewInsets = NO;
-    }
-    self.view.backgroundColor = [UIColor whiteColor];
-    
-    UIBlurEffect *blurEffect = [UIBlurEffect effectWithStyle:UIBlurEffectStyleDark];
-    UIVisualEffectView *blurEffectView = [[UIVisualEffectView alloc] initWithEffect:blurEffect];
-    blurEffectView.frame = CGRectMake(0, 0, ScreenWidth, ScreenHeight);
-    [self.view addSubview:blurEffectView];
-    
-    self.topView = [[AliyunMusicPickTopView alloc] initWithFrame:CGRectMake(0, 0, ScreenWidth, 44)];
-    self.topView.delegate = self;
-    [self.view addSubview:self.topView];
-    
-    self.tabView = [[AliyunMusicPickTabView alloc] initWithFrame:CGRectMake(0, 44+SafeTop, ScreenWidth, 44)];
-    self.tabView.delegate = self;
-    [self.view addSubview:self.tabView];
-    
-    self.tableView = [[UITableView alloc] initWithFrame:CGRectZero];
-    [self.tableView registerClass:[AliyunMusicPickCell class] forCellReuseIdentifier:@"AliyunMusicPickCell"];
-    [self.tableView registerClass:[AliyunMusicPickHeaderView class] forHeaderFooterViewReuseIdentifier:@"AliyunMusicPickHeaderView"];
-    [self.tableView registerClass:[UITableViewHeaderFooterView class] forHeaderFooterViewReuseIdentifier:@"UITableViewHeaderFooterView"];
-    
-    
-    self.tableView.backgroundColor = [UIColor clearColor];
-    self.tableView.separatorColor = [UIColor grayColor];
-    self.tableView.delegate = self;
-    self.tableView.dataSource = self;
-    self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
-    
-    //设置footerView
-    UIView *loadingView= [[UIView alloc] initWithFrame:CGRectMake(0, 0, ScreenWidth, 40)];
-    UIActivityIndicatorView *indicatorView = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhite];
-    [loadingView addSubview:indicatorView];
-    indicatorView.center = CGPointMake(ScreenWidth * 0.5, 20);
-    self.indicatorView = indicatorView;
-    self.tableView.tableFooterView = loadingView;
-    
-    [self.view addSubview:self.tableView];
-    
-    UITextView *textView = [[UITextView alloc] initWithFrame:CGRectMake(0, ScreenHeight-30-SafeAreaBottom, ScreenWidth, 30)];
-    [self.view addSubview:textView];
-    self.bottomTextView = textView;
-    
-    NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc] initWithString:NSLocalizedString(@"Provided by Taihe Music DMH  How to get", nil) attributes:@{
-                                                                                                                                                                                    NSForegroundColorAttributeName:[UIColor whiteColor],
-                                                                                                                                                                                    NSFontAttributeName:[UIFont systemFontOfSize:12]
-                                                                                                                                                                                    }];
-    [attributedString addAttributes:@{
-                                      NSLinkAttributeName:@"click://",
-                                      NSUnderlineStyleAttributeName:@(1)
-                                      } range:[[attributedString string] rangeOfString:NSLocalizedString(@"How to get", nil)]];
-    
-    
-    self.bottomTextView.attributedText = attributedString;
-    self.bottomTextView.linkTextAttributes = @{NSForegroundColorAttributeName:[AlivcUIConfig shared].kAVCThemeColor};
-    self.bottomTextView.backgroundColor = [UIColor clearColor];
-    self.bottomTextView.textAlignment = NSTextAlignmentCenter;
-    self.bottomTextView.delegate = self;
-    self.bottomTextView.editable = NO;        //必须禁止输入,否则点击将弹出输入键盘
-    self.bottomTextView.scrollEnabled = NO;
-    
-}
-
-
-/**
- 1.从工程加载数据源列表
- 2.本地数据库找到音乐,赋值工程加载的资源列表
- */
-- (void)fetchRemoteMusic {
-    
-    self.isLoading = YES;
-    self.indicatorView.hidden = NO;
-    [self.indicatorView startAnimating];
-    __weak typeof(self) weakSelf = self;
-    NSMutableArray *tmpMusic = [self musics];
-    
-}
-
-
-/**
- 根据传入的选中的音乐 获取选中音乐的位置
- 更新tableview的选中位置
- */
-- (void)setDefaultValue{
-    for (AliyunMusicPickModel *model in self.musics) {
-        if (self.selectedMusic_remote && [model.musicId isEqualToString:self.selectedMusic_remote.musicId] && model.isDBContain) {
-            NSInteger index = [self.musics indexOfObject:model];
-            //默认的初始值
-            self.selectedSection = index;
-            model.expand = YES;
-             _startTime = self.selectedMusic.startTime;
-            model.startTime = _startTime;
-            [self playCurrentItem];
-            //移动到选中的位置
-            dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
-                NSIndexPath *indexPath = [NSIndexPath indexPathForRow:0 inSection:index];
-                [self.tableView scrollToRowAtIndexPath:indexPath atScrollPosition:UITableViewScrollPositionMiddle animated:NO];
-            });
-            
-            break;
-        }
-    }
-}
-
-- (void)setLocalDefaultValue{
-    for (AliyunMusicPickModel *model in self.iTunesMusics) {
-        NSInteger index = [self.iTunesMusics indexOfObject:model];
-        if (self.selectedMusic_local && [self.selectedMusic_local.name isEqualToString:model.name]&&(index != 0)) {
-            //默认的初始值
-            self.selectedSection = index;
-            model.expand = YES;
-            _startTime = 0;
-            [self playCurrentItem];
-            //移动到选中的位置
-            dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
-                NSIndexPath *indexPath = [NSIndexPath indexPathForRow:0 inSection:index];
-                [self.tableView scrollToRowAtIndexPath:indexPath atScrollPosition:UITableViewScrollPositionMiddle animated:NO];
-            });
-            
-            break;
-        }
-    }
-}
-
-- (void)fetchItunesMusic {
-    if (self.iTunesMusics.count>1) {
-        [self.tableView reloadData];
-        [self setLocalDefaultValue];
-    }else{
-        //        [MBProgressHUD showHUDAddedTo:self.view animated:YES];
-        dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
-            
-            //获得query,用于请求本地歌曲集合
-            MPMediaQuery *query = [MPMediaQuery songsQuery];
-            //循环获取得到query获得的集合
-            dispatch_semaphore_t semaphore = dispatch_semaphore_create(1);
-            for (MPMediaItemCollection *conllection in query.collections) {
-                //MPMediaItem为歌曲项,包含歌曲信息
-                for (MPMediaItem *item in conllection.items) {
-                    AliyunMusicPickModel *model = [[AliyunMusicPickModel alloc] init];
-                    NSString *name = [item valueForProperty:MPMediaItemPropertyTitle];
-                    NSString *uid = [item valueForProperty:MPMediaItemPropertyPersistentID];
-                    NSURL *url = [item valueForProperty:MPMediaItemPropertyAssetURL];
-                    NSString *artist = [item valueForKey:MPMediaItemPropertyArtist];
-                    float duration = [[item valueForKey:MPMediaItemPropertyPlaybackDuration] floatValue];
-                    NSString *baseString = [[[AliyunPathManager createResourceDir] stringByAppendingPathComponent:@"musicRes"] stringByAppendingPathComponent:[NSString stringWithFormat:@"%@-%@", uid, name]];
-                    if (!url) {
-                        break;
-                    }
-                    if (!url.pathExtension) {
-                        break;
-                    }
-                    NSString *toString = [[baseString stringByAppendingPathComponent:@"music"] stringByAppendingPathExtension:url.pathExtension];
-                    //                NSArray *filePathArray = [toString componentsSeparatedByString:@"Documents/"];
-                    //                NSString *relativePath = [@"Documents/" stringByAppendingPathComponent:filePathArray.lastObject];
-                    model.name = name;
-                    model.path = toString;
-                    model.artist = artist;
-                    model.duration = duration;
-                    // 若拷贝音乐已经存在 则执行下一条拷贝
-                    if ([[NSFileManager defaultManager] fileExistsAtPath:baseString]) {
-                        [self.iTunesMusics addObject:model];
-                        dispatch_async(dispatch_get_main_queue(), ^{
-                            [self.tableView reloadData];
-                        });
-                    }else {
-                        dispatch_semaphore_wait(semaphore, DISPATCH_TIME_FOREVER);
-                        [[NSFileManager defaultManager] createDirectoryAtPath:baseString withIntermediateDirectories:YES attributes:nil error:nil];
-                        NSURL *toURL = [NSURL fileURLWithPath:toString];
-                        AliyunLibraryMusicImport* import = [[AliyunLibraryMusicImport alloc] init];
-                        [import importAsset:url toURL:toURL completionBlock:^(AliyunLibraryMusicImport* import) {
-                            [self.iTunesMusics addObject:model];
-                            dispatch_semaphore_signal(semaphore);
-                            dispatch_async(dispatch_get_main_queue(), ^{
-                                [self.tableView reloadData];
-                            });
-                        }];
-                    }
-                }
-            }
-            dispatch_async(dispatch_get_main_queue(), ^{
-                if (!self.selectedMusic_local) {
-                    self.selectedMusic = self.iTunesMusics.firstObject;
-                }
-                [self setLocalDefaultValue];
-                [[MBProgressHUD HUDForView:self.view] hideAnimated:YES];
-                [self.tableView reloadData];
-                self.iTunesMusics = [NSMutableArray arrayWithArray:self.iTunesMusics];
-            });
-            
-        });
-        
-    }
-    
-    
-}
-
-
-#pragma mark - notification
-
-- (void)addNotification {
-    [[NSNotificationCenter defaultCenter] addObserver:self
-                                             selector:@selector(playerItemDidReachEnd)
-                                                 name:AVPlayerItemDidPlayToEndTimeNotification
-                                               object:nil];
-    [[NSNotificationCenter defaultCenter] addObserver:self
-                                             selector:@selector(becomeActive)
-                                                 name:UIApplicationDidBecomeActiveNotification
-                                               object:nil];
-    [[NSNotificationCenter defaultCenter] addObserver:self
-                                             selector:@selector(resignActive)
-                                                 name:UIApplicationWillResignActiveNotification
-                                               object:nil];
-}
-
-- (void)becomeActive{
-    [self playCurrentItem];
-    
-}
-
-- (void)resignActive{
-    [self.player pause];
-}
-
-- (void)removeNotification {
-    [[NSNotificationCenter defaultCenter] removeObserver:self];
-}
-
-- (void)playerItemDidReachEnd {
-    [self playCurrentItem];
-}
-
-#pragma mark - player;
-
-- (void)playCurrentItem {
-    
-    if (self.selectedSection < self.musics.count) {
-        AliyunMusicPickModel *model = [self.musics[self.selectedSection] copy];
-        model.startTime = _startTime;
-        model.duration = _duration;
-        AVMutableComposition *composition = [self generateMusicWithPath:model.path start:_startTime duration:_duration];
-        [self.player replaceCurrentItemWithPlayerItem:[AVPlayerItem playerItemWithAsset:composition]];
-        [self.player play];
-        self.selectedMusic = model;
-        [self updateSelectedMusic];
-    }
-}
-
--(AVMutableComposition *)generateMusicWithPath:(NSString *)path start:(float)start duration:(float)duration {
-    if (!path) {
-        return nil;
-    }
-    AVURLAsset *asset = [AVURLAsset assetWithURL:[NSURL fileURLWithPath:path]];
-    AVMutableComposition *mutableComposition = [AVMutableComposition composition]; // Create the video composition track.
-    AVMutableCompositionTrack *mutableCompositionAudioTrack =[mutableComposition addMutableTrackWithMediaType:AVMediaTypeAudio preferredTrackID:kCMPersistentTrackID_Invalid];
-    NSArray *array = [asset tracksWithMediaType:AVMediaTypeAudio];
-    if (array.count > 0) {
-        AVAssetTrack *audioTrack = array[0];
-        CMTime startTime = CMTimeMake(1000*start, 1000);
-        CMTime stopTime = CMTimeMake(1000*(start+duration), 1000);
-        //    CMTimeRange range = CMTimeRangeMake(kCMTimeZero, CMTimeSubtract(stopTime, startTime));
-        CMTimeRange exportTimeRange = CMTimeRangeFromTimeToTime(startTime,stopTime);
-        [mutableCompositionAudioTrack insertTimeRange:exportTimeRange ofTrack:audioTrack atTime:kCMTimeZero error:nil];
-    }
-    
-    return mutableComposition;
-}
-
-#pragma mark - table view delegate
-
--(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section {
-    return 54;
-}
-
--(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
-    return 104;
-}
--(CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section {
-    return 0.5;
-}
-
-- (void)tableView:(UITableView *)tableView willDisplayFooterView:(UIView *)view forSection:(NSInteger)section{
-    if ([view isMemberOfClass:[UITableViewHeaderFooterView class]]) {
-        ((UITableViewHeaderFooterView *)view).backgroundView.backgroundColor = [UIColor clearColor];
-    }
-}
-
--(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
-    AliyunMusicPickModel *mode = self.musics[section];
-    if(mode.expand){
-        return 1;
-    }else {
-        return 0;
-    }
-}
-
--(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
-    
-    return self.musics.count;
-}
-
-
--(UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section {
-    UITableViewHeaderFooterView *view = [tableView dequeueReusableHeaderFooterViewWithIdentifier:@"UITableViewHeaderFooterView"];
-    view.backgroundColor = [UIColor redColor];
-    view.contentView.backgroundColor = [UIColor grayColor];
-    view.backgroundView.backgroundColor = [UIColor clearColor];
-    view.alpha = 1;
-    return view;
-}
-
--(UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {
-    AliyunMusicPickHeaderView *header = [tableView dequeueReusableHeaderFooterViewWithIdentifier:@"AliyunMusicPickHeaderView"];
-    //    AliyunMusicPickHeaderView *header = [[AliyunMusicPickHeaderView alloc]init];
-    if (section < self.musics.count) {
-        AliyunMusicPickModel *model = self.musics[section];
-        header.tag = section;
-        
-        header.delegate = self;
-        if (section == self.selectedSection) {
-            [header shouldExpand:YES];
-        }else {
-            [header shouldExpand:NO];
-        }
-        [header configWithModel:model];
-        NSLog(@"音乐下载测试-cell展示-%@-%ld",model.name,(long)section);
-    }
-    
-    return header;
-}
-
--(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
-    AliyunMusicPickCell *cell = [tableView dequeueReusableCellWithIdentifier:@"AliyunMusicPickCell"];
-    cell.delegate = self;
-    if (indexPath.section < self.musics.count) {
-        AliyunMusicPickModel *model = self.musics[indexPath.section];
-        [cell configureMusicDuration:model.duration pageDuration:_duration startTime:_startTime];
-        NSLog(@"展开的音乐时长:%f",model.duration);
-    }
-    
-    return cell;
-}
-
-
-- (void)tableView:(UITableView *)tableView didEndDisplayingCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath {
-    AliyunMusicPickCell *musicCell = (AliyunMusicPickCell *)cell;
-    [musicCell stopScroll];
-    
-}
-
-- (void)scrollViewDidScroll:(UIScrollView *)scrollView {
-    
-    CGFloat sectionHeaderHeight = 64;
-    if (scrollView.contentOffset.y<=sectionHeaderHeight&&scrollView.contentOffset.y>=0) {
-        scrollView.contentInset = UIEdgeInsetsMake(-scrollView.contentOffset.y, 0, 0, 0);
-    } else if (scrollView.contentOffset.y>=sectionHeaderHeight) {
-        scrollView.contentInset = UIEdgeInsetsMake(-sectionHeaderHeight, 0, 0, 0);
-    }
-    //当滑动快到底的时候 开始加载下一页
-    CGFloat contentSizeHeight = scrollView.contentSize.height;
-    CGFloat contentOffsetY = scrollView.contentOffset.y;
-    CGFloat scrollViewHeight = scrollView.frame.size.height;
-    
-    
-    if(contentSizeHeight - contentOffsetY - scrollViewHeight < 150) {
-        if (!self.isLoading && self.selectedTab == 0) {
-            [self loadMoreMusic];
-        }
-    }
-}
-
-
-- (void)loadMoreMusic{
-    [self fetchRemoteMusic];
-}
-#pragma mark - header view delegate
-
--(void)didSelectHeader:(AliyunMusicPickHeaderView *)view {
-    
-    if (self.selectedTab == 0) {
-        
-        AliyunMusicPickModel *model = self.musics[view.tag];
-        if (model.isDBContain||view.tag == 0) {
-            [self handle:view];
-            return;
-        }
-        //同时不能超过3个
-        if(self.downloadingMusics.count > 3){
-            [MBProgressHUD showMessage:@"同时下载个数超出限制" inView:self.view];
-            return;
-        }
-        //防止重复下载
-        for (AliyunMusicPickModel *downloadingModel in self.downloadingMusics) {
-            if (downloadingModel.keyId == model.keyId) {
-                [MBProgressHUD showMessage:@"此音乐正在下载,请耐心等待" inView:self.view];
-                return;
-            }
-        }
-        [self.downloadingMusics addObject:model];
-        //添加下载视图
-        [view updateDownloadViewWithFinish:NO];
-        NSLog(@"音乐下载测试点击:%@---%ld",model.name,(long)view.tag);
-        NSMutableDictionary *params = [NSMutableDictionary dictionary];
-        params[@"BusinessType"] = @"vodsdk";
-        params[@"TerminalType"] = @"pc";
-        params[@"DeviceModel"] = @"iPhone9,2";
-        params[@"UUID"] = @"59ECA-4193-4695-94DD-7E1247288";
-        params[@"AppVersion"] = @"1.0.0";
-        
-        NSString *playInfoGetString = [NSString stringWithFormat:@"{\"music_id\":\"%@\"}",model.musicId];
-        params[@"play_info_get"] = playInfoGetString;
-        
-        __block AliyunMusicPickHeaderView *weakView = view;
-        __block AliyunMusicPickViewController *weakSelf = self;
-        
-        
-    }else{
-        [self handle:view];
-    }
-}
-
-- (void)handle:(AliyunMusicPickHeaderView *)view{
-    if (!(self.selectedSection < self.musics.count)) {
-        return;
-    }
-    if (self.selectedSection >= 0 && view.tag != self.selectedSection) {
-        // OLD
-        AliyunMusicPickModel *model = self.musics[self.selectedSection];
-        model.expand = NO;
-        if (self.selectedSection > 0) {
-            [self.tableView reloadData];
-        }
-        
-        AliyunMusicPickHeaderView *headerView = (AliyunMusicPickHeaderView *)[self.tableView headerViewForSection:self.selectedSection];
-        [headerView shouldExpand:NO];
-        
-    }
-    if (view.tag != self.selectedSection) {
-        // NEW
-        self.selectedSection = view.tag;
-        AliyunMusicPickModel *model = self.musics[self.selectedSection];
-        if (self.selectedSection > 0) {
-            model.expand = YES;
-            [self.tableView reloadData];
-        }else {
-            [self.player pause];
-        }
-        
-        AliyunMusicPickHeaderView *headerView = (AliyunMusicPickHeaderView *)[self.tableView headerViewForSection:self.selectedSection];
-        [headerView shouldExpand:YES];
-        
-        _startTime = 0;
-        [self playCurrentItem];
-    }
-}
-- (AliyunDBHelper *)dbHelper {
-    
-    if (!_dbHelper) {
-        _dbHelper = [[AliyunDBHelper alloc] init];
-    }
-    return _dbHelper;
-}
-
-#pragma mark - cell delegate
-
--(void)didSelectStartTime:(CGFloat)startTime {
-    //    AliyunMusicPickModel *model = self.musics[_selectedSection];
-    _startTime = startTime;
-    //    model.startTime = startTime;
-    [self playCurrentItem];
-}
-
-
-#pragma mark - top view delegate
-
--(void)cancelButtonClicked {
-    [self.navigationController popViewControllerAnimated:YES];
-}
-
--(void)finishButtonClicked {
-    
-    
-    [self.player pause];
-    
-    
-    AliyunMusicPickModel *model = self.selectedMusic;
-    model.duration = _duration;
-    
-    [self.navigationController popViewControllerAnimated:YES];
-    if (self.delegate && [self.delegate respondsToSelector:@selector(didSelectMusic:tab:)]) {
-        [self.delegate didSelectMusic:model tab:self.selectedTab];
-    }
-    
-}
-
-#pragma mark - tab view delegate
-
--(void)didSelectTab:(NSInteger)tab {
-    self.selectedTab = tab;
-    [self.player pause];
-    //tableview 滑动到初始位置
-    self.tableView.contentOffset = CGPointMake(0, 0);
-    if (tab == 1) {
-        [self fetchItunesMusic];
-        self.bottomTextView.hidden = YES;
-        self.indicatorView.hidden = YES;
-    }else {
-        //判断是不是搜索模式
-        if (self.musics.count <= 1) {
-            //第一次进入页面请求首页数据
-            [self fetchRemoteMusic];
-        }else{
-            //第二次加载缓存数据
-            [self setDefaultValue];
-            
-            [self.tableView reloadData];
-        }
-        
-        self.bottomTextView.hidden = NO;
-    }
-}
-#pragma mark UITextVeiwDelegate
-
-- (BOOL)textView:(UITextView *)textView shouldInteractWithURL:(NSURL *)URL inRange:(NSRange)characterRange {
-    if ([[URL scheme] isEqualToString:@"click"]) {
-        NSLog(@"----click");
-        return NO;
-    }
-    return YES;
-}
-- (BOOL)textView:(UITextView *)textView shouldInteractWithURL:(NSURL *)URL inRange:(NSRange)characterRange interaction:(UITextItemInteraction)interaction NS_AVAILABLE_IOS(10_0){
-    if ([[URL scheme] isEqualToString:@"click"]) {
-        NSLog(@"----click");
-        return NO;
-    }
-    return YES;
-}
-
-#pragma mark - getter & setter
-
-- (AVPlayer *)player{
-    if (!_player) {
-        _player = [[AVPlayer alloc] init];
-    }
-    return _player;
-}
-
-- (NSMutableArray *)remoteMusics {
-    if (!_remoteMusics) {
-        _remoteMusics = [NSMutableArray array];
-        AliyunMusicPickModel *model = [[AliyunMusicPickModel alloc] init];
-        model.name = @"无音乐";
-        model.artist = @"V.A.";
-        [_remoteMusics addObject:model];
-    }
-    return _remoteMusics;
-}
-
-- (NSMutableArray *)iTunesMusics {
-    if (!_iTunesMusics) {
-        _iTunesMusics = [NSMutableArray array];
-        AliyunMusicPickModel *model = [[AliyunMusicPickModel alloc] init];
-        model.name = @"无音乐";
-        model.artist = @"V.A.";
-        [_iTunesMusics addObject:model];
-    }
-    return _iTunesMusics;
-}
-
-- (NSMutableArray *)musics {
-    if (self.selectedTab == 0) {
-        return self.remoteMusics;
-    }else{
-        return self.iTunesMusics;
-    }
-}
-
-//选中的音乐
-- (AliyunMusicPickModel *)selectedMusic{
-    if (self.selectedTab == 0) {
-        return self.selectedMusic_remote;
-    }else{
-        return self.selectedMusic_local;
-    }
-}
-
-- (void)setSelectedMusic:(AliyunMusicPickModel *)selectedMusic{
-    if (self.selectedTab == 0) {
-        self.selectedMusic_remote = selectedMusic;
-    }else{
-        self.selectedMusic_local = selectedMusic;
-    }
-}
-
-- (void)setSelectedSection:(NSInteger)selectedSection{
-    if (self.selectedTab == 0) {
-        self.selectedSection_remote = selectedSection;
-    }else{
-        self.selectedSection_local = selectedSection;
-    }
-}
-
-- (NSInteger)selectedSection{
-    if (self.selectedTab == 0) {
-        return self.selectedSection_remote;
-    }else{
-        return self.selectedSection_local;
-    }
-}
-
-- (UIView *)emptyTableViewHeader {
-    if (!_emptyTableViewHeader) {
-        _emptyTableViewHeader = [[UIView alloc] initWithFrame:CGRectMake(0, 0, ScreenWidth, 0.01)];
-    }
-    return _emptyTableViewHeader;
-}
-
-
-
-@end

+ 0 - 71
RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoFile/Common/MusicPick/Model/AliyunMusicPickModel.h

@@ -1,71 +0,0 @@
-//
-//  AliyunMusicPickModel.h
-//  qusdk
-//
-//  Created by Worthy on 2017/6/7.
-//  Copyright © 2017年 Alibaba Group Holding Limited. All rights reserved.
-//
-
-#import <UIKit/UIKit.h>
-
-@interface AliyunMusicPickModel : NSObject <NSCoding,NSCopying>
-
-/**
- 本地路径
- */
-@property (nonatomic, copy) NSString *path;
-
-/**
- 名称
- */
-@property (nonatomic, copy) NSString *name;
-
-/**
- 作者
- */
-@property (nonatomic, copy) NSString *artist;
-
-/**
- 开始时间 - 裁剪的时候的记录
- */
-@property (nonatomic, assign) CGFloat startTime;
-
-/**
- 时长
- */
-@property (nonatomic, assign) CGFloat duration;
-
-/**
- 下载进度
- */
-@property (nonatomic, assign) CGFloat downloadProgress;
-
-/**
- 是否是展开状态
- */
-@property (nonatomic, assign) BOOL expand;
-
-/**
- 音乐唯一标志符
- */
-@property (nonatomic, copy) NSString *musicId;
-
-/**
- 下载的时候作为唯一标志符
- */
-@property (assign, nonatomic) NSInteger keyId;
-
-/**
- 专辑的封面图片
- */
-@property (nonatomic, copy) NSString *image;
-
-/**
- 是否被包含在数据库中
- */
-@property (nonatomic, assign) BOOL isDBContain;
-
-
-- (instancetype)initWithDictionary:(NSDictionary *)dictionary;
-
-@end

+ 0 - 78
RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoFile/Common/MusicPick/Model/AliyunMusicPickModel.m

@@ -1,78 +0,0 @@
-//
-//  AliyunMusicPickModel.m
-//  qusdk
-//
-//  Created by Worthy on 2017/6/7.
-//  Copyright © 2017年 Alibaba Group Holding Limited. All rights reserved.
-//
-
-#import "AliyunMusicPickModel.h"
-#import <objc/runtime.h>
-@implementation AliyunMusicPickModel
-
-- (instancetype)initWithDictionary:(NSDictionary *)dictionary{
-    self = [super init];
-    if (self) {
-        //musicId
-        self.musicId = dictionary[@"musicId"];
-        //获取keyId
-        self.keyId = [[self.musicId substringFromIndex:self.musicId.length - 3] intValue];
-//        self.keyId = dictionary[@"musicId"];
-        //title
-        self.name = dictionary[@"title"];
-        //artistName
-        self.artist = dictionary[@"artistName"];
-        //duration
-        self.duration = [dictionary[@"duration"] floatValue];
-        //playPath
-        self.path = dictionary[@"playPath"];
-        //expireTime
-        self.image = dictionary[@"image"];
-    }
-    return self;
-}
-
-- (void)encodeWithCoder:(NSCoder *)aCoder {
-    //利用runtime 遍历所有的key
-    unsigned int count = 0;
-    objc_property_t *list = class_copyPropertyList([self class], &count);
-    for(int i = 0;i < count; i++) {
-        objc_property_t property = list[i];
-        NSString *key = [[NSString alloc] initWithCString:property_getName(property) encoding:NSUTF8StringEncoding];
-        id value = [self valueForKey:key];
-        [aCoder encodeObject:value forKey:key];
-    }
-    free(list);
-}
-
-- (instancetype)initWithCoder:(NSCoder *)aDecoder {
-    //利用runtime 遍历所有的key
-    if (self = [super init]) {
-        unsigned int count = 0;
-        objc_property_t *list = class_copyPropertyList([self class], &count);
-        for(int i = 0;i < count; i++) {
-            objc_property_t property = list[i];
-            NSString *key = [[NSString alloc] initWithCString:property_getName(property) encoding:NSUTF8StringEncoding];
-            id value = [aDecoder decodeObjectForKey:key];
-            [self setValue:value forKey:key];
-        }
-        free(list);
-    } 
-    return self;
-}
-
-
-- (id)copyWithZone:(NSZone *)zone {
-    AliyunMusicPickModel *musicPickModel = [[AliyunMusicPickModel allocWithZone:zone] init];
-    unsigned int count = 0;
-    objc_property_t *list = class_copyPropertyList([self class], &count);
-    for(int i = 0;i < count; i++) {
-        objc_property_t property = list[i];
-        NSString *key = [[NSString alloc] initWithCString:property_getName(property) encoding:NSUTF8StringEncoding];
-        id value = [self valueForKey:key];
-        [musicPickModel setValue:value forKey:key]; 
-    }
-    free(list);
-    return musicPickModel;
-}
-@end

+ 0 - 16
RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoFile/Common/MusicPick/View/AliyunMusicLineView.h

@@ -1,16 +0,0 @@
-//
-//  AliyunMusicLineView.h
-//  qusdk
-//
-//  Created by Worthy on 2017/6/8.
-//  Copyright © 2017年 Alibaba Group Holding Limited. All rights reserved.
-//
-
-#import <UIKit/UIKit.h>
-
-
-@interface AliyunMusicLineView : UIView
-@property (nonatomic, assign) long seed;
-
-- (void)refresh;
-@end

+ 0 - 58
RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoFile/Common/MusicPick/View/AliyunMusicLineView.m

@@ -1,58 +0,0 @@
-//
-//  AliyunMusicLineView.m
-//  qusdk
-//
-//  Created by Worthy on 2017/6/8.
-//  Copyright © 2017年 Alibaba Group Holding Limited. All rights reserved.
-//
-
-#import "AliyunMusicLineView.h"
-int AliyunMusicLineSeeds[40] =
-   {1,2,3,2,2,
-    3,4,4,3,5,
-    6,7,7,6,5,
-    4,3,4,5,4,
-    3,3,4,3,4,
-    2,3,5,6,7,
-    7,6,7,6,5,
-    4,3,2,2,2};
-
-@implementation AliyunMusicLineView
-
-- (id)initWithFrame:(CGRect)frame {
-    if (self = [super initWithFrame:frame]) {
-        [self setBackgroundColor:[UIColor clearColor]];
-        _seed = time(NULL);
-    }
-    return self;
-}
-
--(void)drawRect:(CGRect)rect {
-    srand((unsigned int)_seed);
-    CGFloat width = CGRectGetWidth(self.bounds);
-    CGFloat height = CGRectGetHeight(self.bounds);
-    CGFloat gap = 1;
-    CGFloat lineWidth = 3;
-    CGContextRef context = UIGraphicsGetCurrentContext();
-    CGContextSetStrokeColorWithColor(context, [UIColor groupTableViewBackgroundColor].CGColor);
-    CGContextSetLineWidth(context, lineWidth);
-    CGContextSetFillColorWithColor(context, [UIColor clearColor].CGColor);
-    CGContextFillRect(context, self.bounds);
-    int count = 0;
-    for (int offset = lineWidth; offset < (width-lineWidth); offset += (gap+lineWidth)) {
-        int seed = rand() % 10 + 1;
-//        int seed = AliyunMusicLineSeeds[count%40];
-        CGFloat lineHeight = seed/9.0f * height;
-        CGContextMoveToPoint(context, offset, (height-lineHeight)/2);
-        CGContextAddLineToPoint(context, offset, (height+lineHeight)/2);
-        CGContextStrokePath(context);
-        count ++;
-    }
-}
-
-- (void)refresh {
-    [self setNeedsDisplay];
-}
-
-
-@end

+ 0 - 25
RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoFile/Common/MusicPick/View/AliyunMusicPickCell.h

@@ -1,25 +0,0 @@
-//
-//  AliyunMusicPickCell.h
-//  qusdk
-//
-//  Created by Worthy on 2017/6/7.
-//  Copyright © 2017年 Alibaba Group Holding Limited. All rights reserved.
-//
-
-#import <UIKit/UIKit.h>
-#import "AliyunMusicLineView.h"
-
-@protocol AliyunMusicPickCellDelegate <NSObject>
-
-- (void)didSelectStartTime:(CGFloat)startTime;
-
-@end
-
-@interface AliyunMusicPickCell : UITableViewCell
-@property (nonatomic, weak) id<AliyunMusicPickCellDelegate> delegate;
-@property (nonatomic, strong) AliyunMusicLineView *lineView;
-@property (nonatomic, strong) UIScrollView *scrollView;
--(void)configureMusicDuration:(CGFloat)musicDuration pageDuration:(CGFloat)pageDuration startTime:(CGFloat)startTime;
--(void)playMusic;
-- (void)stopScroll;
-@end

+ 0 - 173
RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoFile/Common/MusicPick/View/AliyunMusicPickCell.m

@@ -1,173 +0,0 @@
-//
-//  AliyunMusicPickCell.m
-//  qusdk
-//
-//  Created by Worthy on 2017/6/7.
-//  Copyright © 2017年 Alibaba Group Holding Limited. All rights reserved.
-//
-
-#import "AliyunMusicPickCell.h"
-#import "AliyunMusicPickCoverView.h"
-#import "AlivcMacro.h"
-
-@interface AliyunMusicPickCell () <UIScrollViewDelegate>
-@property (nonatomic, assign) CGFloat musicDuration;
-@property (nonatomic, assign) CGFloat pageDuration;
-@property (nonatomic, assign) CGFloat startTime;
-@property (nonatomic, strong) UIView *fillLayer;
-@property (nonatomic, strong) UIBezierPath *overlayPath;
-@property (nonatomic, strong) UILabel *startLabel;
-@property (nonatomic, strong) UILabel *endLabel;
-@property (nonatomic, strong) AliyunMusicPickCoverView *coverView;
-@end
-
-@implementation AliyunMusicPickCell
-
-- (void)awakeFromNib {
-    [super awakeFromNib];
-    // Initialization code
-}
-
--(instancetype)initWithFrame:(CGRect)frame {
-    self = [super initWithFrame:frame];
-    if (self) {
-        [self setupSubviews];
-    }
-    return self;
-}
-
--(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
-    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
-    if (self) {
-        [self setupSubviews];
-    }
-    return self;
-}
-
--(instancetype)initWithCoder:(NSCoder *)aDecoder {
-    self = [super initWithCoder:aDecoder];
-    if (self) {
-        [self setupSubviews];
-    }
-    return self;
-}
-
-
-- (void)setupSubviews {
-    self.backgroundColor = [UIColor clearColor];
-    self.selectionStyle = UITableViewCellSelectionStyleNone;
-    self.scrollView = [[UIScrollView alloc] initWithFrame:self.bounds];
-    self.scrollView.backgroundColor = [UIColor clearColor];
-    self.scrollView.showsHorizontalScrollIndicator = NO;
-    self.scrollView.delegate = self;
-    self.scrollView.contentInset = UIEdgeInsetsMake(0, ScreenWidth/4, 0, ScreenWidth/4);
-    [self addSubview:self.scrollView];
-    self.lineView = [[AliyunMusicLineView alloc] initWithFrame:self.bounds];
-    [self.scrollView addSubview:self.lineView];
-    
-    
-    self.coverView = [[AliyunMusicPickCoverView alloc] initWithFrame:self.bounds];
-    [self addSubview:self.coverView];
-    
-    
-    _startLabel = [[UILabel alloc] initWithFrame:CGRectZero];
-    _startLabel.textColor = [UIColor whiteColor];
-    _startLabel.font = [UIFont systemFontOfSize:11];
-    _startLabel.textAlignment = NSTextAlignmentLeft;
-    [self addSubview:_startLabel];
-    _endLabel = [[UILabel alloc] initWithFrame:CGRectZero];
-    _endLabel.textColor = [UIColor whiteColor];
-    _endLabel.font = [UIFont systemFontOfSize:11];
-    _endLabel.textAlignment = NSTextAlignmentRight;
-    [self addSubview:_endLabel];
-}
-
--(void)layoutSubviews {
-    [super layoutSubviews];
-    [self layout];
-}
-
--(void)layout {
-    CGFloat height = CGRectGetHeight(self.bounds);
-    CGFloat width = CGRectGetWidth(self.bounds);
-    CGFloat factor = _musicDuration/_pageDuration > 1 ? _musicDuration/_pageDuration : 1;
-    CGFloat contentWidth = width/2 * factor;
-    self.scrollView.contentSize = CGSizeMake(contentWidth, height-48);
-    //offset 开始时间 /总时间 
-    self.scrollView.frame = CGRectMake(0, 8, width, height-48);
-    self.coverView.frame = CGRectMake(0, 8, width, height-48);
-    self.lineView.frame =  CGRectMake(0, 0, contentWidth, height-48);
-    self.startLabel.frame = CGRectMake(width/4, height-18, 36, 12);
-    self.endLabel.frame = CGRectMake(width/4*3-36, height-18, 36, 12);
-    self.scrollView.contentInset = UIEdgeInsetsMake(0, ScreenWidth/4, 0, ScreenWidth/4);
-    [self.lineView refresh];
-    CGFloat contentOffSetX = (_startTime * self.scrollView.contentSize.width /_musicDuration) - self.scrollView.contentInset.left;
-    [self.scrollView setContentOffset:CGPointMake(contentOffSetX, 0) animated:NO];
-}
-
--(void)configureMusicDuration:(CGFloat)musicDuration pageDuration:(CGFloat)pageDuration startTime:(CGFloat)startTime{
-    _pageDuration = pageDuration;
-    _musicDuration = musicDuration;
-    _startTime = roundf(startTime);
-    [self layout];
-    //设置初始值 开始时间 /总时间
-   
-//    CGFloat startTime = (_musicDuration * (self.scrollView.contentOffset.x + self.scrollView.contentInset.left)) / self.scrollView.contentSize.width;
-//    if (startTime < 0) {
-//        startTime = 0;
-//    }
-    
-    self.startLabel.text = [self timeFormatted:startTime];
-    self.endLabel.text = [self timeFormatted:startTime+_pageDuration];
-}
-
-- (void)playMusic{
-    [self updateCurrentTime];
-}
-
-#pragma mark - scroll view delegate
-
-
-
--(void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView {
-    [self updateCurrentTime];
-}
-
--(void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL)decelerate {
-    if (!decelerate) {
-        [self updateCurrentTime];
-    }
-    
-}
-
-- (void)updateCurrentTime {
-    CGFloat startTime = roundf((_musicDuration * (self.scrollView.contentOffset.x + self.scrollView.contentInset.left)) / self.scrollView.contentSize.width);
-    if (startTime < 0) {
-        startTime = 0;
-    }
-    self.startLabel.text = [self timeFormatted:startTime];
-    self.endLabel.text = [self timeFormatted:startTime+_pageDuration];
-    [self.delegate didSelectStartTime:startTime];
-}
-
-- (NSString *)timeFormatted:(int)totalSeconds {
-    int seconds = totalSeconds % 60;
-    int minutes = (totalSeconds / 60) % 60;
-    return [NSString stringWithFormat:@"%02d:%02d", minutes, seconds];
-}
-
-- (void)stopScroll {
-        CGPoint offset = self.scrollView.contentOffset;
-        
-        CGFloat minOffset = -self.scrollView.contentInset.left;
-        if (offset.x < minOffset) {
-            offset.x = minOffset;
-        }
-        CGFloat maxOffset = self.scrollView.contentSize.width - self.scrollView.bounds.size.width + ScreenWidth/4;
-        if (offset.x > maxOffset) {
-            offset.x = maxOffset;
-        }
-        
-        [self.scrollView setContentOffset:offset animated:NO];
-}
-@end

+ 0 - 13
RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoFile/Common/MusicPick/View/AliyunMusicPickCoverView.h

@@ -1,13 +0,0 @@
-//
-//  AliyunMusicPickCoverView.h
-//  qusdk
-//
-//  Created by Worthy on 2017/6/13.
-//  Copyright © 2017年 Alibaba Group Holding Limited. All rights reserved.
-//
-
-#import <UIKit/UIKit.h>
-
-@interface AliyunMusicPickCoverView : UIView
-
-@end

+ 0 - 64
RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoFile/Common/MusicPick/View/AliyunMusicPickCoverView.m

@@ -1,64 +0,0 @@
-//
-//  AliyunMusicPickCoverView.m
-//  qusdk
-//
-//  Created by Worthy on 2017/6/13.
-//  Copyright © 2017年 Alibaba Group Holding Limited. All rights reserved.
-//
-
-#import "AliyunMusicPickCoverView.h"
-#import "AVC_ShortVideo_Config.h"
-#import "AlivcMacro.h"
-
-@interface AliyunMusicPickCoverView()
-@property (nonatomic, strong) UIView *left;
-@property (nonatomic, strong) UIView *right;
-@property (nonatomic, strong) UIImageView *middle;
-@end
-
-@implementation AliyunMusicPickCoverView
-
--(instancetype)initWithFrame:(CGRect)frame {
-    self = [super initWithFrame:frame];
-    if (self) {
-        [self setupSubviews];
-    }
-    return self;
-}
-
--(instancetype)initWithCoder:(NSCoder *)aDecoder {
-    self = [super initWithCoder:aDecoder];
-    if (self) {
-        [self setupSubviews];
-    }
-    return self;
-}
-
-
--(void)layoutSubviews {
-    [super layoutSubviews];
-    [self layout];
-}
-
--(void)setupSubviews {
-    self.userInteractionEnabled = NO;
-    self.left = [[UIView alloc] initWithFrame:CGRectZero];
-    self.left.backgroundColor = rgba(0, 0, 0, 0.3);
-    [self addSubview:self.left];
-    self.middle = [[UIImageView alloc] initWithImage:[AliyunImage imageNamed:@"CropBox"]];
-    [self addSubview:self.middle];
-    self.right = [[UIView alloc] initWithFrame:CGRectZero];
-    self.right.backgroundColor = rgba(0, 0, 0, 0.3);
-    [self addSubview:self.right];
-    [self layout];
-}
-
-- (void)layout {
-    CGFloat width = CGRectGetWidth(self.frame);
-    CGFloat height = CGRectGetHeight(self.frame);
-    self.left.frame = CGRectMake(0, 0, width/4, height);
-    self.middle.frame = CGRectMake(width/4, 0, width/2, height);
-    self.right.frame = CGRectMake( width/4*3,0, width/4, height);
-}
-
-@end

+ 0 - 35
RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoFile/Common/MusicPick/View/AliyunMusicPickHeaderView.h

@@ -1,35 +0,0 @@
-//
-//  AliyunMusicPickHeaderView.h
-//  qusdk
-//
-//  Created by Worthy on 2017/6/7.
-//  Copyright © 2017年 Alibaba Group Holding Limited. All rights reserved.
-//
-
-#import <UIKit/UIKit.h>
-@class AliyunMusicPickHeaderView;
-@class AliyunMusicPickModel;
-@protocol AliyunMusicPickHeaderViewDelegate <NSObject>
-- (void)didSelectHeader:(AliyunMusicPickHeaderView *)view;
-@end
-
-@interface AliyunMusicPickHeaderView : UITableViewHeaderFooterView
-@property (nonatomic, weak) id<AliyunMusicPickHeaderViewDelegate> delegate;
-@property (nonatomic, strong) UIButton   *button;
-@property (nonatomic, strong) UIView     *line;
-@property (nonatomic, strong) UILabel    *titleLabel;
-@property (nonatomic, strong) UILabel    *artistLabel;
-@property (nonatomic, strong) UIImageView *imageView;
-
-- (void)configWithModel:(AliyunMusicPickModel *)model;
-
-- (void)shouldExpand:(BOOL)expand;
-
-- (void)updateDownloadViewWithFinish:(BOOL)finish;
-
-/**
- 设置字体label的位置大小
- */
-- (void)setTextLabelFrame;
-- (void)downloadProgress:(CGFloat)progress;
-@end

+ 0 - 137
RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoFile/Common/MusicPick/View/AliyunMusicPickHeaderView.m

@@ -1,137 +0,0 @@
-//
-//  AliyunMusicPickHeaderView.m
-//  qusdk
-//
-//  Created by Worthy on 2017/6/7.
-//  Copyright © 2017年 Alibaba Group Holding Limited. All rights reserved.
-//
-
-#import "AliyunMusicPickHeaderView.h"
-#import "AVC_ShortVideo_Config.h"
-#import "AlivcUIConfig.h"
-#import "UIView+Progress.h"
-#import "AliyunMusicPickModel.h"
-#import "AlivcMacro.h"
-
-@interface AliyunMusicPickHeaderView()
-@property (nonatomic,strong) UIView *pieView;
-@end
-@implementation AliyunMusicPickHeaderView
-
-- (instancetype)initWithReuseIdentifier:(NSString *)reuseIdentifier {
-    if (self = [super initWithReuseIdentifier:reuseIdentifier]) {
-        [self buildSubview];
-    }
-    
-    return self;
-}
-- (void)buildSubview {
-//    // 白色背景
-//    self.backgroundColor = [UIColor clearColor];
-//    self.backgroundView.backgroundColor = [UIColor clearColor];
-    UIView *contentView         = [[UIView alloc] initWithFrame:CGRectMake(0, 0, ScreenWidth,64)];
-    contentView.backgroundColor = [UIColor clearColor];
-    self.backgroundView = contentView;
-    
-//    self.line = [[UIView alloc] initWithFrame:CGRectMake(0, 0, ScreenWidth, 0.5)];
-//    self.line.backgroundColor = [UIColor whiteColor];
-//    [contentView addSubview:self.line];
-    
-    // 按钮
-    self.button = [[UIButton alloc] initWithFrame:CGRectMake(0, 0.5, ScreenWidth, 63)];
-    [self.button addTarget:self
-                    action:@selector(buttonEvent:)
-          forControlEvents:UIControlEventTouchUpInside];
-    self.button.backgroundColor = [UIColor clearColor];
-    [self addSubview:self.button];
-    
-    self.titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(64, 0.5, ScreenWidth, 40)];
-    self.titleLabel.textColor = [UIColor whiteColor];
-    self.titleLabel.font = [UIFont systemFontOfSize:17.0f];
-    [contentView addSubview:self.titleLabel];
-    
-    self.artistLabel = [[UILabel alloc] initWithFrame:CGRectMake(64, 40.5, ScreenWidth, 17)];
-    self.artistLabel.textColor = [UIColor whiteColor];
-    self.artistLabel.font = [UIFont systemFontOfSize:12.0f];
-    [contentView addSubview:self.artistLabel];
-    
-    self.imageView = [[UIImageView alloc] initWithFrame:CGRectMake(ScreenWidth - 36, 24, 16, 16)];    
-    self.imageView.hidden = YES;
-    [contentView addSubview:self.imageView];
-    
-    _pieView = [[UIView alloc] initWithFrame:self.imageView.frame];
-    [contentView addSubview:_pieView];
-    _pieView.backgroundColor = [UIColor clearColor];
-    [_pieView pieProgressView].progressColor = [UIColor colorWithRed:27.0/255 green:33.0/255 blue:51.0/255 alpha:0.8] ;
-    _pieView.hidden = YES;
-}
-
-
-- (void)configWithModel:(AliyunMusicPickModel *)model{
-    self.titleLabel.text = model.name;
-    self.artistLabel.text = model.artist;
-    [self setTextLabelFrame];
-    self.pieView.hidden = YES;
-    if (model.downloadProgress < 1 && model.downloadProgress > 0) {
-        [self.contentView addSubview:self.pieView];
-        [self downloadProgress:model.downloadProgress];
-    }else{
-        [self.pieView removeFromSuperview];
-    }
-    if ([model.name isEqualToString:@"无音乐"]) {
-        self.imageView.hidden = YES;
-    }
-}
-
-- (void)updateDownloadViewWithFinish:(BOOL)finish{
-    if (finish) {
-        [self.pieView removeFromSuperview];
-    }else{
-        [self.contentView addSubview:self.pieView];
-    }
-    
-}
-
-- (void)downloadProgress:(CGFloat)progress
-{
-    _pieView.hidden = NO;
-    [_pieView setPieProgress:progress];
-    if (progress == 1) {
-        _pieView.hidden = YES;
-    }
-}
-
-- (void)buttonEvent:(UIButton *)button {
-    if (self.delegate && [self.delegate respondsToSelector:@selector(didSelectHeader:)]) {
-        [self.delegate didSelectHeader:self];
-    }
-}
-
-- (void)shouldExpand:(BOOL)expand{
-    if (expand) {
-        self.imageView.hidden = NO;
-        self.titleLabel.textColor = [AlivcUIConfig shared].kAVCThemeColor;
-        self.artistLabel.textColor = [AlivcUIConfig shared].kAVCThemeColor;
-    }else {
-        self.imageView.hidden = YES;
-        self.titleLabel.textColor = [UIColor whiteColor];
-        self.artistLabel.textColor = [UIColor whiteColor];
-    }
-}
-
-- (void)setTextLabelFrame{
-    [self.titleLabel sizeToFit];
-    [self.artistLabel sizeToFit];
-    CGFloat cy = 27;
-    self.titleLabel.center = CGPointMake(self.titleLabel.frame.size.width / 2 + 8, cy);
-    CGFloat acx = CGRectGetMaxX(self.titleLabel.frame) + 8 + self.artistLabel.frame.size.width / 2;
-    self.artistLabel.center = CGPointMake(acx,cy);
-    CGFloat amx = CGRectGetMaxX(self.artistLabel.frame);
-    if (amx > [UIScreen mainScreen].bounds.size.width - 60) {
-        CGRect frame = self.artistLabel.frame;
-        frame.size.width = [UIScreen mainScreen].bounds.size.width - 60;
-        self.artistLabel.frame = frame;
-    }
-}
-
-@end

+ 0 - 23
RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoFile/Common/MusicPick/View/AliyunMusicPickTabView.h

@@ -1,23 +0,0 @@
-//
-//  AliyunMusicPickTabView.h
-//  qusdk
-//
-//  Created by Worthy on 2017/6/26.
-//  Copyright © 2017年 Alibaba Group Holding Limited. All rights reserved.
-//
-
-#import <UIKit/UIKit.h>
-
-@protocol AliyunMusicPickTabViewDelegate <NSObject>
-
-- (void)didSelectTab:(NSInteger)tab;
-
-@end
-
-@interface AliyunMusicPickTabView : UIView
-
-@property (nonatomic, weak) id<AliyunMusicPickTabViewDelegate> delegate;
-
-- (void)setSelectedTab:(NSInteger )tab;
-
-@end

+ 0 - 95
RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoFile/Common/MusicPick/View/AliyunMusicPickTabView.m

@@ -1,95 +0,0 @@
-//
-//  AliyunMusicPickTabView.m
-//  qusdk
-//
-//  Created by Worthy on 2017/6/26.
-//  Copyright © 2017年 Alibaba Group Holding Limited. All rights reserved.
-//
-
-#import "AliyunMusicPickTabView.h"
-#import "AlivcUIConfig.h"
-#import "AlivcMacro.h"
-
-@interface AliyunMusicPickTabView ()
-@property (nonatomic, strong) UIButton *leftButton;
-@property (nonatomic, strong) UIButton *rightButton;
-@property (nonatomic, strong) UIView *indicator;
-@end
-
-@implementation AliyunMusicPickTabView
--(instancetype)initWithFrame:(CGRect)frame {
-    self = [super initWithFrame:frame];
-    if (self) {
-        [self setupSubViews];
-    }
-    return self;
-}
-
--(instancetype)initWithCoder:(NSCoder *)aDecoder {
-    self = [super initWithCoder:aDecoder];
-    if (self) {
-        [self setupSubViews];
-    }
-    return self;
-}
-
-
-
-- (void)setupSubViews {
-    self.backgroundColor = [UIColor clearColor];
-    self.indicator = [[UIView alloc] init];
-    self.indicator.frame = CGRectMake(0, CGRectGetHeight(self.frame)-3, 30, 3);
-    self.indicator.backgroundColor = [AlivcUIConfig shared].kAVCThemeColor;
-    [self addSubview:self.indicator];
-    self.indicator.center = CGPointMake(ScreenWidth / 4, self.indicator.center.y);
-    
-    UIView *line = [[UIView alloc] initWithFrame:CGRectMake(0, CGRectGetHeight(self.frame)-0.5, ScreenWidth, 0.5)];
-    line.backgroundColor = [UIColor groupTableViewBackgroundColor];
-    [self addSubview:line];
-    
-    UIButton *leftButton = [UIButton buttonWithType:(UIButtonTypeCustom)];
-    leftButton.backgroundColor = [UIColor clearColor];
-    leftButton.frame = CGRectMake(0, 0, ScreenWidth/2, CGRectGetHeight(self.frame));
-    [leftButton setTitleColor:[UIColor whiteColor] forState:(UIControlStateNormal)];
-    [leftButton setTitle:@"在线音乐" forState:UIControlStateNormal];
-    leftButton.titleLabel.font = [UIFont systemFontOfSize:14.f];
-    leftButton.titleLabel.textAlignment = NSTextAlignmentCenter;
-    [leftButton addTarget:self action:@selector(leftButtonClicked) forControlEvents:(UIControlEventTouchUpInside)];
-    [self addSubview:leftButton];
-
-    
-    UIButton *rightButton = [UIButton buttonWithType:(UIButtonTypeCustom)];
-    rightButton.backgroundColor = [UIColor clearColor];
-    rightButton.frame = CGRectMake(ScreenWidth/2, 0, ScreenWidth/2, CGRectGetHeight(self.frame));
-    [rightButton setTitleColor:[UIColor whiteColor] forState:(UIControlStateNormal)];
-    [rightButton setTitle:@"本地音乐" forState:UIControlStateNormal];
-    rightButton.titleLabel.font = [UIFont systemFontOfSize:14.f];
-    rightButton.titleLabel.textAlignment = NSTextAlignmentCenter;
-    [rightButton addTarget:self action:@selector(rightButtonClicked) forControlEvents:(UIControlEventTouchUpInside)];
-    [self addSubview:rightButton];
-    
-}
-
-- (void)setSelectedTab:(NSInteger )tab{
-    if (tab == 0) {
-        [self leftButtonClicked];
-    }else{
-        [self rightButtonClicked];
-    }
-}
-
-- (void)leftButtonClicked {
-    [UIView animateWithDuration:0.24 animations:^{
-        self.indicator.center = CGPointMake(ScreenWidth / 4, self.indicator.center.y);
-    }];
-    [self.delegate didSelectTab:0];
-}
-
-- (void)rightButtonClicked {
-    [UIView animateWithDuration:0.24 animations:^{
-        self.indicator.center = CGPointMake(ScreenWidth / 4 * 3, self.indicator.center.y);
-    }];
-    [self.delegate didSelectTab:1];
-}
-
-@end

+ 0 - 19
RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoFile/Common/MusicPick/View/AliyunMusicPickTopView.h

@@ -1,19 +0,0 @@
-//
-//  AliyunMusicPickTopView.h
-//  qusdk
-//
-//  Created by Worthy on 2017/6/8.
-//  Copyright © 2017年 Alibaba Group Holding Limited. All rights reserved.
-//
-
-#import <UIKit/UIKit.h>
-@protocol AliyunMusicPickTopViewDelegate <NSObject>
--(void)cancelButtonClicked;
--(void)finishButtonClicked;
-@end
-
-@interface AliyunMusicPickTopView : UIView
-@property (nonatomic, weak) id<AliyunMusicPickTopViewDelegate> delegate;
-
-@property (nonatomic, strong) UILabel *nameLabel;
-@end

+ 0 - 68
RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoFile/Common/MusicPick/View/AliyunMusicPickTopView.m

@@ -1,68 +0,0 @@
-//
-//  AliyunMusicPickTopView.m
-//  qusdk
-//
-//  Created by Worthy on 2017/6/8.
-//  Copyright © 2017年 Alibaba Group Holding Limited. All rights reserved.
-//
-
-#import "AliyunMusicPickTopView.h"
-#import "AlivcMacro.h"
-
-@implementation AliyunMusicPickTopView
-
--(instancetype)initWithFrame:(CGRect)frame {
-    self = [super initWithFrame:frame];
-    if (self) {
-        [self setupTopViews];
-    }
-    return self;
-}
-
--(instancetype)initWithCoder:(NSCoder *)aDecoder {
-    self = [super initWithCoder:aDecoder];
-    if (self) {
-        [self setupTopViews];
-    }
-    return self;
-}
-
-
-
-- (void)setupTopViews {
-    self.backgroundColor = [UIColor clearColor];
-    
-    UIView *topView = [[UIView alloc] init];
-    topView.frame = CGRectMake(0, 0, ScreenWidth, 44);
-    [self addSubview:topView];
-    
-    UIButton *backButton = [UIButton buttonWithType:(UIButtonTypeCustom)];
-    backButton.frame = CGRectMake(0, 0, SizeWidth(28 + 12 + 12), CGRectGetHeight(topView.frame));
-    [backButton setImage:[UIImage imageNamed:@"avcBackIcon"] forState:UIControlStateNormal];
-    [backButton addTarget:self action:@selector(backButtonAction) forControlEvents:(UIControlEventTouchUpInside)];
-    [topView addSubview:backButton];
-    
-    self.nameLabel = [[UILabel alloc] init];
-    self.nameLabel.frame = CGRectMake(SizeWidth(132), 0, SizeWidth(56), 44);
-    self.nameLabel.font = [UIFont systemFontOfSize:15.f];
-    self.nameLabel.textColor = [UIColor whiteColor];
-    self.nameLabel.textAlignment = NSTextAlignmentCenter;
-    self.nameLabel.text = @"音乐";
-    [topView addSubview:self.nameLabel];
-    
-    UIButton *nextButton = [UIButton buttonWithType:(UIButtonTypeCustom)];
-    nextButton.frame = CGRectMake(ScreenWidth - SizeWidth(44), 0, SizeWidth(44), CGRectGetHeight(topView.frame));
-    [nextButton setImage:[UIImage imageNamed:@"edit_topic_pitchon"] forState:UIControlStateNormal];
-    [nextButton addTarget:self action:@selector(nextButtonAction) forControlEvents:(UIControlEventTouchUpInside)];
-    [topView addSubview:nextButton];
-    
-}
-
-- (void)backButtonAction {
-    [self.delegate cancelButtonClicked];
-}
-
-- (void)nextButtonAction {
-    [self.delegate finishButtonClicked];
-}
-@end

+ 45 - 70
RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoFile/VideoEdit/Controller/AliyunEditViewController.m

@@ -39,7 +39,6 @@
 #import "AVAsset+VideoInfo.h"
 #import "AliyunCustomFilter.h"
 #import "AliyunEffectFilterView.h"
-#import "AliyunMusicPickViewController.h"
 #import "AlivcMacro.h"
 #import "AlivcAlertView.h"
 #import "AliyunRateSelectView.h"
@@ -57,7 +56,7 @@ typedef enum : NSUInteger {
 
 // TODO:此类需再抽一层,否则会太庞大
 @interface AliyunEditViewController () <
-AliyunIExporterCallback, AliyunIPlayerCallback, AliyunMusicPickViewControllerDelegate>
+AliyunIExporterCallback, AliyunIPlayerCallback>
 {
     NSURLSessionDownloadTask *_downloadTask;
 }
@@ -100,7 +99,7 @@ AliyunIExporterCallback, AliyunIPlayerCallback, AliyunMusicPickViewControllerDel
 @property(nonatomic, strong) UIButton *speedButton;  //调速按钮
 
 @property(nonatomic, assign) AlivcEditVCStatus vcStatus;  //界面状态
-@property(nonatomic, strong) AliyunMusicPickModel *music; //之前应用的音乐
+@property(nonatomic, strong) NSString *curMusicUrl; //之前应用的音乐のUrl
 @property(nonatomic, assign) NSInteger tab; //之前应用的音乐的所属
 
 // 音量のView
@@ -366,6 +365,9 @@ AliyunIExporterCallback, AliyunIPlayerCallback, AliyunMusicPickViewControllerDel
     //从发布合成界面返回重新开始编辑并播放
     [self.editor startEdit];
     [self play];
+    
+    // 音乐按钮动效设置
+    [self changeMusicButtonStatus];
 }
 
 - (void)viewWillDisappear:(BOOL)animated {
@@ -402,6 +404,25 @@ AliyunIExporterCallback, AliyunIPlayerCallback, AliyunMusicPickViewControllerDel
     return YES;
 }
 
+// 改变音乐Btn的图片状态及动画效果
+- (void)changeMusicButtonStatus {
+    if(self.curMusicUrl && ![self.curMusicUrl isEqualToString:@""]){
+        // 添加动效
+        [_musicButton setImage:[UIImage imageNamed:@"video_ico_music_pre"] forState:UIControlStateNormal];
+        
+        CABasicAnimation *rotateAnimate = [CABasicAnimation animationWithKeyPath:@"transform.rotation.z"];
+        rotateAnimate.fromValue = @(0);
+        rotateAnimate.toValue = @(M_PI * 2);
+        rotateAnimate.repeatCount = NSIntegerMax;
+        rotateAnimate.duration = 35;
+        [_musicButton.imageView.layer addAnimation:rotateAnimate forKey:nil];
+        
+    }else{
+        [_musicButton setImage:_uiConfig.musicImage forState:UIControlStateNormal];
+        [_musicButton.imageView.layer removeAllAnimations];
+    }
+}
+
 #pragma mark - Getter
 - (UIButton *)playButton {
     if (!_playButton) {
@@ -614,8 +635,22 @@ AliyunIExporterCallback, AliyunIPlayerCallback, AliyunMusicPickViewControllerDel
 #pragma mark - Notification Action
 - (void)downloadMusicAndCombineNoti:(NSNotification *)noti {
     NSString *urlStr = noti.object;
-    NSLog(@"\n------receiveNoti.urlStr == %@", urlStr);
-    [self downloadFileFromServerWithUrlStr:urlStr];
+    self.curMusicUrl = urlStr;
+    
+    if ([urlStr isEqualToString:@""]) {
+        // 不选择音乐(清除编辑添加的音乐效果)
+        if (!self.hasRecordMusic) {
+            [self.editor removeMusics];
+        }
+        
+    } else {
+        [self downloadFileFromServerWithUrlStr:urlStr];
+    }
+    
+    // 音乐按钮动效设置
+    [self changeMusicButtonStatus];
+    
+    [self resume];
 }
 
 - (void)changeAudioVolumn:(NSNotification *)noti {
@@ -711,7 +746,6 @@ AliyunIExporterCallback, AliyunIPlayerCallback, AliyunMusicPickViewControllerDel
         NSLog(@"\n------下载音乐成功!path == %@", musicFilePath);
         
         
-        // FIXME: to be fixed
         AVURLAsset *asset = [AVURLAsset assetWithURL:[NSURL fileURLWithPath:musicFilePath]];
         CGFloat musicDuration = [asset avAssetVideoTrackDuration];
         
@@ -724,6 +758,10 @@ AliyunIExporterCallback, AliyunIPlayerCallback, AliyunMusicPickViewControllerDel
         effectMusic.startTime = 0;
         effectMusic.duration = musicDuration;
         [self.editor applyMusic:effectMusic];
+        
+        // 再次清除时将不保留原有音乐
+        self.hasRecordMusic = false;
+        [self resume];
     }];
     
     // 开始执行下载
@@ -1214,18 +1252,8 @@ AliyunIExporterCallback, AliyunIPlayerCallback, AliyunMusicPickViewControllerDel
 
 //音乐
 - (void)musicButtonClicked {
-    
-//    AliyunMusicPickViewController *vc =
-//    [[AliyunMusicPickViewController alloc] init];
-//    vc.duration = [self.player getDuration];
-//    vc.selectedMusic = self.music;
-//    vc.selectedTab = self.tab;
-//    vc.delegate = self;
-//    [self.navigationController pushViewController:vc animated:YES];
-    
     [self pause];
-    self.musicView = [PublishMusicChooseView publishMusicChooseViewWithAttachedView:self.view];
-    
+    self.musicView = [PublishMusicChooseView publishMusicChooseViewWithAttachedView:self.view curMusicUrl:self.curMusicUrl];
 }
 
 //时间特效
@@ -1241,59 +1269,6 @@ AliyunIExporterCallback, AliyunIPlayerCallback, AliyunMusicPickViewControllerDel
     [self.editor applyFilter:filter2];
 }
 
-#pragma mark - AliyunMusicPickViewControllerDelegate - 音乐 新
-
-- (void)didSelectMusic:(AliyunMusicPickModel *)music tab:(NSInteger)tab {
-    if ([music.name isEqualToString:@"无音乐"] || !music.path) {
-        [self.editor removeMusics];
-        //无音乐就是静音
-        if (self.hasRecordMusic) {
-            [self.editor setAudioMixWeight:100];
-        }
-        
-    } else {
-         //如果录制的时候有音乐 编辑的时候重新音乐 则播放新的音乐
-        if (self.hasRecordMusic) {
-            [self.editor setAudioMixWeight:100];
-        }
-        [self.editor removeMusics];
-        AliyunEffectMusic *effectMusic =[[AliyunEffectMusic alloc] initWithFile:music.path];
-        effectMusic.startTime = music.startTime;
-        effectMusic.duration = music.duration;
-        [self.editor applyMusic:effectMusic];
-    }
-    self.music = music;
-    self.tab = tab;
-    [self resume];
-}
-
-#pragma mark - AliyunEffectMusicViewDelegate - 音乐
-
-- (void)musicViewDidUpdateMute:(BOOL)mute {
-    [self.editor setMute:mute];
-}
-
-- (void)musicViewDidUpdateAudioMixWeight:(float)weight {
-    [self.editor setAudioMixWeight:weight * 100];
-}
-
-- (void)musicViewDidUpdateMusic:(NSString *)path
-                      startTime:(CGFloat)startTime
-                       duration:(CGFloat)duration
-                    streamStart:(CGFloat)streamStart
-                 streamDuration:(CGFloat)streamDuration {
-    AliyunEffectMusic *music = [[AliyunEffectMusic alloc] initWithFile:path];
-    music.startTime = startTime;
-    music.duration = duration;
-    music.streamStartTime = streamStart * [_player getStreamDuration];
-    music.streamDuration = streamDuration * [_player getStreamDuration];
-    [self.editor removeMVMusic];
-    [self.editor removeMusics];
-    [self.editor applyMusic:music];
-    [self resume];
-    [self.playButton setSelected:NO];
-}
-
 #pragma mark - AliyunEffectTimeFilterDelegate - 时间特效
 /**
  改变播放速率

+ 24 - 11
RainbowPlanet/RainbowPlanet/Modules/PublishModule/PublishMusicAbout/PublishMusicChooseView.swift

@@ -19,6 +19,8 @@ class PublishMusicChooseView: FWPopupView {
     typealias RecommendClosure = () -> Void
     var recommendClosure : RecommendClosure?
     
+    var curMusicUrl: String?
+    
     override init(frame: CGRect) {
         super.init(frame: frame)
         setupViews()
@@ -235,9 +237,10 @@ class PublishMusicChooseView: FWPopupView {
     }()
     
     /// 初始化View
-    @objc class func publishMusicChooseView(attachedView:UIView) -> PublishMusicChooseView {
+    @objc class func publishMusicChooseView(attachedView:UIView, curMusicUrl:String) -> PublishMusicChooseView {
         let view = PublishMusicChooseView()
         view.attachedView = attachedView
+        view.curMusicUrl = curMusicUrl
         let vProperty = FWPopupViewProperty()
         vProperty.popupCustomAlignment = .bottomCenter
         vProperty.popupViewEdgeInsets = UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 0)
@@ -320,28 +323,38 @@ extension PublishMusicChooseView :JXSegmentedListContainerViewDataSource {
     }
     func listContainerView(_ listContainerView: JXSegmentedListContainerView, initListAt index: Int) -> JXSegmentedListContainerViewListDelegate {
         let listVc = PublishMusicListController()
+        listVc.curMusicUrl = self.curMusicUrl
         if index == 0 {
             listVc.isReccomendList = true
         } else {
             listVc.categoryItemMdl = categoryListMdlArr![index-1]
         }
         listVc.playMusicClosure = {
-            (musicUrl) in
-            MusicPlayManager.shared().initPlay()
-            MusicPlayManager.shared().audioUrl = musicUrl
-            MusicPlayManager.shared().playAudio()
+            [weak self] (musicUrl) in
+            if musicUrl == "" {
+                // 点击了不选择音乐
+                self?.chooseMusicAction(musicUrl)
+            } else {
+                MusicPlayManager.shared().initPlay()
+                MusicPlayManager.shared().audioUrl = musicUrl
+                MusicPlayManager.shared().playAudio()
+            }
         }
         listVc.chooseMusicClosure = {
             [weak self] (musicUrl) in
-            NotificationCenter.default.post(name: NSNotification.Name(rawValue: "DownloadMusicAndCombineNoti"), object: musicUrl)
-            NotificationCenter.default.post(name: NSNotification.Name(rawValue: "EditCloseMusicChooseViewNoti"), object: nil)
-            
-            MusicPlayManager.shared().destroyPlayer()
-            MusicPlayManager.shared().curPlayingId = -1
-            self?.hide()
+            self?.chooseMusicAction(musicUrl)
         }
         return listVc
     }
+    
+    func chooseMusicAction(_ musicUrl: String) {
+        NotificationCenter.default.post(name: NSNotification.Name(rawValue: "DownloadMusicAndCombineNoti"), object: musicUrl)
+        NotificationCenter.default.post(name: NSNotification.Name(rawValue: "EditCloseMusicChooseViewNoti"), object: nil)
+        
+        MusicPlayManager.shared().destroyPlayer()
+        MusicPlayManager.shared().curPlayingId = -1
+        self.hide()
+    }
 }
 
 // MARK: - 网络请求

+ 13 - 3
RainbowPlanet/RainbowPlanet/Modules/PublishModule/PublishMusicAbout/PublishMusicVolumnView.swift

@@ -195,6 +195,11 @@ class PublishMusicVolumnView: FWPopupView {
         
         let sliderRate = (slider?.value ?? 0.0) / (slider?.maximumValue ?? 0.0)
         self.originVolumn = sliderRate
+        
+//        var paraDic = Dictionary<String, Any>()
+//        paraDic.updateValue(self.originVolumn*100, forKey: "origin")
+//        paraDic.updateValue(self.backVolumn*100, forKey: "back")
+//        NotificationCenter.default.post(name: NSNotification.Name(rawValue: "ChangeAudioVolumnNoti"), object: paraDic)
     }
     
     @objc func backValueChanged(_ sender: Any?) {
@@ -202,6 +207,11 @@ class PublishMusicVolumnView: FWPopupView {
         
         let sliderRate = (slider?.value ?? 0.0) / (slider?.maximumValue ?? 0.0)
         self.backVolumn = sliderRate
+        
+//        var paraDic = Dictionary<String, Any>()
+//        paraDic.updateValue(self.originVolumn*100, forKey: "origin")
+//        paraDic.updateValue(self.backVolumn*100, forKey: "back")
+//        NotificationCenter.default.post(name: NSNotification.Name(rawValue: "ChangeAudioVolumnNoti"), object: paraDic)
     }
     
     /// 初始化View
@@ -232,9 +242,9 @@ class PublishMusicVolumnView: FWPopupView {
         }).disposed(by: view.disposeBag)
         
         view.musicButton.rx.tap.subscribe(onNext: { (data) in            
-            view.hide(popupDidDisappearBlock: { (view1) in
-                _ = PublishMusicChooseView.publishMusicChooseView(attachedView: attachedView)
-            })
+//            view.hide(popupDidDisappearBlock: { (view1) in
+//                _ = PublishMusicChooseView.publishMusicChooseView(attachedView: attachedView)
+//            })
             
         }).disposed(by: view.disposeBag)
         

+ 0 - 1
RainbowPlanet/RainbowPlanet/Modules/PublishModule/PublishMusicAbout/PublishRecordMusicView.swift

@@ -266,7 +266,6 @@ extension PublishRecordMusicView :JXSegmentedListContainerViewDataSource {
                 MusicPlayManager.shared().audioUrl = musicUrl
                 MusicPlayManager.shared().playAudio()
             }
-            
         }
         listVc.chooseMusicClosure = {
             [weak self] (musicUrl) in