Procházet zdrojové kódy

Merge branch 'develop' into feature/jeremy

南鑫林 před 5 roky
rodič
revize
e518f82003
19 změnil soubory, kde provedl 824 přidání a 836 odebrání
  1. 20 18
      RainbowPlanet/RainbowPlanet.xcodeproj/project.pbxproj
  2. 107 0
      RainbowPlanet/RainbowPlanet/Manager/MusicPlayManager/MusicPlayManager.swift
  3. 4 0
      RainbowPlanet/RainbowPlanet/Model/CommunityModel/CommunityRecommendMusicListModel.swift
  4. 5 146
      RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoFile/Common/MusicPick/AliyunMusicPickViewController.m
  5. 0 37
      RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoFile/Common/ResourceManager/Manager/AliyunResourceDownloadManager.h
  6. 0 274
      RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoFile/Common/ResourceManager/Manager/AliyunResourceDownloadManager.m
  7. 0 47
      RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoFile/Common/ResourceManager/Manager/AliyunResourceRequestManager.h
  8. 0 116
      RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoFile/Common/ResourceManager/Manager/AliyunResourceRequestManager.m
  9. 0 27
      RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoFile/Common/ResourceManager/Models/AliyunPage.h
  10. 0 83
      RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoFile/Common/ResourceManager/Models/AliyunPage.m
  11. 85 17
      RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoFile/VideoEdit/Controller/AliyunEditViewController.m
  12. 95 8
      RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoFile/VideoRecord/Controller/AliyunMagicCameraViewController.m
  13. 33 0
      RainbowPlanet/RainbowPlanet/Modules/PublishModule/PublishMusicAbout/PublishAgreementController.swift
  14. 51 36
      RainbowPlanet/RainbowPlanet/Modules/PublishModule/PublishMusicAbout/PublishMusicChooseView.swift
  15. 21 7
      RainbowPlanet/RainbowPlanet/Modules/PublishModule/PublishMusicAbout/PublishMusicListCell.swift
  16. 55 3
      RainbowPlanet/RainbowPlanet/Modules/PublishModule/PublishMusicAbout/PublishMusicListController.swift
  17. 28 17
      RainbowPlanet/RainbowPlanet/Modules/PublishModule/PublishMusicAbout/PublishMusicVolumnView.swift
  18. 36 0
      RainbowPlanet/RainbowPlanet/Modules/PublishModule/PublishMusicAbout/PublishRecommendMusicController.swift
  19. 284 0
      RainbowPlanet/RainbowPlanet/Modules/PublishModule/PublishMusicAbout/PublishRecordMusicView.swift

+ 20 - 18
RainbowPlanet/RainbowPlanet.xcodeproj/project.pbxproj

@@ -490,6 +490,7 @@
 		BD10FC0222C6F9770096A34E /* AlivcShortVideoUploadManager.m in Sources */ = {isa = PBXBuildFile; fileRef = BD10FC0022C6F9770096A34E /* AlivcShortVideoUploadManager.m */; };
 		BD10FC0522C6F9880096A34E /* AliyunSVideoApi.m in Sources */ = {isa = PBXBuildFile; fileRef = BD10FC0322C6F9870096A34E /* AliyunSVideoApi.m */; };
 		BD10FC0822C748DA0096A34E /* AlivcAlertView.m in Sources */ = {isa = PBXBuildFile; fileRef = BD10FC0622C748D90096A34E /* AlivcAlertView.m */; };
+		BD11D64222E02520008FFA58 /* MusicPlayManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = BD11D64122E02520008FFA58 /* MusicPlayManager.swift */; };
 		BD12203622AF807C0051C7C2 /* MessagePlanetActivityController.swift in Sources */ = {isa = PBXBuildFile; fileRef = BD12203522AF807C0051C7C2 /* MessagePlanetActivityController.swift */; };
 		BD12203A22AF80AD0051C7C2 /* MessageActivityTableCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = BD12203922AF80AD0051C7C2 /* MessageActivityTableCell.swift */; };
 		BD12203F22AF8E190051C7C2 /* MessagePlanetNotiController.swift in Sources */ = {isa = PBXBuildFile; fileRef = BD12203E22AF8E190051C7C2 /* MessagePlanetNotiController.swift */; };
@@ -566,6 +567,8 @@
 		BD477F6322C23D66008BE2CB /* AliyunReachability.m in Sources */ = {isa = PBXBuildFile; fileRef = BD477F6222C23D66008BE2CB /* AliyunReachability.m */; };
 		BD4B50AC22BC7DEA0073B516 /* FilterResource.bundle in Resources */ = {isa = PBXBuildFile; fileRef = BD4B50AB22BC7DEA0073B516 /* FilterResource.bundle */; };
 		BD4B50AE22BC815F0073B516 /* PublishFilterCollectionCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = BD4B50AD22BC815F0073B516 /* PublishFilterCollectionCell.swift */; };
+		BD50F47022E157F50077D4BF /* PublishRecordMusicView.swift in Sources */ = {isa = PBXBuildFile; fileRef = BD50F46F22E157F50077D4BF /* PublishRecordMusicView.swift */; };
+		BD50F47222E158FB0077D4BF /* PublishAgreementController.swift in Sources */ = {isa = PBXBuildFile; fileRef = BD50F47122E158FB0077D4BF /* PublishAgreementController.swift */; };
 		BD5CA89222DD73A500364A67 /* PublishMusicVolumnView.swift in Sources */ = {isa = PBXBuildFile; fileRef = BD5CA89122DD73A500364A67 /* PublishMusicVolumnView.swift */; };
 		BD5CA89522DDA2A100364A67 /* CustomSlider.swift in Sources */ = {isa = PBXBuildFile; fileRef = BD5CA89422DDA2A100364A67 /* CustomSlider.swift */; };
 		BD61225422C355C800D3F513 /* AliyunMagicCameraViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = BD61225322C355C800D3F513 /* AliyunMagicCameraViewController.m */; };
@@ -581,11 +584,8 @@
 		BD61227822C35C1000D3F513 /* AlivcShortVideoRoute.m in Sources */ = {isa = PBXBuildFile; fileRef = BD61227622C35C1000D3F513 /* AlivcShortVideoRoute.m */; };
 		BD61227C22C35C7F00D3F513 /* AliyunMediaConfig.m in Sources */ = {isa = PBXBuildFile; fileRef = BD61227A22C35C7E00D3F513 /* AliyunMediaConfig.m */; };
 		BD61229322C3605C00D3F513 /* AliyunEffectResourceModel.m in Sources */ = {isa = PBXBuildFile; fileRef = BD61227F22C3605B00D3F513 /* AliyunEffectResourceModel.m */; };
-		BD61229422C3605C00D3F513 /* AliyunPage.m in Sources */ = {isa = PBXBuildFile; fileRef = BD61228222C3605B00D3F513 /* AliyunPage.m */; };
 		BD61229522C3605C00D3F513 /* AliyunEffectModelTransManager.m in Sources */ = {isa = PBXBuildFile; fileRef = BD61228422C3605B00D3F513 /* AliyunEffectModelTransManager.m */; };
-		BD61229622C3605C00D3F513 /* AliyunResourceRequestManager.m in Sources */ = {isa = PBXBuildFile; fileRef = BD61228822C3605B00D3F513 /* AliyunResourceRequestManager.m */; };
 		BD61229722C3605C00D3F513 /* AliyunEffectPrestoreManager.m in Sources */ = {isa = PBXBuildFile; fileRef = BD61228922C3605B00D3F513 /* AliyunEffectPrestoreManager.m */; };
-		BD61229822C3605C00D3F513 /* AliyunResourceDownloadManager.m in Sources */ = {isa = PBXBuildFile; fileRef = BD61228A22C3605B00D3F513 /* AliyunResourceDownloadManager.m */; };
 		BD61229922C3605C00D3F513 /* AliyunDBHelper.m in Sources */ = {isa = PBXBuildFile; fileRef = BD61228B22C3605B00D3F513 /* AliyunDBHelper.m */; };
 		BD61229A22C3605C00D3F513 /* AliyunEffectFilterCell.m in Sources */ = {isa = PBXBuildFile; fileRef = BD61229022C3605B00D3F513 /* AliyunEffectFilterCell.m */; };
 		BD61229B22C3605C00D3F513 /* AliyunEffectFilterCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = BD61229122C3605B00D3F513 /* AliyunEffectFilterCell.xib */; };
@@ -1226,6 +1226,7 @@
 		BD10FC0422C6F9870096A34E /* AliyunSVideoApi.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AliyunSVideoApi.h; sourceTree = "<group>"; };
 		BD10FC0622C748D90096A34E /* AlivcAlertView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AlivcAlertView.m; sourceTree = "<group>"; };
 		BD10FC0722C748DA0096A34E /* AlivcAlertView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AlivcAlertView.h; sourceTree = "<group>"; };
+		BD11D64122E02520008FFA58 /* MusicPlayManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MusicPlayManager.swift; sourceTree = "<group>"; };
 		BD12203522AF807C0051C7C2 /* MessagePlanetActivityController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MessagePlanetActivityController.swift; sourceTree = "<group>"; };
 		BD12203922AF80AD0051C7C2 /* MessageActivityTableCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MessageActivityTableCell.swift; sourceTree = "<group>"; };
 		BD12203E22AF8E190051C7C2 /* MessagePlanetNotiController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MessagePlanetNotiController.swift; sourceTree = "<group>"; };
@@ -1307,6 +1308,8 @@
 		BD477F6222C23D66008BE2CB /* AliyunReachability.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AliyunReachability.m; sourceTree = "<group>"; };
 		BD4B50AB22BC7DEA0073B516 /* FilterResource.bundle */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.plug-in"; path = FilterResource.bundle; sourceTree = "<group>"; };
 		BD4B50AD22BC815F0073B516 /* PublishFilterCollectionCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PublishFilterCollectionCell.swift; sourceTree = "<group>"; };
+		BD50F46F22E157F50077D4BF /* PublishRecordMusicView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PublishRecordMusicView.swift; sourceTree = "<group>"; };
+		BD50F47122E158FB0077D4BF /* PublishAgreementController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PublishAgreementController.swift; sourceTree = "<group>"; };
 		BD5CA89122DD73A500364A67 /* PublishMusicVolumnView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PublishMusicVolumnView.swift; sourceTree = "<group>"; };
 		BD5CA89422DDA2A100364A67 /* CustomSlider.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CustomSlider.swift; sourceTree = "<group>"; };
 		BD61225222C355C800D3F513 /* AliyunMagicCameraViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AliyunMagicCameraViewController.h; sourceTree = "<group>"; };
@@ -1335,19 +1338,13 @@
 		BD61227A22C35C7E00D3F513 /* AliyunMediaConfig.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AliyunMediaConfig.m; sourceTree = "<group>"; };
 		BD61227B22C35C7E00D3F513 /* AliyunMediaConfig.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AliyunMediaConfig.h; sourceTree = "<group>"; };
 		BD61227F22C3605B00D3F513 /* AliyunEffectResourceModel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AliyunEffectResourceModel.m; sourceTree = "<group>"; };
-		BD61228022C3605B00D3F513 /* AliyunPage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AliyunPage.h; sourceTree = "<group>"; };
 		BD61228122C3605B00D3F513 /* AliyunEffectResourceModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AliyunEffectResourceModel.h; sourceTree = "<group>"; };
-		BD61228222C3605B00D3F513 /* AliyunPage.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AliyunPage.m; sourceTree = "<group>"; };
 		BD61228422C3605B00D3F513 /* AliyunEffectModelTransManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AliyunEffectModelTransManager.m; sourceTree = "<group>"; };
-		BD61228522C3605B00D3F513 /* AliyunResourceDownloadManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AliyunResourceDownloadManager.h; sourceTree = "<group>"; };
 		BD61228622C3605B00D3F513 /* AliyunDBHelper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AliyunDBHelper.h; sourceTree = "<group>"; };
 		BD61228722C3605B00D3F513 /* AliyunEffectPrestoreManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AliyunEffectPrestoreManager.h; sourceTree = "<group>"; };
-		BD61228822C3605B00D3F513 /* AliyunResourceRequestManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AliyunResourceRequestManager.m; sourceTree = "<group>"; };
 		BD61228922C3605B00D3F513 /* AliyunEffectPrestoreManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AliyunEffectPrestoreManager.m; sourceTree = "<group>"; };
-		BD61228A22C3605B00D3F513 /* AliyunResourceDownloadManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AliyunResourceDownloadManager.m; sourceTree = "<group>"; };
 		BD61228B22C3605B00D3F513 /* AliyunDBHelper.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AliyunDBHelper.m; sourceTree = "<group>"; };
 		BD61228C22C3605B00D3F513 /* AliyunEffectModelTransManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AliyunEffectModelTransManager.h; sourceTree = "<group>"; };
-		BD61228D22C3605B00D3F513 /* AliyunResourceRequestManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AliyunResourceRequestManager.h; sourceTree = "<group>"; };
 		BD61229022C3605B00D3F513 /* AliyunEffectFilterCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AliyunEffectFilterCell.m; sourceTree = "<group>"; };
 		BD61229122C3605B00D3F513 /* AliyunEffectFilterCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = AliyunEffectFilterCell.xib; sourceTree = "<group>"; };
 		BD61229222C3605B00D3F513 /* AliyunEffectFilterCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AliyunEffectFilterCell.h; sourceTree = "<group>"; };
@@ -2331,6 +2328,7 @@
 				A72A730522321F1D00B21995 /* PayManager */,
 				A72A726122321DBD00B21995 /* MapManager */,
 				A72A726422321DBD00B21995 /* UMManager */,
+				BD11D64022E024DC008FFA58 /* MusicPlayManager */,
 			);
 			path = Manager;
 			sourceTree = "<group>";
@@ -4720,6 +4718,14 @@
 			path = HGImagePicker;
 			sourceTree = "<group>";
 		};
+		BD11D64022E024DC008FFA58 /* MusicPlayManager */ = {
+			isa = PBXGroup;
+			children = (
+				BD11D64122E02520008FFA58 /* MusicPlayManager.swift */,
+			);
+			path = MusicPlayManager;
+			sourceTree = "<group>";
+		};
 		BD12203222AF803A0051C7C2 /* MessagePlanetActivity */ = {
 			isa = PBXGroup;
 			children = (
@@ -5145,10 +5151,12 @@
 			isa = PBXGroup;
 			children = (
 				BDBC0AF122DDD7E800CA788E /* PublishMusicChooseView.swift */,
+				BD50F46F22E157F50077D4BF /* PublishRecordMusicView.swift */,
 				BDD9377622DF3B47002D11B3 /* PublishMusicListController.swift */,
 				BDD9377422DEF371002D11B3 /* PublishMusicListCell.swift */,
 				BD5CA89122DD73A500364A67 /* PublishMusicVolumnView.swift */,
 				BDBC0AF522DDEA4E00CA788E /* PublishRecommendMusicController.swift */,
+				BD50F47122E158FB0077D4BF /* PublishAgreementController.swift */,
 			);
 			path = PublishMusicAbout;
 			sourceTree = "<group>";
@@ -5275,8 +5283,6 @@
 		BD61227E22C3605B00D3F513 /* Models */ = {
 			isa = PBXGroup;
 			children = (
-				BD61228022C3605B00D3F513 /* AliyunPage.h */,
-				BD61228222C3605B00D3F513 /* AliyunPage.m */,
 				BD61228122C3605B00D3F513 /* AliyunEffectResourceModel.h */,
 				BD61227F22C3605B00D3F513 /* AliyunEffectResourceModel.m */,
 			);
@@ -5290,10 +5296,6 @@
 				BD61228B22C3605B00D3F513 /* AliyunDBHelper.m */,
 				BD61228722C3605B00D3F513 /* AliyunEffectPrestoreManager.h */,
 				BD61228922C3605B00D3F513 /* AliyunEffectPrestoreManager.m */,
-				BD61228D22C3605B00D3F513 /* AliyunResourceRequestManager.h */,
-				BD61228822C3605B00D3F513 /* AliyunResourceRequestManager.m */,
-				BD61228522C3605B00D3F513 /* AliyunResourceDownloadManager.h */,
-				BD61228A22C3605B00D3F513 /* AliyunResourceDownloadManager.m */,
 				BD61228C22C3605B00D3F513 /* AliyunEffectModelTransManager.h */,
 				BD61228422C3605B00D3F513 /* AliyunEffectModelTransManager.m */,
 			);
@@ -6000,6 +6002,7 @@
 				A77F2CC722320627001BD3F6 /* WRNavigationBar.swift in Sources */,
 				A7274C5E228EE636000E3A07 /* LBXPermissions.swift in Sources */,
 				A7D46092227619CD00A5A54E /* BaiduToCityFactory.swift in Sources */,
+				BD11D64222E02520008FFA58 /* MusicPlayManager.swift in Sources */,
 				A71AA51C227219EF008FF1A5 /* EditExpressAddressView.swift in Sources */,
 				BDAA40FB228E9CC300CF841D /* OrderApplyRefundNoteInfoCell.swift in Sources */,
 				A7DF50D622A4E8B400998908 /* OrderDetailProductTableViewCell.swift in Sources */,
@@ -6041,7 +6044,6 @@
 				A71AA5152272160A008FF1A5 /* ExpressAddressListTableViewCell.swift in Sources */,
 				A72A72B722321DE000B21995 /* Extension+NSMutableAttributedString.swift in Sources */,
 				A7931E0D22AF874600297D0A /* GenderSelectionViewController.swift in Sources */,
-				BD61229622C3605C00D3F513 /* AliyunResourceRequestManager.m in Sources */,
 				BD6122D022C364E400D3F513 /* AliyunMusicPickModel.m in Sources */,
 				A7C0FDF522B65FE000BC1E86 /* FeaturedTopicsCollectionViewCell.swift in Sources */,
 				A7BB6857226965C100AB07A2 /* SelfRecommendationHeaderCollectionReusableView.swift in Sources */,
@@ -6084,7 +6086,6 @@
 				A790706522B9DFAD008CE279 /* TextLimitTool.m in Sources */,
 				A72C01222275404A0065E0C3 /* ProvinceCityAreaModel.swift in Sources */,
 				A7FF1579228C82CE00A85748 /* OrderDetailViewController.swift in Sources */,
-				BD61229822C3605C00D3F513 /* AliyunResourceDownloadManager.m in Sources */,
 				A7FF159C228D9E3D00A85748 /* OrderRefundDetailModel.swift in Sources */,
 				A76B786922CE04940047EC1B /* CommunityRecommendDetailHTMLTableViewCell.swift in Sources */,
 				BD10FC0522C6F9880096A34E /* AliyunSVideoApi.m in Sources */,
@@ -6215,7 +6216,6 @@
 				A7824B042271F10300ABA381 /* EditSelfMentionContactsView.swift in Sources */,
 				A7274C5B228EE636000E3A07 /* LBXScanViewController.swift in Sources */,
 				BD0FAA5322C4750A00DDFB37 /* AliyunCoverPickView.m in Sources */,
-				BD61229422C3605C00D3F513 /* AliyunPage.m in Sources */,
 				A7FF1566228C6DF200A85748 /* OrderShopAndStatusTableViewCell.swift in Sources */,
 				A7A98E332280272A005306E9 /* ShoppingMallBannerTableViewCell.swift in Sources */,
 				A790706122B9C294008CE279 /* ModifyDataNickNameSignView.swift in Sources */,
@@ -6402,6 +6402,7 @@
 				BD12203622AF807C0051C7C2 /* MessagePlanetActivityController.swift in Sources */,
 				BD13B6C222BA034D008BB323 /* PublishEditAddImgCollectionCell.swift in Sources */,
 				A7778CAB2244B12500C7C47A /* CountDownManager.swift in Sources */,
+				BD50F47222E158FB0077D4BF /* PublishAgreementController.swift in Sources */,
 				A775CBFE2237493600EBDCF8 /* ShoppingMallNavigationBarView.swift in Sources */,
 				A71AA5212272E527008FF1A5 /* Extension+UINavigationController.swift in Sources */,
 				BD981A8F22C9FEEF0043D951 /* CommunityPublishModel.swift in Sources */,
@@ -6582,6 +6583,7 @@
 				BD6EDF48229007EA009A20FE /* OrderApplyRefundModel.swift in Sources */,
 				A770E5EB22D424A300CBD0A4 /* CommunityPostCommentIdModel.swift in Sources */,
 				A72A7388223396CB00B21995 /* ApiMacro.swift in Sources */,
+				BD50F47022E157F50077D4BF /* PublishRecordMusicView.swift in Sources */,
 				A72A72B922321DE000B21995 /* Extension+Array.swift in Sources */,
 				A70B2C492288416F00B2449F /* ProductDetailHotSellCollectionViewCell.swift in Sources */,
 				A71901692275464000104A50 /* ProvinceCityAreaView.swift in Sources */,

+ 107 - 0
RainbowPlanet/RainbowPlanet/Manager/MusicPlayManager/MusicPlayManager.swift

@@ -0,0 +1,107 @@
+//
+//  MusicPlayManager.swift
+//  RainbowPlanet
+//
+//  Created by Christopher on 2019/7/18.
+//  Copyright © 2019 RainbowPlanet. All rights reserved.
+//
+
+import UIKit
+
+class MusicPlayManager: NSObject {
+    
+    private static let _sharedInstance = MusicPlayManager()
+    
+    private override init() {} // 私有化init方法
+    
+    class func shared() -> MusicPlayManager {
+        return _sharedInstance
+    }
+    
+    // 记录当前正在播放的音乐Id
+    var curPlayingId: Int = -1
+    // 记录当前正在应用的音乐Id
+    var curChoosingId: Int = -1
+    
+    //播放器相关
+    var playerItem: AVPlayerItem!
+    var musicPlayer: AVPlayer!
+    
+    // 音频url
+    var audioUrl: String = "" {
+        didSet{
+            self.setupPlayerItem()
+        }
+    }
+    
+    func initPlay() {
+        //初始化播放器
+        musicPlayer = AVPlayer()
+        //监听音频播放结束
+        NotificationCenter.default.addObserver(self, selector: #selector(playItemDidReachEnd), name: NSNotification.Name.AVPlayerItemDidPlayToEndTime, object: MusicPlayManager.shared().playerItem)
+    }
+    
+    //设置资源
+    private func setupPlayerItem() {
+        guard let url = URL(string: audioUrl) else {
+            return
+        }
+        self.playerItem = AVPlayerItem(url: url)
+        self.musicPlayer.replaceCurrentItem(with: playerItem)
+    }
+    
+    //获取音频时长
+    func getDuration() -> Float64 {
+        if MusicPlayManager.shared().playerItem == nil {
+            return 0.0
+        }
+        let duration : CMTime = playerItem!.asset.duration
+        let seconds : Float64 = CMTimeGetSeconds(duration)
+        return seconds
+    }
+    func getCurrentTime() -> Float64 {
+        if MusicPlayManager.shared().playerItem == nil {
+            return 0.0
+        }
+        let duration : CMTime = playerItem!.currentTime()
+        let seconds : Float64 = CMTimeGetSeconds(duration)
+        return seconds
+    }
+    
+    //播放结束
+    var audioPlayEndBlock:(()->())?
+    @objc func playItemDidReachEnd(notifacation:NSNotification) {
+        musicPlayer?.seek(to: CMTime.zero)
+        if let block = audioPlayEndBlock {
+            block()
+        }
+    }
+    
+    //播放
+    func playAudio() {
+        if musicPlayer != nil {
+            musicPlayer?.play()
+        }
+    }
+    
+    //暂停
+    var audioStopBlock:(()->())?
+    func stopAudio() {
+        if musicPlayer != nil {
+            musicPlayer?.pause()
+            if let block = audioStopBlock {
+                block()
+            }
+        }
+    }
+    
+    //销毁
+    func destroyPlayer() {
+        if MusicPlayManager.shared().playerItem != nil {
+            MusicPlayManager.shared().musicPlayer?.pause()
+            MusicPlayManager.shared().playerItem?.cancelPendingSeeks()
+            MusicPlayManager.shared().playerItem?.asset.cancelLoading()
+        }
+    }
+    
+}

+ 4 - 0
RainbowPlanet/RainbowPlanet/Model/CommunityModel/CommunityRecommendMusicListModel.swift

@@ -42,6 +42,10 @@ class CommunityMusicItemModel : NSObject, Mappable{
     var singer : String?
     var url : String?
     
+    // 本地添加,用于控制状态
+    var isPlaying : Bool? = false
+    var isChoosing : Bool? = false
+    
     
     class func newInstance(map: Map) -> Mappable?{
         return CommunityMusicItemModel()

+ 5 - 146
RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoFile/Common/MusicPick/AliyunMusicPickViewController.m

@@ -21,13 +21,11 @@
 #import "MBProgressHUD.h"
 #import "AVC_ShortVideo_Config.h"
 #import <AFNetworking.h>
-#import "AliyunResourceDownloadManager.h"
 #import "AliyunEffectResourceModel.h"
 #import "AliyunEffectInfo.h"
 #import "AliyunDBHelper.h"
 #import "UIView+AlivcHelper.h"
 #import "MBProgressHUD+AlivcHelper.h"
-#import "AliyunResourceRequestManager.h"
 #import "AlivcMacro.h"
 
 //缓存远程音乐的文件路径
@@ -50,7 +48,6 @@
 @property (nonatomic, assign) CGFloat startTime;
 @property (nonatomic, strong) AliyunDBHelper *dbHelper;
 @property (nonatomic, weak) UITextView *bottomTextView;
-@property (nonatomic, strong)AliyunResourceDownloadManager *downloadManager;
 /**
  之前应用的远程音乐 - 用于左右切换设置原先的值
  */
@@ -60,8 +57,6 @@
  */
 @property (nonatomic, strong) AliyunMusicPickModel *selectedMusic_local;
 
-@property (nonatomic, strong) AliyunPage *page;
-
 @property (nonatomic, assign) BOOL isLoading; //是否正在加载
 
 @property (nonatomic, weak) UIActivityIndicatorView *indicatorView;//loading指示器
@@ -86,7 +81,7 @@
     }
     //初始化
     self.downloadingMusics = [NSMutableArray array];
-    self.downloadManager = [[AliyunResourceDownloadManager alloc]init];
+    
     
     if (!_duration) {
         _duration = 8;
@@ -107,9 +102,6 @@
         [self.player.currentItem.asset cancelLoading];
         self.player = nil;
     }
-    if (self.downloadManager) {
-        self.downloadManager = nil;
-    }
     //缓存当时的数组
     [self storeMusic];
 }
@@ -137,9 +129,6 @@
         [self.player.currentItem.asset cancelLoading];
         self.player = nil;
     }
-    if (self.downloadManager) {
-        self.downloadManager = nil;
-    }
 }
 
 /**
@@ -147,7 +136,7 @@
  */
 - (void)restoreRemoteMusic {
     self.remoteMusics = [NSKeyedUnarchiver unarchiveObjectWithFile:tmpMusicPath];
-    self.page = [NSKeyedUnarchiver unarchiveObjectWithFile:tmpPagePath];
+    
 }
 
 /**
@@ -158,7 +147,6 @@
         model.expand = NO;
     }
     [NSKeyedArchiver archiveRootObject:self.remoteMusics toFile:tmpMusicPath];
-    [NSKeyedArchiver archiveRootObject:self.page toFile:tmpPagePath];
 }
 
 /**
@@ -269,58 +257,13 @@
  2.本地数据库找到音乐,赋值工程加载的资源列表
  */
 - (void)fetchRemoteMusic {
-    //没有更多数据
-    if (!self.page.hasMore) {
-        return;
-    }
-    //首页清空数据
-    if (self.page.currentPageNo == 1) {
-        _remoteMusics = nil;
-    }
+    
     self.isLoading = YES;
     self.indicatorView.hidden = NO;
     [self.indicatorView startAnimating];
     __weak typeof(self) weakSelf = self;
     NSMutableArray *tmpMusic = [self musics];
-    [AliyunResourceRequestManager fetchMusicWithPage:weakSelf.page success:^(NSArray<AliyunMusicPickModel *> *musicList) {
-        [tmpMusic addObjectsFromArray:musicList];
-        //查询数据库
-        [weakSelf.dbHelper queryMusicResourceWithEffecInfoType:AliyunEffectTypeMusic success:^(NSArray *infoModelArray) {
-            for (AliyunEffectResourceModel *resourceModel in infoModelArray) {
-                
-                NSString *name = [NSString stringWithFormat:@"%ld-%@", (long)resourceModel.eid, resourceModel.name];
-                NSString *path = [[[resourceModel storageFullPath] stringByAppendingPathComponent:[NSString stringWithFormat:@"%@", name]] stringByAppendingPathComponent:[resourceModel.url.lastPathComponent componentsSeparatedByString:@"?"][0]];
-                AVURLAsset *asset = [AVURLAsset assetWithURL:[NSURL fileURLWithPath:path]];
-                for (AliyunMusicPickModel *musicModel in tmpMusic) {
-                    if ([musicModel.name isEqualToString: resourceModel.name] && [musicModel.artist isEqualToString:resourceModel.cnName]) {
-                        musicModel.name = resourceModel.name;
-                        musicModel.artist = resourceModel.cnName;
-                        musicModel.path = path;
-                        musicModel.downloadProgress = 1;
-                        musicModel.duration = [asset avAssetVideoTrackDuration];
-                        if (musicModel.duration < 0) {
-                            musicModel.isDBContain = NO;//异常的数据,重新下载
-                        }else{
-                            musicModel.isDBContain = YES;
-                        }
-                        break;
-                    }
-                }
-            }
-            //播放上次选中的歌曲
-            [weakSelf.tableView reloadData];
-            weakSelf.isLoading = NO;
-            [weakSelf.indicatorView stopAnimating];
-            
-        } failure:^(NSError *error) {
-            weakSelf.isLoading = NO;
-            [weakSelf.indicatorView stopAnimating];
-        }];
-    } failure:^(NSString *errorStr) {
-        [MBProgressHUD showMessage:errorStr inView:weakSelf.view];
-        weakSelf.isLoading = NO;
-        [weakSelf.indicatorView stopAnimating];
-    }];
+    
 }
 
 
@@ -618,7 +561,6 @@
 
 
 - (void)loadMoreMusic{
-    [self.page next];
     [self fetchRemoteMusic];
 }
 #pragma mark - header view delegate
@@ -660,83 +602,7 @@
         
         __block AliyunMusicPickHeaderView *weakView = view;
         __block AliyunMusicPickViewController *weakSelf = self;
-        //这里请求播放地址
-        [AliyunResourceRequestManager fetchMusicPlayUrl:model.musicId success:^(NSString *playPath, NSString *expireTime) {
-            model.path = playPath;
-            
-            AliyunEffectResourceModel *resourceModel = [[AliyunEffectResourceModel alloc] init];
-            resourceModel.eid = model.keyId;
-            resourceModel.name = model.name;
-            resourceModel.url = model.path;
-            //            resourceModel.url = responseObject[@"result"][@"result_obj"][@"listen_file_url"];
-            resourceModel.effectType = AliyunEffectTypeMusic;
-            //            NSLog(@"%@",responseObject[@"result"][@"result_obj"][@"listen_file_url"]);
-            
-            AliyunResourceDownloadTask *downLoadTask = [[AliyunResourceDownloadTask alloc] initWithModel:resourceModel];
-            _downloadManager = [[AliyunResourceDownloadManager alloc] init]; //重新创建,适配多任务下载
-            //            view.userInteractionEnabled = NO;
-            
-            
-            [_downloadManager addDownloadTask:downLoadTask progress:^(CGFloat progress) {
-                
-                //更新UI
-                model.downloadProgress = progress;
-                [weakView downloadProgress:progress];
-                
-            } completionHandler:^(AliyunEffectResourceModel *newModel, NSError *error) {
-                //                weakView.userInteractionEnabled = YES;
-                if (error.code == -2009) {
-                    [MBProgressHUD showMessage:@"此音乐正在下载,请耐心等待" inView:weakSelf.view];
-                    return;
-                }
-                if (error) {
-                    [MBProgressHUD showMessage:@"网络不给力" inView:weakSelf.view];
-                    [weakView updateDownloadViewWithFinish:YES];
-                    [weakSelf.downloadingMusics enumerateObjectsUsingBlock:^(id _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
-                        //删除错误的model
-                        AliyunMusicPickModel *model_del =(AliyunMusicPickModel *)obj;
-                        if (model_del.keyId == model.keyId) {
-                            *stop = YES;
-                            [weakSelf.downloadingMusics removeObject:model_del];
-                        }
-                    }];
-                    //                    [weakSelf.downloadingMusics removeAllObjects]; //错误的时候有时找不到具体是哪个音乐的错误
-                } else {
-                    newModel.isDBContain = YES;
-                    newModel.effectType = AliyunEffectTypeMusic;
-                    //根据newModel的值找到之前对应下载的音乐
-                    AliyunMusicPickModel *doneModel = nil;
-                    for (AliyunMusicPickModel *itemModel in weakSelf.musics) {
-                        if (itemModel.keyId == newModel.eid) {
-                            //更新数据
-                            doneModel = itemModel;
-                            newModel.cnName = doneModel.artist;
-                            [weakSelf.dbHelper insertDataWithEffectResourceModel:newModel];
-                            
-                            doneModel.isDBContain = newModel.isDBContain;
-                            doneModel.downloadProgress = 1;
-                            NSString *name = [NSString stringWithFormat:@"%ld-%@", (long)newModel.eid, newModel.name];
-                            NSString *path = [[[newModel storageFullPath] stringByAppendingPathComponent:[NSString stringWithFormat:@"%@", name]] stringByAppendingPathComponent:[newModel.url.lastPathComponent componentsSeparatedByString:@"?"][0]];
-                            AVURLAsset *asset = [AVURLAsset assetWithURL:[NSURL fileURLWithPath:path]];
-                            doneModel.path = path;
-                            doneModel.duration = [asset avAssetVideoTrackDuration];
-                            NSInteger index = [weakSelf.musics indexOfObject:itemModel];
-                            weakView.tag = index;
-                            [weakView updateDownloadViewWithFinish:YES];
-                            [weakSelf.downloadingMusics removeObject:doneModel];
-                            //更新UI
-                            [weakSelf handle:weakView];
-                            
-                            NSLog(@"音乐下载测试:%@,---%ld",doneModel.name,(long)view.tag);
-                            break;
-                        }
-                    }
-                }
-            }];
-            
-        } failure:^(NSString *errorStr) {
-            [MBProgressHUD showMessage:@"网络不给力" inView:weakSelf.view];
-        }];
+        
         
     }else{
         [self handle:view];
@@ -869,13 +735,6 @@
     return _player;
 }
 
-- (AliyunPage *)page{
-    if (!_page) {
-        _page = [[AliyunPage alloc] init];
-    }
-    return _page;
-}
-
 - (NSMutableArray *)remoteMusics {
     if (!_remoteMusics) {
         _remoteMusics = [NSMutableArray array];

+ 0 - 37
RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoFile/Common/ResourceManager/Manager/AliyunResourceDownloadManager.h

@@ -1,37 +0,0 @@
-//
-//  AliyunResourceDownloadManager.h
-//  AliyunVideo
-//
-//  Created by TripleL on 17/3/8.
-//  Copyright (C) 2010-2017 Alibaba Group Holding Limited. All rights reserved.
-//
-
-#import <Foundation/Foundation.h>
-#import <UIKit/UIKit.h>
-@class AliyunEffectResourceModel;
-
-
-@interface AliyunResourceDownloadTask : NSObject 
-
-@property(nonatomic, copy) void (^progressBlock)(CGFloat progress);
-@property(nonatomic, copy) void (^completionHandler)(AliyunEffectResourceModel *newModel, NSError *error);
-@property(nonatomic, readonly) AliyunEffectResourceModel *resourceModel;
-
-- (id)initWithModel:(AliyunEffectResourceModel *)resourceModel;
-
-@end
-
-
-
-@interface AliyunResourceDownloadManager : NSObject
-
-
-- (void)addDownloadTask:(AliyunResourceDownloadTask *)task __deprecated_msg("素材分发服务为官方demo演示使用,无法达到商业化使用程度。请自行搭建相关的服务");
-
-
-- (void)addDownloadTask:(AliyunResourceDownloadTask *)task
-               progress:(void (^)(CGFloat progress))progressBlock
-      completionHandler:(void (^)(AliyunEffectResourceModel *newModel, NSError *error))completionHandler __deprecated_msg("素材分发服务为官方demo演示使用,无法达到商业化使用程度。请自行搭建相关的服务");
-
-
-@end

+ 0 - 274
RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoFile/Common/ResourceManager/Manager/AliyunResourceDownloadManager.m

@@ -1,274 +0,0 @@
-//
-//  AliyunResourceDownloadManager.m
-//  AliyunVideo
-//
-//  Created by TripleL on 17/3/8.
-//  Copyright (C) 2010-2017 Alibaba Group Holding Limited. All rights reserved.
-//
-
-#import "AliyunResourceDownloadManager.h"
-#import <AliyunVideoSDKPro/AliyunHttpClient.h>
-#import "ZipArchive.h"
-#import "AliyunEffectResourceModel.h"
-
-@implementation AliyunResourceDownloadTask
-
-- (id)initWithModel:(AliyunEffectResourceModel *)resourceModel {
-    
-    if (self = [super init]) {
-        _resourceModel = resourceModel;
-    }
-    return self;
-}
-
-@end
-
-@interface AliyunResourceDownloadManager ()
-
-@property (nonatomic, strong) NSOperationQueue *downloadQueue;
-@property (nonatomic, assign) NSInteger totleCount;// 资源总数
-@property (nonatomic, assign) NSInteger currentIndex;// 当前下载Index
-
-@end
-
-@implementation AliyunResourceDownloadManager {
-    
-    AliyunResourceDownloadTask *_task;
-}
-
-
-- (void)dealloc {
-    [[NSNotificationCenter defaultCenter] removeObserver:self];
-}
-
-
-#pragma mark - Public
-
-- (void)addDownloadTask:(AliyunResourceDownloadTask *)task {
-    
-    [self addDownloadTask:task progress:nil completionHandler:nil];
-
-}
-
-- (void)addDownloadTask:(AliyunResourceDownloadTask *)task
-               progress:(void (^)(CGFloat progress))progressBlock
-      completionHandler:(void (^)(AliyunEffectResourceModel *newModel, NSError *error))completionHandler {
-
-    task.progressBlock = progressBlock;
-    task.completionHandler = completionHandler;
-    _task = task;
-    
-    [[NSNotificationCenter defaultCenter] addObserver:self
-                                             selector:@selector(applicationDidBecomeActive)
-                                                 name:UIApplicationDidBecomeActiveNotification
-                                               object:nil];
-    
-    [[NSNotificationCenter defaultCenter] addObserver:self
-                                             selector:@selector(applicationWillResignActive)
-                                                 name:UIApplicationWillResignActiveNotification
-                                               object:nil];
-    
-    self.currentIndex = 0;
-
-
-    
-    @autoreleasepool {
-        self.downloadQueue = [[NSOperationQueue alloc] init];
-        self.downloadQueue.name = @"com.duanqu.resourceDownload";
-        NSInvocationOperation *operation  = [[NSInvocationOperation alloc] initWithTarget:self selector:@selector(downloadResource) object:nil];
-        [self.downloadQueue addOperation:operation];
-    }
-    
-}
-
-
-#pragma mark - Download
-
-// 下载资源总入口 该方法用于分类区分怎么下载
-- (void)downloadResource {
-    
-    AliyunEffectType type = _task.resourceModel.effectType;
-    if (type == AliyunEffectTypeMV) {
-        // MV
-        NSLog(@"----下载MV");
-    } else if (type == AliyunEffectTypePaster) {
-        // 动图
-        NSLog(@"----下载动图");
-    } else if (type == AliyunEffectTypeCaption) {
-        // 字幕
-        NSLog(@"----下载字幕");
-    } else if (type == AliyunEffectTypeFont) {
-        // 字体
-        NSLog(@"----下载字体");
-    } else if (type == AliyunEffectTypeMusic) {
-        // 音乐
-        [self downloadMusicResource];
-    } else {
-        // 其他
-        [self completionOnMainQueue:nil error:[NSError errorWithDomain:@"com.duanqu.download" code:-1000 userInfo:@{@"errorInfo":@"非法的素材类型"}]];
-    }
-}
-
-// 下载音乐资源
-- (void)downloadMusicResource {
-    
-    self.totleCount = 1;
-    NSString *name = [NSString stringWithFormat:@"%ld-%@", (long)_task.resourceModel.eid, _task.resourceModel.name];
-    NSString *destination = [[[_task.resourceModel storageFullPath] stringByAppendingPathComponent:[NSString stringWithFormat:@"%@", name]] stringByAppendingPathComponent:[_task.resourceModel.url.lastPathComponent componentsSeparatedByString:@"?"][0]];
-    
-    [self downloadWithUrl:_task.resourceModel.url destination:destination unZipPath:nil];
-}
-
-// 下载
-- (void)downloadWithUrl:(NSString *)url destination:(NSString *)destination unZipPath:(NSString *)unZipPath{
-    
-    AliyunHttpClient *httpClient = [[AliyunHttpClient alloc] initWithBaseUrl:nil];
-    [httpClient download:url destination:destination progress:^(NSProgress *downloadProgress) {
-        
-        CGFloat percent = (CGFloat)self.currentIndex / (CGFloat)self.totleCount;
-        CGFloat progress = downloadProgress.fractionCompleted / self.totleCount + percent;
-
-        @autoreleasepool {
-            [[NSOperationQueue mainQueue] addOperationWithBlock:^{
-                _task.progressBlock(progress);
-            }];
-        }
-        
-    } completionHandler:^(NSURL *filePath, NSError *error) {
-//        code 516 file exist 错误
-        if (error && error.code != 516) {
-            [self completionOnMainQueue:nil error:error];
-        } else {
-            [self unZipFrom:filePath.path to:unZipPath];
-        }
-    }];
-
-}
-
-#pragma mark - Tools
-
-- (void)unZipFrom:(NSString *)filePath to:(NSString *)toDestination {
-    
-    if (!toDestination) {
-        // 单个下载不需要解压
-        [self updateResourceModelWithFilePath:filePath];
-        [self completionOnMainQueue:_task.resourceModel error:nil];
-    } else {
-        // 多个下载  解压缩
-        ZipArchive *_zipArchive = [[ZipArchive alloc] init];
-        [_zipArchive UnzipOpenFile:filePath];
-        BOOL unzip = [_zipArchive UnzipFileTo:toDestination overWrite:YES];
-        [_zipArchive UnzipCloseFile];
-        
-        // 解压失败
-        if (!unzip) {
-            NSError *error = [NSError errorWithDomain:@"com.duanqu" code:-1000 userInfo:@{@"errorInfo":@"解压失败"}];
-            [self completionOnMainQueue:nil error:error];
-            return ;
-        }
-        
-        // 移除压缩包
-        if ([[NSFileManager defaultManager] fileExistsAtPath:filePath]) {
-            [[NSFileManager defaultManager] removeItemAtPath:filePath error:nil];
-        }
-        
-        if (_task.resourceModel.effectType == AliyunEffectTypeFont) {
-            // 如果是字体需要移动资源位置
-            NSString *fileBase = [[[NSFileManager defaultManager] contentsOfDirectoryAtPath:toDestination error:nil] firstObject];
-            NSString *fileBasePath = [toDestination stringByAppendingPathComponent:fileBase];
-            NSArray *fontFiles = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:fileBasePath error:nil];
-            
-            for (NSString *oldFilePath in fontFiles) {
-                
-                NSURL *oldURL = [NSURL fileURLWithPath:[fileBasePath stringByAppendingPathComponent:oldFilePath]];
-                [[NSFileManager defaultManager] moveItemAtURL:oldURL toURL:[NSURL fileURLWithPath:[toDestination stringByAppendingPathComponent:oldFilePath]] error:nil];
-            }
-            if ([[NSFileManager defaultManager] fileExistsAtPath:fileBasePath]) {
-                [[NSFileManager defaultManager] removeItemAtPath:fileBasePath error:nil];
-            }
-            
-        }
-        
-        // 更新Model
-        [self updateResourceModelWithFilePath:toDestination];
-        
-        // 下载index +1
-        self.currentIndex++;
-        if (self.currentIndex < self.totleCount) {
-            // 若有多组下载 那么执行下一个下载
-            NSLog(@"download next");
-            [self downloadResource];
-            
-        } else {
-            // 下载完毕
-            [self completionOnMainQueue:_task.resourceModel error:nil];
-        }
-
-    }
-
-}
-
-
-- (void)updateResourceModelWithFilePath:(NSString *)filePath {
-    
-    NSArray *filePathArray = [filePath componentsSeparatedByString:@"Documents/"];
-    
-    NSString *relativePath = [@"Documents/" stringByAppendingPathComponent:filePathArray.lastObject];
-    
-    AliyunEffectType type = _task.resourceModel.effectType;
-    if (type == AliyunEffectTypeMV) {
-        // MV
-        NSString *mvBasePath = [relativePath stringByAppendingPathComponent:_task.resourceModel.name];
-        [_task.resourceModel setValue:mvBasePath forKey:@"resourcePath"];
-        
-    } else if (type == AliyunEffectTypePaster) {
-        // 动图
-
-    } else if (type == AliyunEffectTypeCaption) {
-        //   字幕        
-        
-    } else if(type == AliyunEffectTypeFont) {
-        // 字体
-        [_task.resourceModel setValue:relativePath forKey:@"resourcePath"];
-    } else {
-        [_task.resourceModel setValue:relativePath forKey:@"resourcePath"];
-    }
-    
-}
-
-
-- (void)completionOnMainQueue:(AliyunEffectResourceModel *)model error:(NSError *)error {
-    
-    if (error) {
-        // 下载失败 删除缓存
-//        NSString *filePath = [[_task.resourceModel storageFullPath] stringByAppendingPathComponent:[NSString stringWithFormat:@"%ld-%@", (long)_task.resourceModel.eid, _task.resourceModel.name]];
-//        if ([[NSFileManager defaultManager] fileExistsAtPath:filePath]) {
-//            [[NSFileManager defaultManager] removeItemAtPath:filePath error:nil];
-//        }
-//        [_task.resourceModel setValue:@(0) forKey:@"isDBContain"];
-        NSLog(@"下载失败 不删除缓存");
-    }else{
-         [_task.resourceModel setValue:@(1) forKey:@"isDBContain"];
-    }
-    @autoreleasepool {
-        [[NSOperationQueue mainQueue] addOperationWithBlock:^{
-            _task.completionHandler(model, error);
-        }];
-    }
-}
-
-
-#pragma mark - Notification
-
-- (void)applicationDidBecomeActive {
-    
-    [self.downloadQueue setSuspended:NO];
-}
-
-- (void)applicationWillResignActive {
-    
-    [self.downloadQueue setSuspended:YES];
-}
-
-
-@end

+ 0 - 47
RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoFile/Common/ResourceManager/Manager/AliyunResourceRequestManager.h

@@ -1,47 +0,0 @@
-//
-//  AliyunResourceRequestManager.h
-//  AliyunVideo
-//
-//  Created by TripleL on 17/3/6.
-//  Copyright (C) 2010-2017 Alibaba Group Holding Limited. All rights reserved.
-//       
-
-#import <Foundation/Foundation.h>
-#import "AliyunPage.h"
-
-typedef enum : NSUInteger {
-    kPasterCategoryFront = 1,   //前置动图分类
-    kPasterCategoryBack = 2   //后置动图分类
-} kPasterCategory;
-
-
-@class AliyunMusicPickModel;
-
-
-@interface AliyunResourceRequestManager : NSObject
-
-
-/**
- 获取太合音乐数据
- @param page     分页器
- @param success  成功的回调
- @param failure  失败的回调
- */
-+ (void)fetchMusicWithPage:(AliyunPage *)page
-                       success:(void(^)(NSArray<AliyunMusicPickModel *> *musicList))success
-                       failure:(void(^)(NSString *errorStr))failure;__deprecated_msg("素材分发服务为官方demo演示使用,无法达到商业化使用程度。请自行搭建相关的服务");
-
-
-/**
- 获取音乐的下载地址
- 
- @param musicId 音乐id
- @param success 成功的回调
- @param failure 失败的回调
- */
-+ (void)fetchMusicPlayUrl:(NSString *)musicId
-                  success:(void(^)(NSString *playPath,NSString *expireTime))success
-                  failure:(void(^)(NSString *errorStr))failure;__deprecated_msg("素材分发服务为官方demo演示使用,无法达到商业化使用程度。请自行搭建相关的服务");
-
-
-@end

+ 0 - 116
RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoFile/Common/ResourceManager/Manager/AliyunResourceRequestManager.m

@@ -1,116 +0,0 @@
-//
-//  AliyunResourceRequestManager.m
-//  AliyunVideo
-//
-//  Created by TripleL on 17/3/6.
-//  Copyright (C) 2010-2017 Alibaba Group Holding Limited. All rights reserved.
-//
-
-#import "AliyunResourceRequestManager.h"
-#import <AliyunVideoSDKPro/AliyunHttpClient.h>
-#import "AlivcAppServer.h"
-#import "AliyunMusicPickModel.h"
-#import "AlivcMacro.h"
-
-@implementation AliyunResourceRequestManager
-
-//素材分发服务为官方demo演示使用,无法达到商业化使用程度。请自行搭建相关的服务
-+ (void)requestWithEffectTypeTag:(NSInteger)typeTag
-                         success:(void(^)(NSArray *resourceListArray))success
-                         failure:(void(^)(NSError *error))failure {
-    
-        AliyunHttpClient *client = [[AliyunHttpClient alloc] initWithBaseUrl:kQPResourceHostUrl];
-    NSString *url = [NSString stringWithFormat:@"api/res/type/%ld", (long)typeTag];
-    NSDictionary *param = @{@"type":@(typeTag),
-                            @"bundleId":BundleID};
-
-    [client GET:url parameters:param completionHandler:^(NSURLResponse *response, id responseObject, NSError *error) {
-//        NSLog(@"%@",responseObject);
-        if (error) {
-            if (failure) {
-                failure(error);
-            }
-        } else {
-            if ( [responseObject isKindOfClass:[NSString class]] && [responseObject length] == 0) {
-                NSError *error = [NSError errorWithDomain:@"Data Empty Error" code:-10001 userInfo:nil];
-                if (failure) {
-                    failure(error);
-                }
-                return ;
-            }
-            if ([responseObject isKindOfClass:[NSArray class]] && [responseObject count] == 0) {
-                
-                NSError *error = [NSError errorWithDomain:@"Data Empty Error" code:-10001 userInfo:nil];
-                if (failure) {
-                    failure(error);
-                }
-                return ;
-            }
-            
-            if (success) {
-                success((NSArray *)responseObject);
-            }
-        }
-  
-    }];
-}
-
-
-
-+ (void)fetchMusicWithPage:(AliyunPage *)page
-                       success:(void(^)(NSArray<AliyunMusicPickModel *> *musicList))success
-                       failure:(void(^)(NSString *errorStr))failure {
-    
-    NSMutableDictionary *parameters = @{}.mutableCopy;
-    NSString *url = [NSString stringWithFormat:@"%@/music/getRecommendMusic",kQPResourceHostUrl];
-    if (page) {
-        [parameters setObject:@(page.currentPageNo) forKey:@"pageNo"];
-        [parameters setObject:@(page.pageSize) forKey:@"pageSize"];
-    }
-    [AlivcAppServer getWithUrlString:url parameters:parameters completionHandler:^(NSString * _Nullable errString, NSDictionary * _Nullable resultDic) {
-        if (errString) {
-            failure(errString);
-        }else{
-            BOOL result = [resultDic[@"result"] boolValue];
-            if (result) {
-                page.totalRecords = [resultDic[@"data"][@"total"] intValue];
-                NSMutableArray *musicList = @[].mutableCopy;
-                for (NSDictionary *dict in resultDic[@"data"][@"musicList"]) {
-                    AliyunMusicPickModel *musicModel = [[AliyunMusicPickModel alloc] initWithDictionary:dict];
-                    [musicList addObject:musicModel];
-                }
-                success(musicList);
-            }else{
-                failure(resultDic[@"message"]);
-            }
-        }
-    }];
-}
-
-
-+ (void)fetchMusicPlayUrl:(NSString *)musicId
-                  success:(void(^)(NSString *playPath,NSString *expireTime))success
-                  failure:(void(^)(NSString *errorStr))failure{
-    NSMutableDictionary *parameters = @{}.mutableCopy;
-    NSString *url = [NSString stringWithFormat:@"%@/music/getPlayPath",kQPResourceHostUrl];
-    if (musicId) {
-        [parameters setObject:musicId forKey:@"musicId"];
-    }
-    
-    [AlivcAppServer getWithUrlString:url parameters:parameters completionHandler:^(NSString * _Nullable errString, NSDictionary * _Nullable resultDic) {
-        if (errString) {
-            failure(errString);
-        }else{
-            BOOL result = [resultDic[@"result"] boolValue];
-            if (result) {
-                NSString *playPath = resultDic[@"data"][@"playPath"];
-                NSString *expireTime = resultDic[@"data"][@"expireTime"];
-                success(playPath,expireTime);
-            }else{
-                failure(resultDic[@"message"]);
-            }
-        }
-    }];
-}
-
-@end

+ 0 - 27
RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoFile/Common/ResourceManager/Models/AliyunPage.h

@@ -1,27 +0,0 @@
-//
-//  AliyunPages.h
-//  AliyunVideoClient_Entrance
-//
-//  Created by sz on 2019/3/5.
-//  Copyright © 2019 Alibaba. All rights reserved.
-//
-
-#import <Foundation/Foundation.h>
-
-NS_ASSUME_NONNULL_BEGIN
-
-@interface AliyunPage : NSObject<NSCoding>
-//当前页码
-@property (nonatomic, assign) NSInteger currentPageNo;
-//每页显示的数据个数
-@property (nonatomic, assign) NSInteger pageSize;
-//是否还有
-@property (nonatomic, assign) BOOL hasMore;
-//总数据
-@property (nonatomic, assign) NSInteger totalRecords;
-
-- (void)next;//下一页
-
-@end
-
-NS_ASSUME_NONNULL_END

+ 0 - 83
RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoFile/Common/ResourceManager/Models/AliyunPage.m

@@ -1,83 +0,0 @@
-//
-//  AliyunPages.m
-//  AliyunVideoClient_Entrance
-//
-//  Created by sz on 2019/3/5.
-//  Copyright © 2019 Alibaba. All rights reserved.
-//
-
-#import "AliyunPage.h"
-#import <objc/runtime.h>
-#define kPageSize 20
-
-@implementation AliyunPage
-
-- (instancetype)init{
-    self = [super init];
-    if (self) {
-        self.currentPageNo = 1;
-        self.pageSize = kPageSize;
-    }
-    return self;
-}
-
-- (BOOL)hasMore {
-    //第一页默认有数据的
-    if (self.currentPageNo == 1) {
-        return YES;
-    }
-    return self.pageSize * (self.currentPageNo -1) < self.totalRecords;
-}
-
-
-
-
-- (void)setCurrentPageNo:(NSInteger)currentPageNo{
-    if (currentPageNo <= 0) {
-        currentPageNo = 1;
-    }else{
-        _currentPageNo = currentPageNo;
-    }
-}
-- (void)setPageSize:(NSInteger)pageSize{
-    if (pageSize <= 0) {
-        _pageSize = kPageSize;
-    }else{
-        _pageSize = pageSize;
-    }
-}
-
-- (void)next{
-    self.currentPageNo++;
-}
-
-- (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;
-}
-
-@end

+ 85 - 17
RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoFile/VideoEdit/Controller/AliyunEditViewController.m

@@ -27,6 +27,7 @@
 #import "MBProgressHUD.h"
 #import "NSString+AlivcHelper.h"
 #import "UIView+AlivcHelper.h"
+#import "AFNetworking.h"
 
 //公用类相关
 #import "AliyunDBHelper.h"
@@ -57,6 +58,9 @@ typedef enum : NSUInteger {
 // TODO:此类需再抽一层,否则会太庞大
 @interface AliyunEditViewController () <
 AliyunIExporterCallback, AliyunIPlayerCallback, AliyunMusicPickViewControllerDelegate>
+{
+    NSURLSessionDownloadTask *_downloadTask;
+}
 
 @property(nonatomic, strong) UIView *movieView;
 @property(nonatomic, strong) UIButton *backgroundTouchButton;
@@ -77,16 +81,6 @@ AliyunIExporterCallback, AliyunIPlayerCallback, AliyunMusicPickViewControllerDel
 @property (nonatomic, strong) UIView *rateViewWithDim;
 
 
-/**
- 保存的时间特效
- */
-@property(nonatomic, strong) AliyunEffectTimeFilter *storeTimeFilter;
-
-/**
- 当前的时间特效
- */
-@property(nonatomic, strong) AliyunEffectTimeFilter *currentTimeFilter;
-
 @property(nonatomic, strong) AliyunDBHelper *dbHelper;
 
 @property(nonatomic, assign) BOOL isExporting;
@@ -114,6 +108,9 @@ AliyunIExporterCallback, AliyunIPlayerCallback, AliyunMusicPickViewControllerDel
 // 配乐のView
 @property (nonatomic, strong) PublishMusicChooseView *musicView;
 
+@property (nonatomic, assign) CGFloat originAudioVolumn;
+@property (nonatomic, assign) CGFloat backAudioVolumn;
+
 /**
  当前控制器是否可见
  */
@@ -605,7 +602,8 @@ AliyunIExporterCallback, AliyunIPlayerCallback, AliyunMusicPickViewControllerDel
     [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(applicationDidBecomeActive) name:UIApplicationDidBecomeActiveNotification object:nil];
     [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(applicationWillResignActive) name:UIApplicationWillResignActiveNotification object:nil];
     [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(resourceDeleteNoti:) name:AliyunEffectResourceDeleteNotification object:nil];
-    
+    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(downloadMusicAndCombineNoti:) name:@"DownloadMusicAndCombineNoti" object:nil];
+    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(changeAudioVolumn:) name:@"ChangeAudioVolumnNoti" object:nil];
 }
 
 - (void)removeNotifications {
@@ -613,6 +611,22 @@ AliyunIExporterCallback, AliyunIPlayerCallback, AliyunMusicPickViewControllerDel
 }
 
 #pragma mark - Notification Action
+- (void)downloadMusicAndCombineNoti:(NSNotification *)noti {
+    NSString *urlStr = noti.object;
+    NSLog(@"\n------receiveNoti.urlStr == %@", urlStr);
+    [self downloadFileFromServerWithUrlStr:urlStr];
+}
+
+- (void)changeAudioVolumn:(NSNotification *)noti {
+    NSDictionary *paraDic = noti.object;
+    self.originAudioVolumn = [paraDic[@"origin"] floatValue];
+    self.backAudioVolumn   = [paraDic[@"back"] floatValue];
+
+    [self.editor setMainStreamsAudioWeight:_originAudioVolumn];
+    [self.editor setAudioMixWeight:_backAudioVolumn];
+}
+
+
 //资源删除通知
 - (void)resourceDeleteNoti:(NSNotification *)noti {
     NSArray *deleteResourcePaths = noti.object;
@@ -651,7 +665,65 @@ AliyunIExporterCallback, AliyunIPlayerCallback, AliyunMusicPickViewControllerDel
     }
 }
 
-#pragma mark - Common Method
+#pragma mark - Download Music Method
+- (void)downloadFileFromServerWithUrlStr:(NSString *)urlStr{
+    
+    NSURL *URL = [NSURL URLWithString:urlStr];
+    
+    NSURLSessionConfiguration *configuration = [NSURLSessionConfiguration defaultSessionConfiguration];
+    
+    //AFN3.0+基于封住URLSession的句柄
+    AFURLSessionManager *manager = [[AFURLSessionManager alloc] initWithSessionConfiguration:configuration];
+    
+    //请求
+    NSURLRequest *request = [NSURLRequest requestWithURL:URL];
+    
+    //下载Task操作
+    _downloadTask = [manager downloadTaskWithRequest:request progress:^(NSProgress * _Nonnull downloadProgress) {
+        
+        // @property int64_t totalUnitCount;  需要下载文件的总大小
+        // @property int64_t completedUnitCount; 当前已经下载的大小
+        
+        // 给Progress添加监听 KVO
+        NSLog(@"%f",1.0 * downloadProgress.completedUnitCount / downloadProgress.totalUnitCount);
+        // 回到主队列刷新UI
+//        dispatch_async(dispatch_get_main_queue(), ^{
+//            self.progressView.progress = 1.0 * downloadProgress.completedUnitCount / downloadProgress.totalUnitCount;
+//        });
+        
+    } destination:^NSURL * _Nonnull(NSURL * _Nonnull targetPath, NSURLResponse * _Nonnull response) {
+        
+        //- block的返回值, 要求返回一个URL, 返回的这个URL就是文件的位置的路径
+        
+        NSString *cachesPath = [NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES) lastObject];
+        NSString *path = [cachesPath stringByAppendingPathComponent:response.suggestedFilename];
+        return [NSURL fileURLWithPath:path];
+        
+    } completionHandler:^(NSURLResponse * _Nonnull response, NSURL * _Nullable filePath, NSError * _Nullable error) {
+        // filePath就是你下载文件的位置,你可以解压,也可以直接拿来使用
+        
+        NSString *musicFilePath = [filePath path];// 将NSURL转成NSString
+        NSLog(@"\n------下载音乐成功!path == %@", musicFilePath);
+        
+        
+        // FIXME: to be fixed
+        AVURLAsset *asset = [AVURLAsset assetWithURL:[NSURL fileURLWithPath:musicFilePath]];
+        CGFloat musicDuration = [asset avAssetVideoTrackDuration];
+        
+        //如果录制的时候有音乐 编辑的时候重新音乐 则播放新的音乐
+        if (self.hasRecordMusic) {
+            [self.editor setAudioMixWeight:100];
+        }
+        [self.editor removeMusics];
+        AliyunEffectMusic *effectMusic =[[AliyunEffectMusic alloc] initWithFile:musicFilePath];
+        effectMusic.startTime = 0;
+        effectMusic.duration = musicDuration;
+        [self.editor applyMusic:effectMusic];
+    }];
+    
+    // 开始执行下载
+    [_downloadTask resume];
+}
 
 #pragma mark - Play Manager
 
@@ -1137,8 +1209,6 @@ AliyunIExporterCallback, AliyunIPlayerCallback, AliyunMusicPickViewControllerDel
 
 //音乐
 - (void)musicButtonClicked {
-    //    [self enterEditWithActionType:AliyunEditSouceClickTypeMusic];
-    //    [self pause];
     
 //    AliyunMusicPickViewController *vc =
 //    [[AliyunMusicPickViewController alloc] init];
@@ -1148,7 +1218,7 @@ AliyunIExporterCallback, AliyunIPlayerCallback, AliyunMusicPickViewControllerDel
 //    vc.delegate = self;
 //    [self.navigationController pushViewController:vc animated:YES];
     
-//    self.volumnView = [PublishMusicVolumnView publishMusicVolumnView];
+    [self pause];
     self.musicView = [PublishMusicChooseView publishMusicChooseViewWithAttachedView:self.view];
     
 }
@@ -1231,12 +1301,10 @@ AliyunIExporterCallback, AliyunIPlayerCallback, AliyunMusicPickViewControllerDel
     timeFilter.type = TimeFilterTypeSpeed;
     timeFilter.param = rate;
     [self.editor applyTimeFilter:timeFilter];
-    self.currentTimeFilter = timeFilter;
     [self resume];
 }
 
 - (void)didSelectNone {
-    self.currentTimeFilter = nil;
     [_editor removeTimeFilter];
     [self resume];
 }

+ 95 - 8
RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoFile/VideoRecord/Controller/AliyunMagicCameraViewController.m

@@ -37,11 +37,15 @@
 #import "AliyunEffectFilterView.h"
 #import "UIView+AlivcHelper.h"
 #import "AlivcMacro.h"
+#import "AFNetworking.h"
 
 #import "RainbowPlanet-Swift.h"
 
 
 @interface AliyunMagicCameraViewController () <AliyunMusicPickViewControllerDelegate, UIGestureRecognizerDelegate, UIAlertViewDelegate, AliyunIRecorderDelegate, AliyunEffectFilter2ViewDelegate>
+{
+    NSURLSessionDownloadTask *_downloadTask;
+}
 
 /**
  SDK录制类
@@ -157,6 +161,9 @@
 
 @property(nonatomic, strong) AliyunEffectFilterView *filterView;
 
+// 配乐のView
+@property (nonatomic, strong) PublishRecordMusicView *musicView;
+
 @end
 
 @implementation AliyunMagicCameraViewController
@@ -426,6 +433,25 @@
     [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(appWillResignActive:) name:UIApplicationWillResignActiveNotification object:nil];
     [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(appDidBecomeActive:) name:UIApplicationDidBecomeActiveNotification object:nil];
     [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(resourceDelete:) name:AliyunEffectResourceDeleteNotification object:nil];
+    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(musicViewDidClose) name:@"RecordCloseMusicChooseViewNoti" object:nil];
+    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(downloadMusicAndCombineNoti:) name:@"RecordDownloadMusicAndCombineNoti" object:nil];
+}
+
+- (void)downloadMusicAndCombineNoti:(NSNotification *)noti {
+    NSString *urlStr = noti.object;
+    NSLog(@"\n------receiveNoti.urlStr == %@", urlStr);
+    [self downloadFileFromServerWithUrlStr:urlStr];
+}
+
+- (void)musicViewDidClose {
+    self.magicCameraView.rateView.hidden = false;
+    
+    if (self.clipManager.partCount == 0) {
+        if (self.hideSegmentBlock) {
+            self.hideSegmentBlock(false);
+        }
+    }
+    
 }
 
 /**
@@ -438,7 +464,6 @@
 }
 
 
-
 - (void)appWillResignActive:(id)sender
 {
     if ([self.navigationController.childViewControllers lastObject] != self) {
@@ -525,6 +550,62 @@
     return _dbHelper;
 }
 
+#pragma mark - Download Music Method
+- (void)downloadFileFromServerWithUrlStr:(NSString *)urlStr{
+    
+    NSURL *URL = [NSURL URLWithString:urlStr];
+    
+    NSURLSessionConfiguration *configuration = [NSURLSessionConfiguration defaultSessionConfiguration];
+    
+    //AFN3.0+基于封住URLSession的句柄
+    AFURLSessionManager *manager = [[AFURLSessionManager alloc] initWithSessionConfiguration:configuration];
+    
+    //请求
+    NSURLRequest *request = [NSURLRequest requestWithURL:URL];
+    
+    //下载Task操作
+    _downloadTask = [manager downloadTaskWithRequest:request progress:^(NSProgress * _Nonnull downloadProgress) {
+        
+        // @property int64_t totalUnitCount;  需要下载文件的总大小
+        // @property int64_t completedUnitCount; 当前已经下载的大小
+        
+        // 给Progress添加监听 KVO
+        NSLog(@"%f",1.0 * downloadProgress.completedUnitCount / downloadProgress.totalUnitCount);
+        // 回到主队列刷新UI
+        //        dispatch_async(dispatch_get_main_queue(), ^{
+        //            self.progressView.progress = 1.0 * downloadProgress.completedUnitCount / downloadProgress.totalUnitCount;
+        //        });
+        
+    } destination:^NSURL * _Nonnull(NSURL * _Nonnull targetPath, NSURLResponse * _Nonnull response) {
+        
+        //- block的返回值, 要求返回一个URL, 返回的这个URL就是文件的位置的路径
+        
+        NSString *cachesPath = [NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES) lastObject];
+        NSString *path = [cachesPath stringByAppendingPathComponent:response.suggestedFilename];
+        return [NSURL fileURLWithPath:path];
+        
+    } completionHandler:^(NSURLResponse * _Nonnull response, NSURL * _Nullable filePath, NSError * _Nullable error) {
+        // filePath就是你下载文件的位置,你可以解压,也可以直接拿来使用
+        
+        NSString *musicFilePath = [filePath path];// 将NSURL转成NSString
+        NSLog(@"\n------下载音乐成功!path == %@", musicFilePath);
+        
+        
+        // FIXME: to be fixed
+        AVURLAsset *asset = [AVURLAsset assetWithURL:[NSURL fileURLWithPath:musicFilePath]];
+        CGFloat musicDuration = [asset avAssetVideoTrackDuration];
+        
+        
+        AliyunEffectMusic *effectMusic = [[AliyunEffectMusic alloc] initWithFile:musicFilePath];
+        effectMusic.startTime = 0;
+        effectMusic.duration = musicDuration;
+        [self.recorder applyMusic:effectMusic];
+    }];
+    
+    // 开始执行下载
+    [_downloadTask resume];
+}
+
 #pragma mark - 设备旋转
 
 // 支持设备自动旋转
@@ -741,13 +822,19 @@
 
 - (void)musicButtonClicked
 {
-    AliyunMusicPickViewController *vc =[[AliyunMusicPickViewController alloc] init];
-    vc.delegate = self;
-    vc.duration = _clipManager.maxDuration;
-    vc.selectedMusic = self.music;
-    vc.selectedTab = self.tab;
-    self.needStopPreview =NO;
-    [self.navigationController pushViewController:vc animated:YES];
+//    AliyunMusicPickViewController *vc =[[AliyunMusicPickViewController alloc] init];
+//    vc.delegate = self;
+//    vc.duration = _clipManager.maxDuration;
+//    vc.selectedMusic = self.music;
+//    vc.selectedTab = self.tab;
+//    self.needStopPreview =NO;
+//    [self.navigationController pushViewController:vc animated:YES];
+    
+    self.musicView = [PublishRecordMusicView publishRecordMusicViewWithAttachedView:self.view];
+    if (self.hideSegmentBlock) {
+        self.hideSegmentBlock(true);
+        self.magicCameraView.rateView.hidden = true;
+    }
 }
 
 - (void)filterButtonClicked {

+ 33 - 0
RainbowPlanet/RainbowPlanet/Modules/PublishModule/PublishMusicAbout/PublishAgreementController.swift

@@ -0,0 +1,33 @@
+//
+//  PublishAgreementController.swift
+//  RainbowPlanet
+//
+//  Created by Christopher on 2019/7/19.
+//  Copyright © 2019 RainbowPlanet. All rights reserved.
+//
+
+import UIKit
+
+class PublishAgreementController: BaseViewController {
+    
+    override func viewDidLoad() {
+        super.viewDidLoad()
+        setupViews()
+        setupLayouts()
+    }
+    
+    override func setupViews() {
+        statusBarStyle = .lightContent
+        view.backgroundColor = UIColor.black
+        navigationBar.barBackgroundColor = UIColor.black
+        navigationBar.title = "内容授权协议"
+        navigationBar.titleLabelColor = kffffffColor
+        navigationBar.wr_setLeftButton(image: kImage(name: "navbar_back_white")!)
+        
+    }
+    
+    override func setupLayouts() {
+        
+    }
+    
+}

+ 51 - 36
RainbowPlanet/RainbowPlanet/Modules/PublishModule/PublishMusicAbout/PublishMusicChooseView.swift

@@ -4,7 +4,7 @@
 //
 //  Created by Christopher on 2019/7/16.
 //  Copyright © 2019 RainbowPlanet. All rights reserved.
-//  选择音乐のView
+//  编辑视频--选择音乐のView
 
 import UIKit
 import FWPopupView
@@ -32,7 +32,6 @@ class PublishMusicChooseView: FWPopupView {
         fatalError("init(coder:) has not been implemented")
     }
     
-    var JXheightForHeaderInSection: Int = 44
     var categoryTitleArr = Array<String>()
     
     var categoryListMdlArr : Array<MusicCategoryItemModel>? {
@@ -115,7 +114,7 @@ class PublishMusicChooseView: FWPopupView {
             make.height.equalTo(21)
         }
         v_lineLabel.snp.makeConstraints { (make) in
-            make.centerX.equalTo(volumnButton.snp_centerX)
+            make.centerX.equalTo(musicButton.snp_centerX)
             make.width.equalTo(20)
             make.height.equalTo(3)
             make.bottom.equalTo(-11-kSafeTabBarHeight)
@@ -126,20 +125,6 @@ class PublishMusicChooseView: FWPopupView {
     func setupSegmentedView() {
         addSubview(segmentedView)
         addSubview(listContainerView)
-        reloadData()
-    }
-    
-    /// 刷新页面
-    func reloadData() {
-        segmentedDataSource.titles = categoryTitleArr
-        segmentedView.indicators = [indicator]
-
-        JXheightForHeaderInSection = 44
-        
-        //        self.segmentedDataSource.reloadData(selectedIndex: shoppingMallListVCType)
-        //        self.segmentedView.defaultSelectedIndex = shoppingMallListVCType
-        self.segmentedView.reloadData()
-        
     }
     
     // MARK: - 视图创建
@@ -174,16 +159,16 @@ class PublishMusicChooseView: FWPopupView {
     lazy var musicButton: UIButton = {
         let musicButton = UIButton(type: UIButton.ButtonType.custom)
         musicButton.setTitle("配乐", for: UIControl.State.normal)
-        musicButton.setTitleColor(k999999Color, for: UIControl.State.normal)
-        musicButton.titleLabel?.font = kRegularFont16
+        musicButton.setTitleColor(kffffffColor, for: UIControl.State.normal)
+        musicButton.titleLabel?.font = kMediumFont17
         return musicButton
     }()
     
     lazy var volumnButton: UIButton = {
         let volumnButton = UIButton(type: UIButton.ButtonType.custom)
         volumnButton.setTitle("音量", for: UIControl.State.normal)
-        volumnButton.setTitleColor(kffffffColor, for: UIControl.State.normal)
-        volumnButton.titleLabel?.font = kMediumFont17
+        volumnButton.setTitleColor(k999999Color, for: UIControl.State.normal)
+        volumnButton.titleLabel?.font = kRegularFont16
         return volumnButton
     }()
     
@@ -197,14 +182,18 @@ class PublishMusicChooseView: FWPopupView {
     //MARK: -
     //1.初始化JXSegmentedView
     lazy var segmentedView: JXSegmentedView = {
-        let segmentedView = JXSegmentedView(frame: CGRect(x: 0, y: 48, width: kScreenWidth, height: CGFloat(JXheightForHeaderInSection)))
+        let segmentedView = JXSegmentedView(frame: CGRect(x: 0, y: 48, width: kScreenWidth, height: 44))
         segmentedView.delegate = self
         segmentedView.dataSource = segmentedDataSource
         segmentedView.indicators = [indicator]
         segmentedView.contentScrollView = listContainerView.scrollView
-        segmentedView.selectItemAt(index: 0)
         segmentedView.defaultSelectedIndex = 0
-        segmentedView.backgroundColor = UIColor.yellow
+        
+        let lineWidth: CGFloat = 0.5
+        let lineLayer = CALayer()
+        lineLayer.backgroundColor = k999999Color.cgColor
+        lineLayer.frame = CGRect(x: 0, y: segmentedView.bounds.height - lineWidth, width: segmentedView.bounds.width, height: lineWidth)
+        segmentedView.layer.addSublayer(lineLayer)
         return segmentedView
     }()
     
@@ -214,8 +203,9 @@ class PublishMusicChooseView: FWPopupView {
         segmentedDataSource.titles = categoryTitleArr
         segmentedDataSource.isTitleColorGradientEnabled = true
         segmentedDataSource.isItemSpacingAverageEnabled = true
-        segmentedDataSource.titleNormalColor = kffffffColor
-        segmentedDataSource.titleSelectedColor = kbbbbbbColor
+        segmentedDataSource.isTitleZoomEnabled = true
+        segmentedDataSource.titleNormalColor = kbbbbbbColor
+        segmentedDataSource.titleSelectedColor = kffffffColor
         segmentedDataSource.titleNormalFont = kRegularFont14!
         segmentedDataSource.titleSelectedFont = kMediumFont14
         
@@ -227,9 +217,11 @@ class PublishMusicChooseView: FWPopupView {
     //3.初始化指示器indicator
     lazy var indicator: JXSegmentedIndicatorLineView = {
         let indicator = JXSegmentedIndicatorLineView()
-        indicator.indicatorColor = kFFA42FColor
-        indicator.indicatorHeight = 4
-        indicator.indicatorWidth = 34
+        indicator.indicatorColor = kffffffColor
+        indicator.indicatorHeight = 3
+        indicator.indicatorWidth = 20
+        indicator.cornerRadius = 1.5
+        indicator.masksToBounds = true
         return indicator
     }()
     
@@ -238,8 +230,7 @@ class PublishMusicChooseView: FWPopupView {
         let listContainerView = JXSegmentedListContainerView(dataSource: self)
         listContainerView.didAppearPercent = 0.01
         listContainerView.defaultSelectedIndex = 0
-        listContainerView.scrollView.isScrollEnabled = true
-        listContainerView.frame = CGRect(x: 0, y: 48+44, width: kScreenWidth, height: kScreenHeight - kSafeTabBarHeight - kSafeStatusBarHeight - 103 - 114)        
+        listContainerView.frame = CGRect(x: 0, y: 48+44, width: kScreenWidth, height: kScreenHeight - kSafeTabBarHeight - kSafeStatusBarHeight - 103 - 114)
         return listContainerView
     }()
     
@@ -250,14 +241,19 @@ class PublishMusicChooseView: FWPopupView {
         let vProperty = FWPopupViewProperty()
         vProperty.popupCustomAlignment = .bottomCenter
         vProperty.popupViewEdgeInsets = UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 0)
-        vProperty.popupAnimationType = .scale
+        vProperty.popupAnimationType = .frame
         vProperty.maskViewColor = UIColor(white: 0, alpha: 0.2)
-        vProperty.touchWildToHide = "1"
+        // 用户点击外部遮罩层页面是否可以消失
+        vProperty.touchWildToHide = "0"
         view.vProperty = vProperty
         view.show()
         
         view.cancelButton.rx.tap.subscribe(onNext: { (data) in            
             view.hide()
+            NotificationCenter.default.post(name: NSNotification.Name(rawValue: "CloseMusicChooseViewNoti"), object: nil)
+            
+            MusicPlayManager.shared().destroyPlayer()
+            MusicPlayManager.shared().curPlayingId = -1
             
         }).disposed(by: view.disposeBag)
         
@@ -268,12 +264,13 @@ class PublishMusicChooseView: FWPopupView {
         }).disposed(by: view.disposeBag)
         
         view.musicButton.rx.tap.subscribe(onNext: { (data) in
-            print("----点击了-配乐")
             
         }).disposed(by: view.disposeBag)
         
         view.volumnButton.rx.tap.subscribe(onNext: { (data) in
-            print("----点击了-音量")
+            view.hide(popupDidDisappearBlock: { (view1) in
+                _ = PublishMusicVolumnView.publishMusicVolumnView(attachedView: attachedView)
+            })
             
         }).disposed(by: view.disposeBag)
         
@@ -315,7 +312,10 @@ extension PublishMusicChooseView : JXSegmentedViewDelegate {
 extension PublishMusicChooseView :JXSegmentedListContainerViewDataSource {
     
     func numberOfLists(in listContainerView: JXSegmentedListContainerView) -> Int {
-        return categoryTitleArr.count
+        if let titleDataSource = segmentedView.dataSource as? JXSegmentedBaseDataSource {
+            return titleDataSource.dataSource.count
+        }
+        return 0
     }
     func listContainerView(_ listContainerView: JXSegmentedListContainerView, initListAt index: Int) -> JXSegmentedListContainerViewListDelegate {
         let listVc = PublishMusicListController()
@@ -324,6 +324,21 @@ extension PublishMusicChooseView :JXSegmentedListContainerViewDataSource {
         } else {
             listVc.categoryItemMdl = categoryListMdlArr![index-1]
         }
+        listVc.playMusicClosure = {
+            (musicUrl) in
+            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: "CloseMusicChooseViewNoti"), object: nil)
+            
+            MusicPlayManager.shared().destroyPlayer()
+            MusicPlayManager.shared().curPlayingId = -1
+            self?.hide()
+        }
         return listVc
     }
 }

+ 21 - 7
RainbowPlanet/RainbowPlanet/Modules/PublishModule/PublishMusicAbout/PublishMusicListCell.swift

@@ -15,13 +15,27 @@ class PublishMusicListCell: UITableViewCell {
     var musicItemMdl: CommunityMusicItemModel? {
         didSet {
             titleLabel.text = self.musicItemMdl?.name
+            
+            if self.musicItemMdl?.isPlaying == true {
+                iconImageView.image = kImage(name: "music_btn_pause")
+                useButton.isHidden = false
+            } else {
+                iconImageView.image = kImage(name: "music_btn_play")
+                useButton.isHidden = true
+            }
+            
+            if self.musicItemMdl?.isChoosing == true {
+                curPlayImageView.isHidden = false
+            } else {
+                curPlayImageView.isHidden = true
+            }
         }
     }
     
     let disposeBag = DisposeBag()
     
-    typealias BtnClickClosure = () -> Void
-    var btnClickClosure : BtnClickClosure?
+    typealias UseClickClosure = () -> Void
+    var useClickClosure : UseClickClosure?
     
     class func cellWith(tableView:UITableView,indexPath:IndexPath) -> PublishMusicListCell {
         let ID = "PublishMusicListCell"
@@ -94,8 +108,7 @@ class PublishMusicListCell: UITableViewCell {
     }()
     
     private lazy var titleLabel: UILabel = {
-        let titleLabel = UILabel()
-        titleLabel.text = "最快乐的一天"
+        let titleLabel = UILabel()        
         titleLabel.textColor = kffffffColor
         titleLabel.font = kMediumFont14
         titleLabel.textAlignment = .left
@@ -106,7 +119,6 @@ class PublishMusicListCell: UITableViewCell {
         let curPlayImageView = UIImageView()
         curPlayImageView.image = kImage(name: "music_ico_selected")
         return curPlayImageView
-        //        music_btn_pause
     }()
     
     private lazy var useButton: UIButton = {
@@ -115,10 +127,12 @@ class PublishMusicListCell: UITableViewCell {
         useButton.titleLabel?.font = kRegularFont13
         useButton.setBackgroundImage(UIImage.imageWithColor(color: k62CC74Color), for: UIControl.State.normal)
         useButton.setTitleColor(kEnabledTitleColor, for: UIControl.State.normal)
-        useButton.layer.cornerRadius = kScaleValue(value: 13)
+        useButton.layer.cornerRadius = 13
         useButton.layer.masksToBounds = true
         useButton.rx.tap.subscribe(onNext: { [weak self] in
-            print("----点击了-使用")
+            if let useClickClosure = self?.useClickClosure {
+                useClickClosure()
+            }
         }).disposed(by: disposeBag)
         return useButton
     }()

+ 55 - 3
RainbowPlanet/RainbowPlanet/Modules/PublishModule/PublishMusicAbout/PublishMusicListController.swift

@@ -17,6 +17,12 @@ class PublishMusicListController: BaseViewController {
         listViewDidScrollCallback = nil
     }
     
+    typealias PlayMusicClosure = (_ musicUrl: String) -> Void
+    var playMusicClosure : PlayMusicClosure?
+    
+    typealias ChooseMusicClosure = (_ musicUrl: String) -> Void
+    var chooseMusicClosure : ChooseMusicClosure?
+    
     // 推荐下の音乐
     var isReccomendList: Bool? {
         didSet {
@@ -59,7 +65,6 @@ class PublishMusicListController: BaseViewController {
     lazy var tableView: UITableView = {
         let tableView = UITableView(frame: CGRect.zero, style: UITableView.Style.grouped)
         tableView.separatorStyle = .none
-//        tableView.backgroundColor = kRGBColor(r: 255, g: 192, b: 203)
         tableView.backgroundColor = UIColor.clear
         tableView.dataSource = self
         tableView.delegate = self
@@ -71,21 +76,44 @@ class PublishMusicListController: BaseViewController {
     
 }
 
+// MARK: - tableView dataSource && delegate
 extension PublishMusicListController : UITableViewDelegate, UITableViewDataSource {
     func numberOfSections(in tableView: UITableView) -> Int {
         return 1
     }
     
     func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
-        return musicItemMdlArr.isEmpty ?? true ? 0 : musicItemMdlArr.count
+        return musicItemMdlArr.isEmpty ? 0 : musicItemMdlArr.count
     }
     
     func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
         let cell = PublishMusicListCell.cellWith(tableView: tableView, indexPath: indexPath)
         cell.musicItemMdl = musicItemMdlArr[indexPath.row]
+        cell.useClickClosure = {
+            [weak self] in
+            let musicUrlStr = self?.musicItemMdlArr[indexPath.row].url
+            if let chooseMusicClosure = self?.chooseMusicClosure {
+                chooseMusicClosure(musicUrlStr ?? "")
+            }
+        }
         return cell
     }
     
+    func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
+        let musicUrl = musicItemMdlArr[indexPath.row].url!
+        if let playMusicClosure = self.playMusicClosure {
+            playMusicClosure(musicUrl)
+        }
+        
+        let musicId = musicItemMdlArr[indexPath.row].id!
+        MusicPlayManager.shared().curPlayingId = musicId
+//        resetPlayingStatusWithout(musicId)
+        
+//        let curChoosingId = MusicPlayManager.shared().curChoosingId
+//        self.resetPlayingStatusWithout(curPlayingId)
+//        self.resetCellStatusWith(curPlayingId, curChoosingId)
+    }
+    
     func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
         return 50
     }
@@ -111,12 +139,15 @@ extension PublishMusicListController : UITableViewDelegate, UITableViewDataSourc
     
 }
 
+// MARK: - JXContainerListDelegate
 extension PublishMusicListController : JXSegmentedListContainerViewListDelegate {
     func listView() -> UIView {
         return view
     }
     func listDidAppear() {
-        
+        let curPlayingId = MusicPlayManager.shared().curPlayingId
+        let curChoosingId = MusicPlayManager.shared().curChoosingId
+        self.resetCellStatusWith(curPlayingId, curChoosingId)
     }
     func listDidDisappear() {
         
@@ -166,4 +197,25 @@ extension PublishMusicListController {
             }
         }
     }
+    
+    // 重置播放状态
+    func resetCellStatusWith(_ playingId: Int, _ choosingId: Int) -> Void {
+        for musicMdl in musicItemMdlArr {
+            // 播放状态判断
+            if playingId == musicMdl.id {
+                musicMdl.isPlaying = true
+            } else {
+                musicMdl.isPlaying = false
+            }
+            
+            // 应用状态判断
+            if choosingId == musicMdl.id {
+                musicMdl.isChoosing = true
+            } else {
+                musicMdl.isChoosing = false
+            }
+        }
+        tableView.reloadData()
+    }
+    
 }

+ 28 - 17
RainbowPlanet/RainbowPlanet/Modules/PublishModule/PublishMusicAbout/PublishMusicVolumnView.swift

@@ -29,7 +29,15 @@ class PublishMusicVolumnView: FWPopupView {
     
     func setupViews() {
         frame = CGRect(x: 0, y: 0, width: kScreenWidth, height: 177 + kSafeStatusBarHeight)
-        backgroundColor = UIColor(hexString: "000000", alpha: 0.5)
+        
+        // 添加毛玻璃效果,需使用frame设置位置
+        let blurEffect = UIBlurEffect(style: .dark)
+        let blurEffectView = UIVisualEffectView(effect: blurEffect)
+        blurEffectView.frame = CGRect(x: CGFloat(0), y: 0, width: kScreenWidth, height: 177 + kSafeStatusBarHeight)
+        addSubview(blurEffectView)
+        
+        self.backgroundColor = UIColor.clear
+        
         configRectCorner(corner: [.topLeft,.topRight], radii: CGSize(width: 8, height: 8))
         
         addSubview(cancelButton)
@@ -85,13 +93,13 @@ class PublishMusicVolumnView: FWPopupView {
         
         musicButton.snp.makeConstraints { (make) in
             make.centerX.equalTo(kScreenWidth*0.25)
-            make.bottom.equalTo(-17-kSafeStatusBarHeight)
+            make.bottom.equalTo(-17-kSafeTabBarHeight)
             make.width.equalTo(40)
             make.height.equalTo(21)
         }
         volumnButton.snp.makeConstraints { (make) in
             make.centerX.equalTo(kScreenWidth*0.75)
-            make.bottom.equalTo(-17-kSafeStatusBarHeight)
+            make.bottom.equalTo(-17-kSafeTabBarHeight)
             make.width.equalTo(40)
             make.height.equalTo(21)
         }
@@ -99,7 +107,7 @@ class PublishMusicVolumnView: FWPopupView {
             make.centerX.equalTo(volumnButton.snp_centerX)
             make.width.equalTo(20)
             make.height.equalTo(3)
-            make.bottom.equalTo(-11-kSafeStatusBarHeight)
+            make.bottom.equalTo(-11-kSafeTabBarHeight)
         }
     }
     
@@ -185,49 +193,52 @@ class PublishMusicVolumnView: FWPopupView {
     @objc func originValueChanged(_ sender: Any?) {
         let slider = sender as? UISlider
         
-        let sliderRate = CGFloat((slider?.value ?? 0.0) / (slider?.maximumValue ?? 0.0))
-        print("\n-------- originSliderRate = \(sliderRate)")
-        
+        let sliderRate = (slider?.value ?? 0.0) / (slider?.maximumValue ?? 0.0)
+        self.originVolumn = sliderRate
     }
     
     @objc func backValueChanged(_ sender: Any?) {
         let slider = sender as? UISlider
         
-        let sliderRate = CGFloat((slider?.value ?? 0.0) / (slider?.maximumValue ?? 0.0))
-        
-        print("\n-------- backSliderRate = \(sliderRate)")
+        let sliderRate = (slider?.value ?? 0.0) / (slider?.maximumValue ?? 0.0)
+        self.backVolumn = sliderRate
     }
     
     /// 初始化View
-    @objc class func publishMusicVolumnView() -> PublishMusicVolumnView {
+    @objc class func publishMusicVolumnView(attachedView:UIView) -> PublishMusicVolumnView {
         let view = PublishMusicVolumnView()
+        view.attachedView = attachedView
         let vProperty = FWPopupViewProperty()
         vProperty.popupCustomAlignment = .bottomCenter
         vProperty.popupViewEdgeInsets = UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 0)
-        vProperty.popupAnimationType = .scale
+        vProperty.popupAnimationType = .frame
         vProperty.maskViewColor = UIColor(white: 0, alpha: 0.2)
         vProperty.touchWildToHide = "1"
         view.vProperty = vProperty
         view.show()
         
         view.cancelButton.rx.tap.subscribe(onNext: { (data) in
-            print("----点击了-取消")
             view.hide()
             
         }).disposed(by: view.disposeBag)
         
         view.applyButton.rx.tap.subscribe(onNext: {(data) in
-            print("----点击了-应用")
+            var paraDic = Dictionary<String, Any>()
+            paraDic.updateValue(view.originVolumn*100, forKey: "origin")
+            paraDic.updateValue(view.backVolumn*100, forKey: "back")
+            NotificationCenter.default.post(name: NSNotification.Name(rawValue: "ChangeAudioVolumnNoti"), object: paraDic)
+            
             view.hide()
         }).disposed(by: view.disposeBag)
         
-        view.musicButton.rx.tap.subscribe(onNext: { (data) in
-            print("----点击了-配乐")
+        view.musicButton.rx.tap.subscribe(onNext: { (data) in            
+            view.hide(popupDidDisappearBlock: { (view1) in
+                _ = PublishMusicChooseView.publishMusicChooseView(attachedView: attachedView)
+            })
             
         }).disposed(by: view.disposeBag)
         
         view.volumnButton.rx.tap.subscribe(onNext: { (data) in
-            print("----点击了-音量")
             
         }).disposed(by: view.disposeBag)
         

+ 36 - 0
RainbowPlanet/RainbowPlanet/Modules/PublishModule/PublishMusicAbout/PublishRecommendMusicController.swift

@@ -48,6 +48,9 @@ class PublishRecommendMusicController: BaseViewController {
         cardBackView.addSubview(sepLineView)
         cardBackView.addSubview(nameTextView)
         cardBackView.addSubview(linkTextView)
+        
+        view.addSubview(recommendLabel)
+        view.addSubview(recommendButton)
     }
     
     override func setupLayouts() {
@@ -75,6 +78,18 @@ class PublishRecommendMusicController: BaseViewController {
             make.right.equalTo(-15)
             make.height.equalTo(40)
         }
+        
+        recommendLabel.snp.makeConstraints { (make) in
+            make.centerX.equalTo(kScreenWidth*0.5-25)
+            make.bottom.equalTo(-(kSafeTabBarHeight+15))
+            make.height.equalTo(20)
+        }
+        recommendButton.snp.makeConstraints { (make) in
+            make.left.equalTo(recommendLabel.snp_right).offset(2)
+            make.height.equalTo(30)
+            make.centerY.equalTo(recommendLabel.snp_centerY)
+            make.width.equalTo(75)
+        }
     }
     
     override func setupData() {
@@ -118,6 +133,27 @@ class PublishRecommendMusicController: BaseViewController {
         return linkTextView
     }()
     
+    lazy var recommendLabel: UILabel = {
+        let recommendLabel = UILabel()
+        recommendLabel.text = "点击提交代表您同意"
+        recommendLabel.textColor = k999999Color
+        recommendLabel.font = kRegularFont12
+        return recommendLabel
+    }()
+    
+    lazy var recommendButton: UIButton = {
+        let recommendButton = UIButton(type: UIButton.ButtonType.custom)
+        recommendButton.setTitle("内容授权协议", for: UIControl.State.normal)
+        recommendButton.setTitleColor(kffffffColor, for: UIControl.State.normal)
+        recommendButton.titleLabel?.font = kMediumFont12
+        recommendButton.rx.tap.subscribe(onNext: {
+            [weak self] (data) in            
+            let vc = PublishAgreementController()            
+            self?.navigationController?.pushViewController(vc, animated: true)
+        }).disposed(by: disposeBag)
+        return recommendButton
+    }()
+    
 }
 
 // MARK: -

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

@@ -0,0 +1,284 @@
+//
+//  PublishRecordMusicView.swift
+//  RainbowPlanet
+//
+//  Created by Christopher on 2019/7/19.
+//  Copyright © 2019 RainbowPlanet. All rights reserved.
+//  录制视频--选择音乐のView
+
+import UIKit
+import FWPopupView
+import RxSwift
+import SwiftyMediator
+import JXSegmentedView
+
+class PublishRecordMusicView: FWPopupView {
+    
+    let disposeBag = DisposeBag()
+    
+    typealias RecommendClosure = () -> Void
+    var recommendClosure : RecommendClosure?
+    
+    override init(frame: CGRect) {
+        super.init(frame: frame)
+        setupViews()
+        setupLayouts()
+        
+        // 获取分类列表
+        self.communityGetMusicCategoryApi()
+    }
+    
+    required init?(coder aDecoder: NSCoder) {
+        fatalError("init(coder:) has not been implemented")
+    }
+    
+    var categoryTitleArr = Array<String>()
+    
+    var categoryListMdlArr : Array<MusicCategoryItemModel>? {
+        didSet {
+            guard categoryListMdlArr?.isEmpty ?? true else {
+                categoryTitleArr.removeAll()
+                categoryTitleArr.append("推荐")
+                for categoryMdl in categoryListMdlArr! {
+                    categoryTitleArr.append(categoryMdl.name!)
+                }
+                setupSegmentedView()
+                return
+            }
+            setupSegmentedView()
+            return
+        }
+    }
+    
+    func setupViews() {
+        frame = CGRect(x: 0, y: 0, width: kScreenWidth, height: kScreenHeight - kSafeTabBarHeight - kSafeStatusBarHeight - 22)
+        
+        // 添加毛玻璃效果,需使用frame设置位置
+        let blurEffect = UIBlurEffect(style: .dark)
+        let blurEffectView = UIVisualEffectView(effect: blurEffect)
+        blurEffectView.frame = CGRect(x: CGFloat(0), y: 0, width: kScreenWidth, height: kScreenHeight - kSafeTabBarHeight - kSafeStatusBarHeight - 22)
+        addSubview(blurEffectView)
+        
+        self.backgroundColor = UIColor.clear
+        
+        configRectCorner(corner: [.topLeft,.topRight], radii: CGSize(width: 8, height: 8))
+        
+        addSubview(cancelButton)
+        
+        addSubview(recommendLabel)
+        addSubview(recommendButton)
+    }
+    
+    func setupLayouts() {
+        
+        cancelButton.snp.makeConstraints { (make) in
+            make.top.equalTo(2)
+            make.left.equalTo(3)
+            make.size.equalTo(44)
+        }
+        
+        recommendLabel.snp.makeConstraints { (make) in
+            make.centerX.equalTo(kScreenWidth*0.5-20)
+            make.bottom.equalTo(-(kSafeTabBarHeight+20))
+            make.height.equalTo(20)
+        }
+        recommendButton.snp.makeConstraints { (make) in
+            make.left.equalTo(recommendLabel.snp_right)
+            make.height.equalTo(30)
+            make.centerY.equalTo(recommendLabel.snp_centerY)
+            make.width.equalTo(60)
+        }
+        
+    }
+    
+    func setupSegmentedView() {
+        addSubview(segmentedView)
+        addSubview(listContainerView)
+    }
+    
+    // MARK: - 视图创建
+    lazy var cancelButton: UIButton = {
+        let cancelButton = UIButton(type: UIButton.ButtonType.custom)
+        cancelButton.setImage(kImage(name: "video_btn_close_white"), for: .normal)
+        return cancelButton
+    }()
+    
+    lazy var recommendLabel: UILabel = {
+        let recommendLabel = UILabel()
+        recommendLabel.text = "没有找到想要的音乐?"
+        recommendLabel.textColor = k999999Color
+        recommendLabel.font = kRegularFont14
+        return recommendLabel
+    }()
+    
+    lazy var recommendButton: UIButton = {
+        let recommendButton = UIButton(type: UIButton.ButtonType.custom)
+        recommendButton.setTitle("点击推荐", for: UIControl.State.normal)
+        recommendButton.setTitleColor(kffffffColor, for: UIControl.State.normal)
+        recommendButton.titleLabel?.font = kMediumFont14
+        return recommendButton
+    }()
+    
+    //MARK: -
+    //1.初始化JXSegmentedView
+    lazy var segmentedView: JXSegmentedView = {
+        let segmentedView = JXSegmentedView(frame: CGRect(x: 0, y: 48, width: kScreenWidth, height: 44))
+        segmentedView.delegate = self
+        segmentedView.dataSource = segmentedDataSource
+        segmentedView.indicators = [indicator]
+        segmentedView.contentScrollView = listContainerView.scrollView
+        segmentedView.defaultSelectedIndex = 0
+        
+        let lineWidth: CGFloat = 0.5
+        let lineLayer = CALayer()
+        lineLayer.backgroundColor = k999999Color.cgColor
+        lineLayer.frame = CGRect(x: 0, y: segmentedView.bounds.height - lineWidth, width: segmentedView.bounds.width, height: lineWidth)
+        segmentedView.layer.addSublayer(lineLayer)
+        return segmentedView
+    }()
+    
+    //2.初始化dataSource
+    lazy var segmentedDataSource: JXSegmentedTitleDataSource = {
+        let segmentedDataSource = JXSegmentedTitleDataSource()
+        segmentedDataSource.titles = categoryTitleArr
+        segmentedDataSource.isTitleColorGradientEnabled = true
+        segmentedDataSource.isItemSpacingAverageEnabled = true
+        segmentedDataSource.isTitleZoomEnabled = true
+        segmentedDataSource.titleNormalColor = kbbbbbbColor
+        segmentedDataSource.titleSelectedColor = kffffffColor
+        segmentedDataSource.titleNormalFont = kRegularFont14!
+        segmentedDataSource.titleSelectedFont = kMediumFont14
+        
+        //reloadData(selectedIndex:)方法一定要调用,方法内部会刷新数据源数组
+        segmentedDataSource.reloadData(selectedIndex: 0)
+        return segmentedDataSource
+    }()
+    
+    //3.初始化指示器indicator
+    lazy var indicator: JXSegmentedIndicatorLineView = {
+        let indicator = JXSegmentedIndicatorLineView()
+        indicator.indicatorColor = kffffffColor
+        indicator.indicatorHeight = 3
+        indicator.indicatorWidth = 20
+        indicator.cornerRadius = 1.5
+        indicator.masksToBounds = true
+        return indicator
+    }()
+    
+    //4.初始化JXSegmentedListContainerView
+    private lazy var listContainerView: JXSegmentedListContainerView = {
+        let listContainerView = JXSegmentedListContainerView(dataSource: self)
+        listContainerView.didAppearPercent = 0.01
+        listContainerView.defaultSelectedIndex = 0
+        listContainerView.frame = CGRect(x: 0, y: 48+44, width: kScreenWidth, height: kScreenHeight - kSafeTabBarHeight - kSafeStatusBarHeight - 55 - 114)
+        return listContainerView
+    }()
+    
+    /// 初始化View    
+    @objc class func publishRecordMusicView(attachedView:UIView) -> PublishRecordMusicView {
+        let view = PublishRecordMusicView()
+        view.attachedView = attachedView
+        let vProperty = FWPopupViewProperty()
+        vProperty.popupCustomAlignment = .bottomCenter
+        vProperty.popupViewEdgeInsets = UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 0)
+        vProperty.popupAnimationType = .frame
+        vProperty.maskViewColor = UIColor(white: 0, alpha: 0.2)
+        // 用户点击外部遮罩层页面是否可以消失
+        vProperty.touchWildToHide = "0"
+        view.vProperty = vProperty
+        view.show()
+        
+        view.cancelButton.rx.tap.subscribe(onNext: { (data) in
+            view.hide()
+            NotificationCenter.default.post(name: NSNotification.Name(rawValue: "RecordCloseMusicChooseViewNoti"), object: nil)
+            
+            MusicPlayManager.shared().destroyPlayer()
+            MusicPlayManager.shared().curPlayingId = -1
+            
+        }).disposed(by: view.disposeBag)
+        
+        view.recommendButton.rx.tap.subscribe(onNext: { (data) in
+            Mediator.push(PublishRouterModuleType.push)
+            
+        }).disposed(by: view.disposeBag)
+        
+        return view
+    }
+    
+}
+
+// MARK: - JXSegmentedViewDelegate
+extension PublishRecordMusicView : JXSegmentedViewDelegate {
+    //点击选中或者滚动选中都会调用该方法。适用于只关心选中事件,而不关心具体是点击还是滚动选中的情况。
+    func segmentedView(_ segmentedView: JXSegmentedView, didSelectedItemAt index: Int) {
+        //传递didClickSelectedItemAt事件给listContainerView,必须调用!!!
+        listContainerView.didClickSelectedItem(at: index)
+    }
+    
+    // 点击选中的情况才会调用该方法
+    func segmentedView(_ segmentedView: JXSegmentedView, didClickSelectedItemAt index: Int) {
+        listContainerView.didClickSelectedItem(at: index)
+    }
+    
+    // 滚动选中的情况才会调用该方法
+    func segmentedView(_ segmentedView: JXSegmentedView, didScrollSelectedItemAt index: Int) {
+    }
+    
+    // 正在滚动中的回调
+    func segmentedView(_ segmentedView: JXSegmentedView, scrollingFrom leftIndex: Int, to rightIndex: Int, percent: CGFloat) {
+        //传递scrolling事件给listContainerView,必须调用!!!
+        listContainerView.segmentedViewScrolling(from: leftIndex, to: rightIndex, percent: percent, selectedIndex: segmentedView.selectedIndex)
+    }
+    
+    /// 是否允许点击选中目标index的item
+    func segmentedView(_ segmentedView: JXSegmentedView, canClickItemAt index: Int) -> Bool {
+        return true
+    }
+}
+
+// MARK: - JXSegmentedListContainerViewDataSource
+extension PublishRecordMusicView :JXSegmentedListContainerViewDataSource {
+    
+    func numberOfLists(in listContainerView: JXSegmentedListContainerView) -> Int {
+        if let titleDataSource = segmentedView.dataSource as? JXSegmentedBaseDataSource {
+            return titleDataSource.dataSource.count
+        }
+        return 0
+    }
+    func listContainerView(_ listContainerView: JXSegmentedListContainerView, initListAt index: Int) -> JXSegmentedListContainerViewListDelegate {
+        let listVc = PublishMusicListController()
+        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()
+        }
+        listVc.chooseMusicClosure = {
+            [weak self] (musicUrl) in
+            NotificationCenter.default.post(name: NSNotification.Name(rawValue: "RecordDownloadMusicAndCombineNoti"), object: musicUrl)
+            NotificationCenter.default.post(name: NSNotification.Name(rawValue: "RecordCloseMusicChooseViewNoti"), object: nil)
+            
+            MusicPlayManager.shared().destroyPlayer()
+            MusicPlayManager.shared().curPlayingId = -1
+            self?.hide()
+        }
+        return listVc
+    }
+}
+
+// MARK: - 网络请求
+extension PublishRecordMusicView {
+    /// 获取音乐分类
+    func communityGetMusicCategoryApi() {
+        SwiftMoyaNetWorkServiceCommunity.shared().communityGetMusicCategoryApi() {
+            [weak self] (musicCategoryListModel) -> (Void) in
+            let musicCategoryListModel = musicCategoryListModel as? CommunityMusicCategoryListModel
+            self?.categoryListMdlArr = musicCategoryListModel?.data
+        }
+    }
+}