Ver código fonte

Merge branch 'develop' into feature/jeremy

# Conflicts:
#	RainbowPlanet/Podfile.lock
南鑫林 5 anos atrás
pai
commit
71bdd819a1
100 arquivos alterados com 10514 adições e 18 exclusões
  1. 4 0
      RainbowPlanet/Podfile
  2. 27 1
      RainbowPlanet/Podfile.lock
  3. 758 12
      RainbowPlanet/RainbowPlanet.xcodeproj/project.pbxproj
  4. 5 0
      RainbowPlanet/RainbowPlanet/Macro/RainbowPlanet-Bridging-Header.h
  5. 20 0
      RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcBeaitufySettingsPanel/AlivcBeautySettingUIDefine.h
  6. 13 0
      RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcBeaitufySettingsPanel/AlivcBeautySettingUIDefine.m
  7. 156 0
      RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcBeaitufySettingsPanel/AlivcPushBeautyDataManager.h
  8. 577 0
      RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcBeaitufySettingsPanel/AlivcPushBeautyDataManager.m
  9. 106 0
      RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcBeaitufySettingsPanel/AlivcPushBeautyParams.h
  10. 30 0
      RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcBeaitufySettingsPanel/AlivcPushBeautyParams.m
  11. 30 0
      RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoCommonFile/AVC_ShortVideo_Config.h
  12. 34 0
      RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoCommonFile/Mediator/AliyunMediator.h
  13. 97 0
      RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoCommonFile/Mediator/AliyunMediator.m
  14. 276 0
      RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoCommonFile/Tools/MediaConfig/AliyunMediaConfig.h
  15. 131 0
      RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoCommonFile/Tools/MediaConfig/AliyunMediaConfig.m
  16. 43 0
      RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoCommonFile/Tools/MusicImport/AliyunLibraryMusicImport.h
  17. 188 0
      RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoCommonFile/Tools/MusicImport/AliyunLibraryMusicImport.m
  18. 0 0
      RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoCommonFile/Tools/PathManager/AliyunPathManager.h
  19. 0 1
      RainbowPlanet/RainbowPlanet/Modules/PublishModule/PublishTakeVideo/AliyunPathManager.m
  20. 153 0
      RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoCommonFile/Tools/UIConfig/AliyunIConfig.h
  21. 66 0
      RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoCommonFile/Tools/UIConfig/AliyunIConfig.m
  22. 14 0
      RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoCommonFile/Tools/UIConfig/AliyunImage.h
  23. 19 0
      RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoCommonFile/Tools/UIConfig/AliyunImage.m
  24. 25 0
      RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoCommonFile/Vendor/Avasset+VideoSize/AVAsset+VideoInfo.h
  25. 84 0
      RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoCommonFile/Vendor/Avasset+VideoSize/AVAsset+VideoInfo.m
  26. 0 0
      RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoCommonFile/Vendor/ProgressView/QUProgressView.h
  27. 7 4
      RainbowPlanet/RainbowPlanet/Modules/PublishModule/PublishTakeVideo/QUProgressView.m
  28. 82 0
      RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoCommonFile/Vendor/UIView+Progress/UIView+Progress.h
  29. 150 0
      RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoCommonFile/Vendor/UIView+Progress/UIView+Progress.m
  30. 51 0
      RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoFile/Common/AliAssetImageGenerator/AliAssetImageGenerator.h
  31. 194 0
      RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoFile/Common/AliAssetImageGenerator/AliAssetImageGenerator.m
  32. 159 0
      RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoFile/Common/AlivcShortVideoRoute.h
  33. 216 0
      RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoFile/Common/AlivcShortVideoRoute.m
  34. 35 0
      RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoFile/Common/FilterAbout/AlivcEditBottomHeaderView.h
  35. 76 0
      RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoFile/Common/FilterAbout/AlivcEditBottomHeaderView.m
  36. 16 0
      RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoFile/Common/FilterAbout/AlivcEditIconButton.h
  37. 32 0
      RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoFile/Common/FilterAbout/AlivcEditIconButton.m
  38. 49 0
      RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoFile/Common/FilterAbout/AliyunEffectFilterView.h
  39. 217 0
      RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoFile/Common/FilterAbout/AliyunEffectFilterView.m
  40. 14 0
      RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoFile/Common/Model/AliyunCustomFilter.h
  41. 204 0
      RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoFile/Common/Model/AliyunCustomFilter.m
  42. 21 0
      RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoFile/Common/Model/AliyunEffectFilterInfo.h
  43. 40 0
      RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoFile/Common/Model/AliyunEffectFilterInfo.m
  44. 91 0
      RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoFile/Common/Model/AliyunEffectInfo.h
  45. 54 0
      RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoFile/Common/Model/AliyunEffectInfo.m
  46. 21 0
      RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoFile/Common/Model/AliyunEffectMusicInfo.h
  47. 19 0
      RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoFile/Common/Model/AliyunEffectMusicInfo.m
  48. 48 0
      RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoFile/Common/Model/AliyunEffectMvGroup.h
  49. 94 0
      RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoFile/Common/Model/AliyunEffectMvGroup.m
  50. 35 0
      RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoFile/Common/Model/AliyunEffectMvInfo.h
  51. 17 0
      RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoFile/Common/Model/AliyunEffectMvInfo.m
  52. 52 0
      RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoFile/Common/MusicPick/AliyunMusicPickViewController.h
  53. 975 0
      RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoFile/Common/MusicPick/AliyunMusicPickViewController.m
  54. 71 0
      RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoFile/Common/MusicPick/Model/AliyunMusicPickModel.h
  55. 78 0
      RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoFile/Common/MusicPick/Model/AliyunMusicPickModel.m
  56. 16 0
      RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoFile/Common/MusicPick/View/AliyunMusicLineView.h
  57. 58 0
      RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoFile/Common/MusicPick/View/AliyunMusicLineView.m
  58. 25 0
      RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoFile/Common/MusicPick/View/AliyunMusicPickCell.h
  59. 173 0
      RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoFile/Common/MusicPick/View/AliyunMusicPickCell.m
  60. 13 0
      RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoFile/Common/MusicPick/View/AliyunMusicPickCoverView.h
  61. 64 0
      RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoFile/Common/MusicPick/View/AliyunMusicPickCoverView.m
  62. 35 0
      RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoFile/Common/MusicPick/View/AliyunMusicPickHeaderView.h
  63. 139 0
      RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoFile/Common/MusicPick/View/AliyunMusicPickHeaderView.m
  64. 23 0
      RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoFile/Common/MusicPick/View/AliyunMusicPickTabView.h
  65. 95 0
      RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoFile/Common/MusicPick/View/AliyunMusicPickTabView.m
  66. 19 0
      RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoFile/Common/MusicPick/View/AliyunMusicPickTopView.h
  67. 69 0
      RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoFile/Common/MusicPick/View/AliyunMusicPickTopView.m
  68. 18 0
      RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoFile/Common/QUTimeline/AliyunTimelineFilterItem.h
  69. 13 0
      RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoFile/Common/QUTimeline/AliyunTimelineFilterItem.m
  70. 20 0
      RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoFile/Common/QUTimeline/AliyunTimelineItem.h
  71. 15 0
      RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoFile/Common/QUTimeline/AliyunTimelineItem.m
  72. 34 0
      RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoFile/Common/QUTimeline/AliyunTimelineItemCell.h
  73. 175 0
      RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoFile/Common/QUTimeline/AliyunTimelineItemCell.m
  74. 25 0
      RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoFile/Common/QUTimeline/AliyunTimelineMediaInfo.h
  75. 13 0
      RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoFile/Common/QUTimeline/AliyunTimelineMediaInfo.m
  76. 18 0
      RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoFile/Common/QUTimeline/AliyunTimelineTimeFilterItem.h
  77. 23 0
      RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoFile/Common/QUTimeline/AliyunTimelineTimeFilterItem.m
  78. 229 0
      RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoFile/Common/QUTimeline/AliyunTimelineView.h
  79. 1107 0
      RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoFile/Common/QUTimeline/AliyunTimelineView.m
  80. 125 0
      RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoFile/Common/ResourceManager/Manager/AliyunDBHelper.h
  81. 385 0
      RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoFile/Common/ResourceManager/Manager/AliyunDBHelper.m
  82. 39 0
      RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoFile/Common/ResourceManager/Manager/AliyunEffectModelTransManager.h
  83. 120 0
      RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoFile/Common/ResourceManager/Manager/AliyunEffectModelTransManager.m
  84. 29 0
      RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoFile/Common/ResourceManager/Manager/AliyunEffectPrestoreManager.h
  85. 181 0
      RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoFile/Common/ResourceManager/Manager/AliyunEffectPrestoreManager.m
  86. 37 0
      RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoFile/Common/ResourceManager/Manager/AliyunResourceDownloadManager.h
  87. 274 0
      RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoFile/Common/ResourceManager/Manager/AliyunResourceDownloadManager.m
  88. 47 0
      RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoFile/Common/ResourceManager/Manager/AliyunResourceRequestManager.h
  89. 116 0
      RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoFile/Common/ResourceManager/Manager/AliyunResourceRequestManager.m
  90. 95 0
      RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoFile/Common/ResourceManager/Models/AliyunEffectResourceModel.h
  91. 90 0
      RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoFile/Common/ResourceManager/Models/AliyunEffectResourceModel.m
  92. 27 0
      RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoFile/Common/ResourceManager/Models/AliyunPage.h
  93. 83 0
      RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoFile/Common/ResourceManager/Models/AliyunPage.m
  94. 59 0
      RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoFile/Common/ResourceManager/Views/AliyunEffectFilterCell.h
  95. 134 0
      RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoFile/Common/ResourceManager/Views/AliyunEffectFilterCell.m
  96. 92 0
      RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoFile/Common/ResourceManager/Views/AliyunEffectFilterCell.xib
  97. 85 0
      RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoFile/Common/UIConfig/AlivcEditUIConfig.h
  98. 45 0
      RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoFile/Common/UIConfig/AlivcEditUIConfig.m
  99. 58 0
      RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoFile/Common/UIConfig/AlivcRecordUIConfig.h
  100. 0 0
      RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoFile/Common/UIConfig/AlivcRecordUIConfig.m

+ 4 - 0
RainbowPlanet/Podfile

@@ -82,4 +82,8 @@ target 'RainbowPlanet' do
   pod 'AliyunOSSiOS'
   pod 'AlivcConan'
   
+  pod 'AFNetworking', '~> 3.0'
+  pod 'JSONModel','~> 1.7.0'
+  pod 'ZipArchive','1.4.0'
+  
 end

+ 27 - 1
RainbowPlanet/Podfile.lock

@@ -1,4 +1,19 @@
 PODS:
+  - AFNetworking (3.2.1):
+    - AFNetworking/NSURLSession (= 3.2.1)
+    - AFNetworking/Reachability (= 3.2.1)
+    - AFNetworking/Security (= 3.2.1)
+    - AFNetworking/Serialization (= 3.2.1)
+    - AFNetworking/UIKit (= 3.2.1)
+  - AFNetworking/NSURLSession (3.2.1):
+    - AFNetworking/Reachability
+    - AFNetworking/Security
+    - AFNetworking/Serialization
+  - AFNetworking/Reachability (3.2.1)
+  - AFNetworking/Security (3.2.1)
+  - AFNetworking/Serialization (3.2.1)
+  - AFNetworking/UIKit (3.2.1):
+    - AFNetworking/NSURLSession
   - Alamofire (4.8.2)
   - AlivcConan (0.9.4):
     - AlivcConan/AlivcConan (= 0.9.4)
@@ -16,6 +31,7 @@ PODS:
   - FWPopupView (4.0.7):
     - SnapKit
   - IQKeyboardManagerSwift (6.4.0)
+  - JSONModel (1.7.0)
   - JXSegmentedView (0.0.18)
   - KeychainAccess (3.2.0)
   - Kingfisher (4.10.1)
@@ -62,8 +78,10 @@ PODS:
   - VODUpload (1.5.1):
     - AliyunOSSiOS
   - WebViewJavascriptBridge (6.0.3)
+  - ZipArchive (1.4.0)
 
 DEPENDENCIES:
+  - AFNetworking (~> 3.0)
   - Alamofire
   - AlivcConan
   - AliyunOSSiOS
@@ -76,6 +94,7 @@ DEPENDENCIES:
   - FSPagerView
   - FWPopupView
   - IQKeyboardManagerSwift
+  - JSONModel (~> 1.7.0)
   - JXSegmentedView
   - KeychainAccess
   - Kingfisher
@@ -102,9 +121,11 @@ DEPENDENCIES:
   - UMCShare/UI
   - VODUpload
   - WebViewJavascriptBridge
+  - ZipArchive (= 1.4.0)
 
 SPEC REPOS:
   https://github.com/cocoapods/specs.git:
+    - AFNetworking
     - Alamofire
     - AlivcConan
     - AliyunOSSiOS
@@ -117,6 +138,7 @@ SPEC REPOS:
     - FSPagerView
     - FWPopupView
     - IQKeyboardManagerSwift
+    - JSONModel
     - JXSegmentedView
     - KeychainAccess
     - Kingfisher
@@ -141,8 +163,10 @@ SPEC REPOS:
     - UMCShare
     - VODUpload
     - WebViewJavascriptBridge
+    - ZipArchive
 
 SPEC CHECKSUMS:
+  AFNetworking: b6f891fdfaed196b46c7a83cf209e09697b94057
   Alamofire: ae5c501addb7afdbb13687d7f2f722c78734c2d3
   AlivcConan: f75de70ee0c260cfcfc7885a7ee9c1efb877c974
   AliyunOSSiOS: 602b6a4e70e62a5f0a6431c20496343141d7e66f
@@ -155,6 +179,7 @@ SPEC CHECKSUMS:
   FSPagerView: 816a18842306973cc7cc6df8a5332272f7815c30
   FWPopupView: c1dbb33fbe4d223f619f28a7e5e5a00f08c10342
   IQKeyboardManagerSwift: ed9b04ee0e3067ffba543283462d619f944b05e5
+  JSONModel: 840bc0fcffb24b8454d2c026bf26fea454b8e98d
   JXSegmentedView: 2358f1335409659c7e7e79d6ff7532c014e21fe1
   KeychainAccess: 3b1bf8a77eb4c6ea1ce9404c292e48f948954c6b
   Kingfisher: c148cd7b47ebde9989f6bc7c27dcaa79d81279a0
@@ -179,7 +204,8 @@ SPEC CHECKSUMS:
   UMCShare: 552b29753f1b4da87b51d96545ed19e6263df397
   VODUpload: d180069b5fcee002079a892de2f310bacdb8e355
   WebViewJavascriptBridge: 7f5bc4d3581e672e8f32bd0f812d54bc69bb8e29
+  ZipArchive: e25a4373192673e3229ac8d6e9f64a3e5713c966
 
-PODFILE CHECKSUM: 09b38253f1edcde3ac44db3c538cf38936e7dfdf
+PODFILE CHECKSUM: f2515813b84520a070f88feee517e629257bda36
 
 COCOAPODS: 1.7.1

Diferenças do arquivo suprimidas por serem muito extensas
+ 758 - 12
RainbowPlanet/RainbowPlanet.xcodeproj/project.pbxproj


+ 5 - 0
RainbowPlanet/RainbowPlanet/Macro/RainbowPlanet-Bridging-Header.h

@@ -69,4 +69,9 @@
 #import "QUProgressView.h"
 
 
+#import "AliyunMagicCameraViewController.h"
+#import "AliyunCropViewController.h"
+#import "AliyunCoverPickViewController.h"
+
+
 #endif /* RainbowPlanet_Bridging_Header_h */

+ 20 - 0
RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcBeaitufySettingsPanel/AlivcBeautySettingUIDefine.h

@@ -0,0 +1,20 @@
+//
+//  AlivcBeautySettingUIDefine.h
+//  AliyunVideoClient_Entrance
+//
+//  Created by Zejian Cai on 2018/7/26.
+//  Copyright © 2018年 Alibaba. All rights reserved.
+//
+
+#import <Foundation/Foundation.h>
+
+typedef NS_ENUM(NSInteger,AlivcBeautySettingViewStyle){
+    AlivcBeautySettingViewStyle_Default = 0, //正常的,默认的界面
+    AlivcBeautySettingViewStyle_ShortVideo_BeautyFace_Base = 1, //短视频里的基础美颜
+    AlivcBeautySettingViewStyle_ShortVideo_BeautyFace_Advanced = 2, //短视频里的高级美颜
+    AlivcBeautySettingViewStyle_ShortVideo_BeautySkin = 3, //短视频里的美肌,没有高级普通的区分
+};
+
+@interface AlivcBeautySettingUIDefine : NSObject
+
+@end

+ 13 - 0
RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcBeaitufySettingsPanel/AlivcBeautySettingUIDefine.m

@@ -0,0 +1,13 @@
+//
+//  AlivcBeautySettingUIDefine.m
+//  AliyunVideoClient_Entrance
+//
+//  Created by Zejian Cai on 2018/7/26.
+//  Copyright © 2018年 Alibaba. All rights reserved.
+//
+
+#import "AlivcBeautySettingUIDefine.h"
+
+@implementation AlivcBeautySettingUIDefine
+
+@end

+ 156 - 0
RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcBeaitufySettingsPanel/AlivcPushBeautyDataManager.h

@@ -0,0 +1,156 @@
+//
+//  AlivcPushBeautyDataManager.h
+//  AliyunVideoClient_Entrance
+//
+//  Created by Zejian Cai on 2018/8/6.
+//  Copyright © 2018年 Alibaba. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+#import "AlivcPushBeautyParams.h"
+
+@interface AlivcPushBeautyDataManager : NSObject
+
+/**
+ 美颜数据管理器
+
+ @param type 美颜参数类型
+ @param customSaveString 自定义存储字符串,一个字符串对应一个本地的美颜参数存储,为空:默认的本地存储器(@"AlivcPushBeautyParamsTypeLive"和@“AlivcPushBeautyParamsTypeShortVideo”是内置的默认的2个存储器),不为空:每个值对应一个存储器,别和默认存储的字符串值一样,那就是一个新的存储器,用于工程里有多个美颜界面,但是彼此间数据又想保持独立的需求
+ @return 实例化对象
+ */
+- (instancetype)initWithType:(AlivcPushBeautyParamsType)type customSaveString:(NSString *__nullable)customSaveString;
+
+/**
+ default beauty AlivcBeautyParamsLevel
+ 
+ @return AlivcBeautyParamsLevel
+ */
+- (AlivcPushBeautyParamsLevel)defaultBeautyLevel;
+
+/**
+ default beauty params
+ 
+ @param level AlivcBeautyParamsLevel
+ @return AlivcBeautyParams
+ */
+- (AlivcPushBeautyParams *)defaultBeautyParamsWithLevel:(AlivcPushBeautyParamsLevel)level;
+
+/**
+ 获取当前的美颜等级
+ 
+ @return 当前的美颜等级
+ */
+- (AlivcPushBeautyParamsLevel)getBeautyLevel;
+
+
+/**
+ 存储当前的美颜等级
+ 
+ @param level 当前的美颜等级
+ */
+- (void)saveBeautyLevel:(AlivcPushBeautyParamsLevel)level;
+
+
+/**
+ 获取美颜等级对应的各美颜参数model
+ 
+ @param level 美颜等级
+ @return 美颜参数model
+ */
+- (AlivcPushBeautyParams *)getBeautyParamsOfLevel:(AlivcPushBeautyParamsLevel)level;
+
+
+/**
+ 存储美颜参数
+ 
+ @param beautyParams 美颜参数
+ @param level 存储的美颜参数对应的美颜等级
+ */
+- (void)saveBeautyParams:(AlivcPushBeautyParams *)beautyParams level:(AlivcPushBeautyParamsLevel)level;
+
+
+/**
+ 存储单个美颜项目的数值
+ 
+ @param count 美颜的数值
+ @param identifer 标记美颜项目的值
+ @param level 美颜等级
+ */
+- (void)saveParam:(NSInteger)count identifer:(NSString *)identifer level:(AlivcPushBeautyParamsLevel)level;
+
+/**
+ 存储美颜参数 - 当美颜某个值具体改变的时候
+ 
+ @param info AlivcLiveBeautifySettingsViewControllerDelegate 回调里的info
+ */
+- (void)saveParamWithInfo:(NSDictionary *)info;
+
+
+/**
+ 获取用于界面生成的各个等级的美颜数据 默认是7个,分别为
+ 0:磨皮 Skin Polishing
+ 1:美白  Skin Whitening
+ 2:红润 Skin Shining
+ 3:缩下巴  Chin Reducing
+ 4:大眼  Eye Widening
+ 5:瘦脸 Face Slimming
+ 6:腮红 beauty_cheekpink
+ 
+ @return 各个等级的美颜数据
+ */
+- (NSArray<NSDictionary *> *)beautyDetailItems;
+
+#pragma mark - 用于生成界面的各个参数的字典,供开发者自由组合
+
+/**
+ 0:磨皮 Skin Polishing
+ 
+ @return 0:磨皮 Skin Polishing
+ */
+- (NSDictionary *)SkinPolishingDic;
+
+/**
+ 1:美白  Skin Whitening
+ 
+ @return 1:美白  Skin Whitening
+ */
+- (NSDictionary *)SkinWhiteningDic;
+
+/**
+ 2:红润 Skin Shining
+ 
+ @return 2:红润 Skin Shining
+ */
+- (NSDictionary *)SkinShiningDic;
+
+/**
+ 3:缩下巴  Chin Reducing
+ 
+ @return 3:缩下巴  Chin Reducing
+ */
+- (NSDictionary *)ChinReducingDic;
+
+/**
+ 4:大眼  Eye Widening
+ 
+ @return 4:大眼  Eye Widening
+ */
+- (NSDictionary *)EyeWideningDic;
+
+/**
+ 5:瘦脸 Face Slimming
+ 
+ @return 5:瘦脸 Face Slimming
+ */
+- (NSDictionary *)FaceSlimmingDic;
+
+/**
+ 6:腮红 beauty_cheekpink
+ 
+ @return 6:腮红 beauty_cheekpink
+ */
+- (NSDictionary *)beautyCheekpinkDic;
+
+
+
+@end

+ 577 - 0
RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcBeaitufySettingsPanel/AlivcPushBeautyDataManager.m

@@ -0,0 +1,577 @@
+//
+//  AlivcPushBeautyDataManager.m
+//  AliyunVideoClient_Entrance
+//
+//  Created by Zejian Cai on 2018/8/6.
+//  Copyright © 2018年 Alibaba. All rights reserved.
+//
+
+#import "AlivcPushBeautyDataManager.h"
+#import "NSString+AlivcHelper.h"
+
+static const int AlivcBeautyWhiteDefault = 70;
+static const int AlivcBeautyBuffingDefault = 40;
+static const int AlivcBeautyRuddyDefault = 40;
+static const int AlivcBeautyCheekPinkDefault = 15;
+static const int AlivcBeautyThinFaceDefault = 40;
+static const int AlivcBeautyShortenFaceDefault = 50;
+static const int AlivcBeautyBigEyeDefault = 30;
+
+@interface AlivcPushBeautyDataManager()
+
+@property (assign, nonatomic) AlivcPushBeautyParamsType type;
+
+@property (strong, nonatomic) NSString *levelKey;
+
+@property (strong, nonatomic) NSString *customSaveString;
+
+@property (assign, nonatomic) BOOL haveSavedDefaultValue; //存储过默认值
+
+@end
+
+
+@implementation AlivcPushBeautyDataManager
+
+- (instancetype)initWithType:(AlivcPushBeautyParamsType)type customSaveString:(NSString * _Nullable)customSaveString{
+    self = [super init];
+    if (self) {
+        _type = type;
+        switch (_type) {
+            case AlivcPushBeautyParamsTypeLive:
+                _customSaveString = @"AlivcPushBeautyParamsTypeLive";
+                break;
+            case AlivcPushBeautyParamsTypeShortVideo:
+                _customSaveString = @"AlivcPushBeautyParamsTypeShortVideo";
+                break;
+                
+            default:
+                break;
+        }
+        if (customSaveString) {
+            _customSaveString = customSaveString;
+        }
+        _levelKey = [NSString stringWithFormat:@"levelKey_%@",_customSaveString];
+        [self saveDefaultParams];
+    }
+    return self;
+}
+
+- (AlivcPushBeautyParams *)defaultBeautyParamsWithLevel:(AlivcPushBeautyParamsLevel)level{
+    AlivcPushBeautyParams *params = [[AlivcPushBeautyParams alloc] init];
+    switch (self.type) {
+        case AlivcPushBeautyParamsTypeLive:{
+            CGFloat scale = 1;
+            if (level == AlivcPushBeautyParamsLevel0) {
+                scale = 0;
+            }else if(level == AlivcPushBeautyParamsLevel1){
+                scale = 0.3;
+            }else if(level == AlivcPushBeautyParamsLevel2){
+                scale = 0.6;
+            }else if(level == AlivcPushBeautyParamsLevel3){
+                scale = 1;
+            }else if(level == AlivcPushBeautyParamsLevel4){
+                scale = 1.2;
+            }else if(level == AlivcPushBeautyParamsLevel5){
+                scale = 1.5;
+            }
+            params.beautyWhite = AlivcBeautyWhiteDefault * scale > 100 ? 100 : AlivcBeautyWhiteDefault * scale;
+            params.beautyBuffing = AlivcBeautyBuffingDefault * scale > 100 ? 100 : AlivcBeautyBuffingDefault * scale;
+            params.beautyRuddy = AlivcBeautyRuddyDefault * scale > 100 ? 100 : AlivcBeautyRuddyDefault * scale;
+            params.beautyCheekPink = AlivcBeautyCheekPinkDefault * scale > 100 ? 100 : AlivcBeautyCheekPinkDefault * scale;
+            params.beautySlimFace = AlivcBeautyThinFaceDefault * scale > 100 ? 100 : AlivcBeautyThinFaceDefault * scale;
+            params.beautyShortenFace = AlivcBeautyShortenFaceDefault * scale > 100 ?  100 : AlivcBeautyShortenFaceDefault * scale;
+            params.beautyBigEye = AlivcBeautyBigEyeDefault * scale > 100 ? 100 : AlivcBeautyBigEyeDefault * scale;
+        }
+            break;
+            
+        case AlivcPushBeautyParamsTypeShortVideo:{
+            //短视频的参数没有规律可言,这里统一定死赋值吧,清晰明了
+            switch (level) {
+                case 0:
+                {
+                    params.beautyWhite = 0;
+                    params.beautyBuffing = 0;
+                    params.beautyRuddy = 0;
+                    params.beautyCheekPink = 0;
+                    params.beautySlimFace = 0;
+                    params.beautyShortenFace = 0;
+                    params.beautyBigEye = 0;
+                }
+                    break;
+                case 1:
+                {
+                    params.beautyWhite = 20;
+                    params.beautyBuffing = 10;
+                    params.beautyRuddy = 20;
+                    params.beautyCheekPink = 20;
+                    params.beautySlimFace = 20;
+                    params.beautyShortenFace = 20;
+                    params.beautyBigEye = 20;
+                }
+                    break;
+                case 2:
+                {
+                    params.beautyWhite = 40;
+                    params.beautyBuffing = 30;
+                    params.beautyRuddy = 40;
+                    params.beautyCheekPink = 40;
+                    params.beautySlimFace = 40;
+                    params.beautyShortenFace = 40;
+                    params.beautyBigEye = 40;
+                }
+                    break;
+                case 3:
+                {
+                    params.beautyWhite = 60;
+                    params.beautyBuffing = 60;
+                    params.beautyRuddy = 60;
+                    params.beautyCheekPink = 60;
+                    params.beautySlimFace = 60;
+                    params.beautyShortenFace = 60;
+                    params.beautyBigEye = 60;
+                }
+                    break;
+                case 4:
+                {
+                    params.beautyWhite = 80;
+                    params.beautyBuffing = 85;
+                    params.beautyRuddy = 80;
+                    params.beautyCheekPink = 80;
+                    params.beautySlimFace = 80;
+                    params.beautyShortenFace = 80;
+                    params.beautyBigEye = 80;
+                }
+                    break;
+                case 5:
+                {
+                    params.beautyWhite = 100;
+                    params.beautyBuffing = 100;
+                    params.beautyRuddy = 100;
+                    params.beautyCheekPink = 100;
+                    params.beautySlimFace = 100;
+                    params.beautyShortenFace = 100;
+                    params.beautyBigEye = 100;
+                }
+                    break;
+                    
+                default:
+                    break;
+            }
+        }
+            break;
+            
+        default:
+            break;
+    }
+    return params;
+    
+}
+
+- (AlivcPushBeautyParamsLevel)defaultBeautyLevel{
+    switch (self.type) {
+        case AlivcPushBeautyParamsTypeLive:
+            return AlivcPushBeautyParamsLevel4;
+            break;
+        case AlivcPushBeautyParamsTypeShortVideo:
+            return AlivcPushBeautyParamsLevel3;
+            break;
+        default:
+            break;
+    }
+    
+}
+
+
+- (AlivcPushBeautyParamsLevel)getBeautyLevel{
+    
+    NSString *beautyLevelString = [[NSUserDefaults standardUserDefaults] objectForKey:_levelKey];
+    if(beautyLevelString){
+        AlivcPushBeautyParamsLevel level = [beautyLevelString integerValue];
+        return level;
+    }
+    return [self defaultBeautyLevel];
+}
+
+- (void)saveBeautyLevel:(AlivcPushBeautyParamsLevel)level{
+    
+    [[NSUserDefaults standardUserDefaults] setObject:@(level).stringValue forKey:_levelKey];
+}
+    
+- (void)saveDefaultParams{
+    _haveSavedDefaultValue = [[NSUserDefaults standardUserDefaults]boolForKey:_customSaveString];
+    if (!_haveSavedDefaultValue) {
+        for(int i = 0;i < 6;i ++){
+            AlivcPushBeautyParams *params = [self defaultBeautyParamsWithLevel:i];
+            [self saveBeautyParams:params level:i];
+        }
+        [[NSUserDefaults standardUserDefaults]setBool:YES forKey:_customSaveString];
+    }
+   
+
+}
+
+
+- (AlivcPushBeautyParams *)getBeautyParamsOfLevel:(AlivcPushBeautyParamsLevel)level{
+    AlivcPushBeautyParams *parames = [[AlivcPushBeautyParams alloc]init];
+    
+    NSString *beautyWhiteStr = [[NSUserDefaults standardUserDefaults]objectForKey:[self beautyWhiteSaveKeyStringWithLevel:level]];
+    
+    if (!beautyWhiteStr) { //说明还没有存储过,取默认值
+        parames = [self defaultBeautyParamsWithLevel:level];
+        [self saveBeautyParams:parames level:level]; // 做一次存储
+        return parames;
+    }
+    
+    
+    int beautyWhite= [beautyWhiteStr intValue];
+    parames.beautyWhite = beautyWhite;
+    
+    NSString *beautyBuffingString = [[NSUserDefaults standardUserDefaults]objectForKey:[self beautyBuffingSaveKeyStringWithLevel:level]];
+    int beautyBuffing= [beautyBuffingString intValue];
+    parames.beautyBuffing = beautyBuffing;
+    
+    NSString *beautyRuddyStr = [[NSUserDefaults standardUserDefaults]objectForKey:[self beautyRuddySaveKeyStringWithLevel:level]];
+    int beautyRuddy= [beautyRuddyStr intValue];
+    parames.beautyRuddy = beautyRuddy;
+    
+    NSString *beautyCheekPinkStr = [[NSUserDefaults standardUserDefaults]objectForKey:[self beautyCheekPinkSaveKeyStringWithLevel:level]];
+    int beautyCheekPink= [beautyCheekPinkStr intValue];
+    parames.beautyCheekPink = beautyCheekPink;
+    
+    NSString *beautySlimFaceStr = [[NSUserDefaults standardUserDefaults]objectForKey:[self beautySlimFaceSaveKeyStringWithLevel:level]];
+    int beautySlimFace= [beautySlimFaceStr intValue];
+    parames.beautySlimFace = beautySlimFace;
+    
+    NSString *beautyShortenFaceStr = [[NSUserDefaults standardUserDefaults]objectForKey:[self beautyShortenFaceSaveKeyStringWithLevel:level]];
+    int beautyShortenFace= [beautyShortenFaceStr intValue];
+    parames.beautyShortenFace = beautyShortenFace;
+    
+    NSString *beautyBigEyeStr = [[NSUserDefaults standardUserDefaults]objectForKey:[self beautyBigEyeSaveKeyStringWithLevel:level]];
+    int beautyBigEye= [beautyBigEyeStr intValue];
+    parames.beautyBigEye = beautyBigEye;
+    
+  
+    return parames;
+}
+
+- (void)saveBeautyParams:(AlivcPushBeautyParams *)beautyParams level:(AlivcPushBeautyParamsLevel)level{
+    
+    NSString *beautyWhite = [NSString stringWithFormat:@"%ld",(long)beautyParams.beautyWhite];
+    [[NSUserDefaults standardUserDefaults]setObject:beautyWhite forKey:[self beautyWhiteSaveKeyStringWithLevel:level]];
+    
+    NSString *beautyBuffing = [NSString stringWithFormat:@"%ld",(long)beautyParams.beautyBuffing];
+    [[NSUserDefaults standardUserDefaults]setObject:beautyBuffing forKey:[self beautyBuffingSaveKeyStringWithLevel:level]];
+    
+    NSString *beautyRuddy = [NSString stringWithFormat:@"%ld",(long)beautyParams.beautyRuddy];
+    [[NSUserDefaults standardUserDefaults]setObject:beautyRuddy forKey:[self beautyRuddySaveKeyStringWithLevel:level]];
+    
+    NSString *beautySlimFace = [NSString stringWithFormat:@"%ld",(long)beautyParams.beautySlimFace];
+    [[NSUserDefaults standardUserDefaults]setObject:beautySlimFace forKey:[self beautySlimFaceSaveKeyStringWithLevel:level]];
+    
+    NSString *beautyShortenFace = [NSString stringWithFormat:@"%ld",(long)beautyParams.beautyShortenFace];
+    [[NSUserDefaults standardUserDefaults]setObject:beautyShortenFace forKey:[self beautyShortenFaceSaveKeyStringWithLevel:level]];
+    
+    NSString *beautyBigEye = [NSString stringWithFormat:@"%ld",(long)beautyParams.beautyBigEye];
+    [[NSUserDefaults standardUserDefaults]setObject:beautyBigEye forKey:[self beautyBigEyeSaveKeyStringWithLevel:level]];
+    
+    NSString *beautyCheekPink = [NSString stringWithFormat:@"%ld",(long)beautyParams.beautyCheekPink];
+    [[NSUserDefaults standardUserDefaults]setObject:beautyCheekPink forKey:[self beautyCheekPinkSaveKeyStringWithLevel:level]];
+}
+
+
+- (void)saveParam:(NSInteger)count identifer:(NSString *)identifer level:(AlivcPushBeautyParamsLevel)level{
+    
+    if ([identifer isEqualToString:@"0"]) {
+        
+        [[NSUserDefaults standardUserDefaults]setObject:@(count).stringValue forKey:[self beautyBuffingSaveKeyStringWithLevel:level]];
+        
+    }else if ([identifer isEqualToString:@"1"]) {
+        
+        [[NSUserDefaults standardUserDefaults]setObject:@(count).stringValue forKey:[self beautyWhiteSaveKeyStringWithLevel:level]];
+    }else if ([identifer isEqualToString:@"2"]) {
+        
+        [[NSUserDefaults standardUserDefaults]setObject:@(count).stringValue forKey:[self beautyRuddySaveKeyStringWithLevel:level]];
+    }else if ([identifer isEqualToString:@"3"]) {
+        
+        [[NSUserDefaults standardUserDefaults]setObject:@(count).stringValue forKey:[self beautyShortenFaceSaveKeyStringWithLevel:level]];
+    }else if ([identifer isEqualToString:@"4"]) {
+        
+        [[NSUserDefaults standardUserDefaults]setObject:@(count).stringValue forKey:[self beautyBigEyeSaveKeyStringWithLevel:level]];
+    }else if ([identifer isEqualToString:@"5"]) {
+        
+        [[NSUserDefaults standardUserDefaults]setObject:@(count).stringValue forKey:[self beautySlimFaceSaveKeyStringWithLevel:level]];
+    }else if ([identifer isEqualToString:@"6"]){
+        
+        [[NSUserDefaults standardUserDefaults]setObject:@(count).stringValue forKey:[self beautyCheekPinkSaveKeyStringWithLevel:level]];
+    }
+}
+
+- (void)saveParamWithInfo:(NSDictionary *)info{
+    [self saveParam:[info[@"value"] integerValue] identifer:info[@"identifier"] level:[self getBeautyLevel]];
+    //都存储一遍
+    
+}
+
+
+
+
+- (NSArray<NSDictionary *> *)beautyDetailItems{
+    AlivcPushBeautyParamsLevel level = [self getBeautyLevel];
+    AlivcPushBeautyParams *params = [self getBeautyParamsOfLevel:level];
+    AlivcPushBeautyParams *defaultParams = [self defaultBeautyParamsWithLevel:level];
+    
+    NSArray<NSDictionary *> *detailItems =
+    @[
+      @{
+          @"title":[@"Skin Polishing" localString],
+          @"identifier":@"0",
+          @"icon_name":@"ic_buffing",
+          @"value":@(params.beautyBuffing),
+          @"originalValue":@(defaultParams.beautyBuffing),
+          @"minimumValue":@(0),
+          @"maximumValue":@(100),
+          },
+      @{
+          @"title":[@"Skin Whitening" localString],
+          @"identifier":@"1",
+          @"icon_name":@"ic_beauty_white",
+          @"value":@(params.beautyWhite),
+          @"originalValue":@(defaultParams.beautyWhite),
+          @"minimumValue":@(0),
+          @"maximumValue":@(100)
+          },
+      @{
+          @"title":[@"Skin Shining" localString],
+          @"identifier":@"2",
+          @"icon_name":@"ic_Ruddy",
+          @"value":@(params.beautyRuddy),
+          @"originalValue":@(defaultParams.beautyRuddy),
+          @"minimumValue":@(0),
+          @"maximumValue":@(100)
+          },
+      @{
+          @"title":[@"Chin Reducing" localString],
+          @"identifier":@"3",
+          @"icon_name":@"ic_shorface",
+          @"value":@(params.beautyShortenFace),
+          @"originalValue":@(defaultParams.beautyShortenFace),
+          @"minimumValue":@(0),
+          @"maximumValue":@(100)
+          },
+      @{
+          @"title":[@"Eye Widening" localString],
+          @"identifier":@"4",
+          @"icon_name":@"ic_bigeye",
+          @"value":@(params.beautyBigEye),
+          @"originalValue":@(defaultParams.beautyBigEye),
+          @"minimumValue":@(0),
+          @"maximumValue":@(100)
+          },
+      @{
+          @"title":[@"Face Slimming" localString],
+          @"identifier":@"5",
+          @"icon_name":@"ic_slimface",
+          @"value":@(params.beautySlimFace),
+          @"originalValue":@(defaultParams.beautySlimFace),
+          @"minimumValue":@(0),
+          @"maximumValue":@(100)
+          },
+      @{
+          @"title":[@"beauty_cheekpink" localString],
+          @"identifier":@"6",
+          @"icon_name":@"ic_face_red",
+          @"value":@(params.beautyRuddy),
+          @"originalValue":@(defaultParams.beautyRuddy),
+          @"minimumValue":@(0),
+          @"maximumValue":@(100)
+          }
+      ];
+    return detailItems;
+}
+
+#pragma mark - 用于生成界面的各个参数的字典,供开发者自由组合
+
+/**
+ 0:磨皮 Skin Polishing
+ 
+ @return 0:磨皮 Skin Polishing
+ */
+- (NSDictionary *)SkinPolishingDic{
+    AlivcPushBeautyParamsLevel level = [self getBeautyLevel];
+    AlivcPushBeautyParams *params = [self getBeautyParamsOfLevel:level];
+    AlivcPushBeautyParams *defaultParams = [self defaultBeautyParamsWithLevel:level];
+    return  @{
+              @"title":[@"Skin Polishing" localString],
+              @"identifier":@"0",
+              @"icon_name":@"ic_buffing",
+              @"value":@(params.beautyBuffing),
+              @"originalValue":@(defaultParams.beautyBuffing),
+              @"minimumValue":@(0),
+              @"maximumValue":@(100),
+              };
+}
+
+/**
+ 1:美白  Skin Whitening
+ 
+ @return 1:美白  Skin Whitening
+ */
+- (NSDictionary *)SkinWhiteningDic{
+    AlivcPushBeautyParamsLevel level = [self getBeautyLevel];
+    AlivcPushBeautyParams *params = [self getBeautyParamsOfLevel:level];
+    AlivcPushBeautyParams *defaultParams = [self defaultBeautyParamsWithLevel:level];
+    return @{
+             @"title":[@"Skin Whitening" localString],
+             @"identifier":@"1",
+             @"icon_name":@"ic_beauty_white",
+             @"value":@(params.beautyWhite),
+             @"originalValue":@(defaultParams.beautyWhite),
+             @"minimumValue":@(0),
+             @"maximumValue":@(100)
+             };
+}
+
+/**
+ 2:红润 Skin Shining
+ 
+ @return 2:红润 Skin Shining
+ */
+- (NSDictionary *)SkinShiningDic{
+    AlivcPushBeautyParamsLevel level = [self getBeautyLevel];
+    AlivcPushBeautyParams *params = [self getBeautyParamsOfLevel:level];
+    AlivcPushBeautyParams *defaultParams = [self defaultBeautyParamsWithLevel:level];
+    return @{
+             @"title":[@"Skin Shining" localString],
+             @"identifier":@"2",
+             @"icon_name":@"ic_Ruddy",
+             @"value":@(params.beautyRuddy),
+             @"originalValue":@(defaultParams.beautyRuddy),
+             @"minimumValue":@(0),
+             @"maximumValue":@(100)
+             };
+}
+
+/**
+ 3:缩下巴  Chin Reducing
+ 
+ @return 3:缩下巴  Chin Reducing
+ */
+- (NSDictionary *)ChinReducingDic{
+    AlivcPushBeautyParamsLevel level = [self getBeautyLevel];
+    AlivcPushBeautyParams *params = [self getBeautyParamsOfLevel:level];
+    AlivcPushBeautyParams *defaultParams = [self defaultBeautyParamsWithLevel:level];
+    return   @{
+               @"title":[@"Chin Reducing" localString],
+               @"identifier":@"3",
+               @"icon_name":@"ic_shorface",
+               @"value":@(params.beautyShortenFace),
+               @"originalValue":@(defaultParams.beautyShortenFace),
+               @"minimumValue":@(0),
+               @"maximumValue":@(100)
+               };
+}
+
+/**
+ 4:大眼  Eye Widening
+ 
+ @return 4:大眼  Eye Widening
+ */
+- (NSDictionary *)EyeWideningDic{
+    AlivcPushBeautyParamsLevel level = [self getBeautyLevel];
+    AlivcPushBeautyParams *params = [self getBeautyParamsOfLevel:level];
+    AlivcPushBeautyParams *defaultParams = [self defaultBeautyParamsWithLevel:level];
+    return  @{
+              @"title":[@"Eye Widening" localString],
+              @"identifier":@"4",
+              @"icon_name":@"ic_bigeye",
+              @"value":@(params.beautyBigEye),
+              @"originalValue":@(defaultParams.beautyBigEye),
+              @"minimumValue":@(0),
+              @"maximumValue":@(100)
+              };
+}
+
+/**
+ 5:瘦脸 Face Slimming
+ 
+ @return 5:瘦脸 Face Slimming
+ */
+- (NSDictionary *)FaceSlimmingDic{
+    AlivcPushBeautyParamsLevel level = [self getBeautyLevel];
+    AlivcPushBeautyParams *params = [self getBeautyParamsOfLevel:level];
+    AlivcPushBeautyParams *defaultParams = [self defaultBeautyParamsWithLevel:level];
+    return @{
+             @"title":[@"Face Slimming" localString],
+             @"identifier":@"5",
+             @"icon_name":@"ic_slimface",
+             @"value":@(params.beautySlimFace),
+             @"originalValue":@(defaultParams.beautySlimFace),
+             @"minimumValue":@(0),
+             @"maximumValue":@(100)
+             };
+    
+}
+
+/**
+ 6:腮红 beauty_cheekpink
+ 
+ @return 6:腮红 beauty_cheekpink
+ */
+- (NSDictionary *)beautyCheekpinkDic{
+    AlivcPushBeautyParamsLevel level = [self getBeautyLevel];
+    AlivcPushBeautyParams *params = [self getBeautyParamsOfLevel:level];
+    AlivcPushBeautyParams *defaultParams = [self defaultBeautyParamsWithLevel:level];
+    return @{
+             @"title":[@"beauty_cheekpink" localString],
+             @"identifier":@"6",
+             @"icon_name":@"ic_face_red",
+             @"value":@(params.beautyRuddy),
+             @"originalValue":@(defaultParams.beautyRuddy),
+             @"minimumValue":@(0),
+             @"maximumValue":@(100)
+             };
+}
+
+#pragma mark - keyStringManager
+- (NSString *)beautyWhiteSaveKeyStringWithLevel:(AlivcPushBeautyParamsLevel )level{
+    NSString *levelString = @(level).stringValue;
+    NSString *keyString = [NSString stringWithFormat:@"beautyWhite_%@_%@",levelString,self.customSaveString];
+    return keyString;
+}
+
+- (NSString *)beautyBuffingSaveKeyStringWithLevel:(AlivcPushBeautyParamsLevel )level{
+    NSString *levelString = @(level).stringValue;
+    NSString *keyString = [NSString stringWithFormat:@"beautyBuffing_%@_%@",levelString,self.customSaveString];
+    return keyString;
+}
+
+- (NSString *)beautyRuddySaveKeyStringWithLevel:(AlivcPushBeautyParamsLevel )level{
+    NSString *levelString = @(level).stringValue;
+    NSString *keyString = [NSString stringWithFormat:@"beautyRuddy_%@_%@",levelString,self.customSaveString];
+    return keyString;
+}
+
+- (NSString *)beautyCheekPinkSaveKeyStringWithLevel:(AlivcPushBeautyParamsLevel )level{
+    NSString *levelString = @(level).stringValue;
+    NSString *keyString = [NSString stringWithFormat:@"beautyCheek_%@_%@",levelString,self.customSaveString];
+    return keyString;
+}
+
+- (NSString *)beautySlimFaceSaveKeyStringWithLevel:(AlivcPushBeautyParamsLevel )level{
+    NSString *levelString = @(level).stringValue;
+    NSString *keyString = [NSString stringWithFormat:@"beautySlimFace_%@_%@",levelString,self.customSaveString];
+    return keyString;
+}
+
+- (NSString *)beautyShortenFaceSaveKeyStringWithLevel:(AlivcPushBeautyParamsLevel )level{
+    NSString *levelString = @(level).stringValue;
+    NSString *keyString = [NSString stringWithFormat:@"beautyShortenFace_%@_%@",levelString,self.customSaveString];
+    return keyString;
+}
+
+- (NSString *)beautyBigEyeSaveKeyStringWithLevel:(AlivcPushBeautyParamsLevel )level{
+    NSString *levelString = @(level).stringValue;
+    NSString *keyString = [NSString stringWithFormat:@"beautyBigEye_%@_%@",levelString,self.customSaveString];
+    return keyString;
+}
+@end

+ 106 - 0
RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcBeaitufySettingsPanel/AlivcPushBeautyParams.h

@@ -0,0 +1,106 @@
+//
+//  AlivcPushBeautyParams.h
+//  AliyunVideoClient_Entrance
+//
+//  Created by Zejian Cai on 2018/6/20.
+//  Copyright © 2018年 Alibaba. All rights reserved.
+//
+
+#import <Foundation/Foundation.h>
+
+/**
+ 美颜档位
+
+ - AlivcPushBeautyParamsLevel0: 0档
+ - AlivcPushBeautyParamsLevel1: 1档
+ - AlivcPushBeautyParamsLevel2: 2档
+ - AlivcPushBeautyParamsLevel3: 3档
+ - AlivcPushBeautyParamsLevel4: 4档
+ - AlivcPushBeautyParamsLevel5: 5档
+ */
+typedef NS_ENUM(NSInteger,AlivcPushBeautyParamsLevel) {
+    AlivcPushBeautyParamsLevel0 = 0,
+    AlivcPushBeautyParamsLevel1,
+    AlivcPushBeautyParamsLevel2,
+    AlivcPushBeautyParamsLevel3,
+    AlivcPushBeautyParamsLevel4,
+    AlivcPushBeautyParamsLevel5
+};
+
+/**
+ 美颜参数分类设置
+
+ - AlivcPushBeautyParamsTypeLive: 互动直播的美颜参数
+ - AlivcPushBeautyParamsTypeShortVideo: 短视频的美颜参数
+ */
+typedef NS_ENUM(NSInteger,AlivcPushBeautyParamsType) {
+    AlivcPushBeautyParamsTypeLive = 0,
+    AlivcPushBeautyParamsTypeShortVideo,
+};
+
+@interface AlivcPushBeautyParams : NSObject
+/**
+ white
+ 
+ default : 70
+ value range : [0,100]
+ */
+@property (nonatomic, assign) int beautyWhite;
+
+/**
+ buffing
+ 
+ default : 40
+ value range : [0,100]
+ */
+@property (nonatomic, assign) int beautyBuffing;
+
+/**
+ ruddy
+ 
+ default : 70
+ value range : [0,100]
+ */
+@property (nonatomic, assign) int beautyRuddy;
+
+/**
+ pink
+ 
+ default : 15
+ value range : [0,100]
+ */
+@property (nonatomic, assign) int beautyCheekPink;
+
+/**
+ slim face
+ 
+ default : 40
+ value range : [0,100]
+ */
+@property (nonatomic, assign) int beautySlimFace;
+
+/**
+ shorten face
+ 
+ default : 50
+ value range : [0,100]
+ */
+@property (nonatomic, assign) int beautyShortenFace;
+
+/**
+ big eye
+ 
+ default : 30
+ value range : [0,100]
+ */
+
+@property (nonatomic, assign) int beautyBigEye;
+
+/**
+ init
+ 
+ @return AlivcBeautyParams
+ */
+- (instancetype)init;
+
+@end

+ 30 - 0
RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcBeaitufySettingsPanel/AlivcPushBeautyParams.m

@@ -0,0 +1,30 @@
+
+//
+//  AlivcPushBeautyParams.m
+//  AliyunVideoClient_Entrance
+//
+//  Created by Zejian Cai on 2018/6/20.
+//  Copyright © 2018年 Alibaba. All rights reserved.
+//
+
+#import "AlivcPushBeautyParams.h"
+
+
+@implementation AlivcPushBeautyParams
+
+- (instancetype)init {
+    self = [super init];
+    if(self) {
+        self.beautyWhite = 70;
+        self.beautyBuffing = 40;
+        self.beautyRuddy = 40;
+        self.beautyCheekPink = 15;
+        self.beautySlimFace = 40;
+        self.beautyShortenFace = 50;
+        self.beautyBigEye = 30;
+    }
+    return self;
+}
+
+
+@end

+ 30 - 0
RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoCommonFile/AVC_ShortVideo_Config.h

@@ -0,0 +1,30 @@
+//
+//  AVC_ShortVideo_Config.h
+//  AliyunVideoClient_Entrance
+//
+//  Created by Zejian Cai on 2018/3/30.
+//  Copyright © 2018年 Alibaba. All rights reserved.
+//  短视频模块的配置类
+
+#ifndef AVC_ShortVideo_Config_h
+#define AVC_ShortVideo_Config_h
+
+// 之前的遗留代码
+#define DebugModule 0b111101
+
+//当前的版本 默认为自定义版本
+
+#define SDK_VERSION 3
+#define SDK_VERSION_BASE 1      //基础版本
+#define SDK_VERSION_STANDARD 2  //标准版本
+#define SDK_VERSION_CUSTOM 3    //自定义版本
+
+
+#ifdef __OBJC__
+
+#import "AliyunIConfig.h"
+#import "AliyunImage.h"
+
+#endif
+
+#endif /* AVC_ShortVideo_Config_h */

+ 34 - 0
RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoCommonFile/Mediator/AliyunMediator.h

@@ -0,0 +1,34 @@
+//
+//  AliyunMediator.h
+//  AliyunVideo
+//
+//  Created by Worthy on 2017/5/4.
+//  Copyright © 2017年 Alibaba Group Holding Limited. All rights reserved.
+//
+
+#import <Foundation/Foundation.h>
+#import <UIKit/UIKit.h>
+
+extern NSString *const AliyunShortVideoModuleString_VideoShooting;
+extern NSString *const AliyunShortVideoModuleString_VideoEdit;
+extern NSString *const AliyunShortVideoModuleString_VideoClip;
+extern NSString *const AliyunShortVideoModuleString_MagicCamera;
+
+@interface AliyunMediator : NSObject
+
++ (instancetype)shared;
+
+- (UIViewController *)magicCameraModule;
+- (UIViewController *)editModule;
+- (UIViewController *)cropModule;
+- (UIViewController *)liveModule;
+- (UIViewController *)uiComponentModule;
+
+//- (UIViewController *)recordViewController;
+- (UIViewController *)recordViewController_Basic;
+- (UIViewController *)compositionViewController;
+- (UIViewController *)editViewController;
+- (UIViewController *)cropViewController;
+- (UIViewController *)photoViewController;
+
+@end

+ 97 - 0
RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoCommonFile/Mediator/AliyunMediator.m

@@ -0,0 +1,97 @@
+//
+//  AliyunMediator.m
+//  AliyunVideo
+//
+//  Created by Worthy on 2017/5/4.
+//  Copyright © 2017年 Alibaba Group Holding Limited. All rights reserved.
+//
+
+#import "AliyunMediator.h"
+
+NSString *const AliyunShortVideoModuleString_VideoShooting = @"AliyunShortVideoModuleString_VideoShooting";
+NSString *const AliyunShortVideoModuleString_VideoEdit = @"AliyunShortVideoModuleString_VideoEdit";
+NSString *const AliyunShortVideoModuleString_VideoClip = @"AliyunShortVideoModuleString_VideoClip";
+NSString *const AliyunShortVideoModuleString_MagicCamera = @"AliyunShortVideoModuleString_MagicCamera";
+
+@implementation AliyunMediator
+
++ (instancetype)shared {
+    static AliyunMediator *instance;
+    static dispatch_once_t onceToken;
+    dispatch_once(&onceToken, ^{
+        instance = [[AliyunMediator alloc] init];
+    });
+    return instance;
+}
+
+
+#pragma mark - module
+
+- (UIViewController *)magicCameraModule {
+    Class c = NSClassFromString(@"AliyunMagicCameraViewController");
+    UIViewController *vc = (UIViewController *)[[c alloc] init];
+    return vc;
+}
+
+- (UIViewController *)editModule {
+    Class c = NSClassFromString(@"AliyunCompositionViewController");
+    UIViewController *vc = (UIViewController *)[[c alloc] init];
+    return vc;
+}
+
+- (UIViewController *)cropModule {
+    Class c = NSClassFromString(@"AliyunPhotoViewController");
+    UIViewController *vc = (UIViewController *)[[c alloc] init];
+    return vc;
+}
+
+-(UIViewController *)liveModule {
+    return nil;
+}
+
+-(UIViewController *)uiComponentModule {
+    Class c = NSClassFromString(@"AliyunComponentViewController");
+    UIViewController *vc = (UIViewController *)[[c alloc] init];
+    return vc;
+}
+
+#pragma mark - vc
+
+//- (UIViewController *)recordViewController {
+//    Class c = NSClassFromString(@"AliyunRecordViewController");
+//    UIViewController *vc = (UIViewController *)[[c alloc] init];
+//    return vc;
+//}
+
+- (UIViewController *)recordViewController_Basic {
+    Class c = NSClassFromString(@"AlivcBase_RecordViewController");
+    UIViewController *vc = (UIViewController *)[[c alloc] init];
+    return vc;
+}
+
+
+- (UIViewController *)compositionViewController {
+    Class c = NSClassFromString(@"AliyunCompositionViewController");
+    UIViewController *vc = (UIViewController *)[[c alloc] init];
+    return vc;
+}
+
+- (UIViewController *)editViewController {
+    Class c = NSClassFromString(@"AliyunEditViewController");
+    UIViewController *vc = (UIViewController *)[[c alloc] init];
+    return vc;
+}
+
+- (UIViewController *)cropViewController {
+    Class c = NSClassFromString(@"AliyunCropViewController");
+    UIViewController *vc = (UIViewController *)[[c alloc] init];
+    return vc;
+}
+
+- (UIViewController *)photoViewController {
+    Class c = NSClassFromString(@"AliyunPhotoViewController");
+    UIViewController *vc = (UIViewController *)[[c alloc] init];
+    return vc;
+}
+
+@end

+ 276 - 0
RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoCommonFile/Tools/MediaConfig/AliyunMediaConfig.h

@@ -0,0 +1,276 @@
+//
+//  AliyunMediaConfig.h
+//  AliyunVideo
+//
+//  Created by Worthy on 2017/3/11.
+//  Copyright (C) 2010-2017 Alibaba Group Holding Limited. All rights reserved.
+//
+
+#import <Foundation/Foundation.h>
+#import <UIKit/UIKit.h>
+#import <Photos/Photos.h>
+
+/**
+ 清晰度
+
+ - AliyunMediaQualityVeryHight: 超高清
+ - AliyunMediaQualityHight: 高清
+ - AliyunMediaQualityMedium: 普通
+ - AliyunMediaQualityLow: 低
+ - AliyunMediaQualityPoor: 很低
+ - AliyunMediaQualityExtraPoor: 差
+ */
+typedef NS_ENUM(NSInteger, AliyunMediaQuality) {
+    AliyunMediaQualityVeryHight,
+    AliyunMediaQualityHight,
+    AliyunMediaQualityMedium,
+    AliyunMediaQualityLow,
+    AliyunMediaQualityPoor,
+    AliyunMediaQualityExtraPoor
+};
+
+
+/**
+裁剪模式
+
+ - AliyunMediaCutModeScaleAspectFill: 填充
+ - AliyunMediaCutModeScaleAspectCut: 裁剪
+ */
+typedef NS_ENUM(NSInteger, AliyunMediaCutMode) {
+    AliyunMediaCutModeScaleAspectFill = 0,
+    AliyunMediaCutModeScaleAspectCut = 1
+};
+
+/**
+ 编码格式
+
+ - AliyunEncodeModeSoftH264: 软编:提升质量、牺牲速度
+ - AliyunEncodeModeHardH264: 硬编:提升速度、牺牲视频质量
+ */
+typedef NS_ENUM(NSInteger, AliyunEncodeMode) {
+    AliyunEncodeModeHardH264,
+    AliyunEncodeModeSoftFFmpeg
+};
+
+
+/**
+ 视频比例
+
+ - AliyunMediaRatio9To16: 9:16
+ - AliyunMediaRatio3To4: 3:4
+ - AliyunMediaRatio1To1: 1:1
+ - AliyunMediaRatio4To3: 4:3
+ - AliyunMediaRatio16To9: 16:9
+ */
+typedef NS_ENUM(NSInteger, AliyunMediaRatio) {
+    AliyunMediaRatio9To16,
+    AliyunMediaRatio3To4,
+    AliyunMediaRatio1To1,
+    AliyunMediaRatio4To3,
+    AliyunMediaRatio16To9,
+};
+
+
+/**
+ 媒体资源类型
+
+ - kPhotoMediaTypeVideo: 视频
+ - kPhotoMediaTypePhoto: 图片
+ */
+typedef NS_ENUM(NSInteger, kPhotoMediaType) {
+    kPhotoMediaTypeVideo,
+    kPhotoMediaTypePhoto,
+};
+
+@class AVAsset;
+@interface AliyunMediaConfig : NSObject
+
+/**
+ 原视频路径
+ */
+@property (nonatomic, strong) NSString *sourcePath;
+
+/**
+ 原视频时长
+ */
+@property (nonatomic, assign) CGFloat sourceDuration;
+
+/**
+ 输出路径
+ */
+@property (nonatomic, strong) NSString *outputPath;
+
+/**
+ 输出大小
+ */
+@property (nonatomic, assign) CGSize outputSize;
+
+/**
+ 开始时间
+ */
+@property (nonatomic, assign) CGFloat startTime;
+
+/**
+ 结束时间
+ */
+@property (nonatomic, assign) CGFloat endTime;
+
+/**
+ 最小时长
+ */
+@property (nonatomic, assign) CGFloat minDuration;
+
+/**
+ 最大时长
+ */
+@property (nonatomic, assign) CGFloat maxDuration;
+
+/**
+ 裁剪模式
+ */
+@property (nonatomic, assign) AliyunMediaCutMode cutMode;
+
+/**
+ 视频录制清晰度
+ */
+@property (nonatomic, assign) AliyunMediaQuality videoQuality;
+
+/**
+ 编码格式
+ */
+@property (nonatomic, assign) AliyunEncodeMode encodeMode;
+
+/**
+ 帧率
+ */
+@property (nonatomic, assign) int fps;
+
+/**
+ 关键帧间隔
+ */
+@property (nonatomic, assign) int gop;
+
+/**
+ 码率
+ */
+@property (nonatomic, assign) int bitrate;
+
+/**
+ 系统音视频信息类
+ */
+@property (nonatomic, strong) AVAsset *avAsset;
+
+/**
+ 系统相册图片信息类
+ */
+@property (nonatomic, strong) PHAsset *phAsset;
+
+@property (nonatomic, strong) UIImage *phImage;
+
+/**
+ 是否仅展示视频
+ */
+@property (nonatomic, assign) BOOL videoOnly;
+
+/**
+ 视频角度,以第一段为准 0/90/180/270
+ */
+@property (nonatomic, assign) int videoRotate;
+
+/**
+ 填充的背景颜色
+ */
+@property (nonatomic, assign) UIColor *backgroundColor;
+
+/**
+ 是否开启GUP剪裁
+ */
+@property (nonatomic, assign) BOOL gpuCrop;
+
+/**
+ 是否有片尾
+ */
+@property (nonatomic, assign) BOOL hasEnd;
+
+
+/**
+ 获取一个裁剪配置信息类
+
+ @param outputPath 输出路径
+ @param outputSize 输出大小
+ @param minDuration 最小裁剪时长
+ @param maxDuration 最大裁剪时长
+ @param cutMode 裁剪模式
+ @param videoQuality 视频清晰度
+ @param fps 帧率
+ @param gop 码率
+ @return 裁剪配置信息类
+ */
++ (instancetype)cutConfigWithOutputPath:(NSString *)outputPath
+                             outputSize:(CGSize)outputSize
+                            minDuration:(CGFloat)minDuration
+                            maxDuration:(CGFloat)maxDuration
+                                cutMode:(AliyunMediaCutMode)cutMode
+                           videoQuality:(AliyunMediaQuality)videoQuality
+                                    fps:(int)fps
+                                    gop:(int)gop;
+
+/**
+ 获取一个录制配置信息类
+
+ @param outputPath 输出路径
+ @param outputSize 输出大小
+ @param minDuration 最小录制时长
+ @param maxDuration 最大录制时长
+ @param videoQuality 视频清晰度
+ @param encodeMode 编码方式
+ @param fps 帧率
+ @param gop 码率
+ @return 录制配置信息类
+ */
++ (instancetype)recordConfigWithOutpusPath:(NSString *)outputPath
+                                outputSize:(CGSize)outputSize
+                               minDuration:(CGFloat)minDuration
+                               maxDuration:(CGFloat)maxDuration
+                              videoQuality:(AliyunMediaQuality)videoQuality
+                                    encode:(AliyunEncodeMode)encodeMode
+                                       fps:(int)fps
+                                       gop:(int)gop;
+
+/**
+ 初始化config
+
+ @return 初始化后的config
+ */
++ (instancetype)invertConfig;
+
+/**
+ 获取一个默认属性的config
+
+ @return 默认属性的config
+ */
++ (instancetype)defaultConfig;
+
+/**
+ 根据视频角度获取视频大小
+
+ @param r 视频角度
+ @return 视频大小
+ */
+- (CGSize)updateVideoSizeWithRatio:(CGFloat)r;
+
+/**
+ 获取视频角度
+
+ @return 视频角度
+ */
+- (AliyunMediaRatio)mediaRatio;
+
+/**
+ 修正视频size
+
+ @return 修正后的视频size
+ */
+- (CGSize)fixedSize;
+
+@end

+ 131 - 0
RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoCommonFile/Tools/MediaConfig/AliyunMediaConfig.m

@@ -0,0 +1,131 @@
+//
+//  AliyunMediaConfig.m
+//  AliyunVideo
+//
+//  Created by Worthy on 2017/3/11.
+//  Copyright (C) 2010-2017 Alibaba Group Holding Limited. All rights reserved.
+//
+
+#import "AliyunMediaConfig.h"
+
+@implementation AliyunMediaConfig
+
++ (instancetype)cutConfigWithOutputPath:(NSString *)outputPath
+                             outputSize:(CGSize)outputSize
+                            minDuration:(CGFloat)minDuration
+                            maxDuration:(CGFloat)maxDuration
+                                cutMode:(AliyunMediaCutMode)cutMode
+                           videoQuality:(AliyunMediaQuality)videoQuality
+                                    fps:(int)fps
+                                    gop:(int)gop {
+    AliyunMediaConfig *config = [[AliyunMediaConfig alloc] init];
+    config.outputPath = outputPath;
+    config.outputSize = outputSize;
+    config.minDuration = minDuration;
+    config.maxDuration = maxDuration;
+    config.cutMode = cutMode;
+    config.videoQuality = videoQuality;
+    config.fps = fps;
+    config.gop = gop;
+    return config;
+}
+
++ (instancetype)recordConfigWithOutpusPath:(NSString *)outputPath
+                                outputSize:(CGSize)outputSize
+                               minDuration:(CGFloat)minDuration
+                               maxDuration:(CGFloat)maxDuration
+                              videoQuality:(AliyunMediaQuality)videoQuality
+                                    encode:(AliyunEncodeMode)encodeMode
+                                       fps:(int)fps
+                                       gop:(int)gop {
+    AliyunMediaConfig *config = [[AliyunMediaConfig alloc] init];
+    config.outputPath = outputPath;
+    config.outputSize = outputSize;
+    config.minDuration = minDuration;
+    config.maxDuration = maxDuration;
+    config.videoQuality = videoQuality;
+    config.fps = fps;
+    config.gop = gop;
+    config.encodeMode = encodeMode;
+    return config;
+}
+
++ (instancetype)invertConfig {
+    AliyunMediaConfig *config = [[AliyunMediaConfig alloc] init];
+    return config;
+}
+
++ (instancetype)defaultConfig{
+    AliyunMediaConfig *config = [[AliyunMediaConfig alloc] init];
+    config.outputSize = CGSizeMake(720, 1280);
+    config.videoQuality = AliyunMediaQualityHight;
+    config.gop = 250;
+    config.fps = 30;
+    return config;
+}
+
+- (instancetype)init {
+    self = [super init];
+    if (self) {
+        _fps = 25;
+        _gop = 5;
+        _videoQuality = 1;
+        _backgroundColor = [UIColor blackColor];
+    }
+    return self;
+}
+
+- (CGSize)updateVideoSizeWithRatio:(CGFloat)r {
+    
+    CGFloat w = _outputSize.width;
+    CGFloat h = ceilf(w / r);
+    _outputSize = CGSizeMake(w, h);
+    [self evenOutputSize];
+    return _outputSize;
+}
+
+- (CGSize)fixedSize {
+    [self evenOutputSize];
+    //录制传过来的角度
+    if (_videoRotate == 90 || _videoRotate == 270) {
+        return CGSizeMake(MAX(_outputSize.height, _outputSize.width), MIN(_outputSize.height, _outputSize.width));
+    }
+    
+    
+//    if (_videoRotate == 90 || _videoRotate == 270) {
+//        return CGSizeMake(MAX(_outputSize.height, _outputSize.width), MIN(_outputSize.height, _outputSize.width));
+//    }else{
+//        return CGSizeMake(MIN(_outputSize.height, _outputSize.width), MAX(_outputSize.height, _outputSize.width));
+//    }
+    //
+    return _outputSize;
+}
+
+
+//容错,导出须为偶数
+- (void)evenOutputSize {
+    int w = (int)_outputSize.width;
+    int h = (int)_outputSize.height;
+    int fixedW = w / 2 * 2;
+    int fixedH = h / 2 * 2;
+    _outputSize = CGSizeMake((int)fixedW, (int)fixedH);
+}
+
+- (AliyunMediaRatio)mediaRatio {
+    float aspects[5] = {9/16.0, 3/4.0, 1.0, 4/3.0,16/9.0};
+    CGSize fixedSize = [self fixedSize];
+    float videoAspect = fixedSize.width/fixedSize.height;
+    int index = 0;
+    for (int i = 0; i < 5; i++) {
+        index = i;
+        if (videoAspect <= aspects[i]) break;
+    }
+    if (index > 0) {
+        if (fabsf(videoAspect - aspects[index]) > fabsf(videoAspect-aspects[index-1])) {
+            index = index-1;
+        }
+    }
+    return index;
+}
+
+@end

+ 43 - 0
RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoCommonFile/Tools/MusicImport/AliyunLibraryMusicImport.h

@@ -0,0 +1,43 @@
+//
+//  AliyunLibraryMusicImport.h
+//  AliyunVideo
+//
+//  Created by TripleL on 17/3/6.
+//  Copyright (C) 2010-2017 Alibaba Group Holding Limited. All rights reserved.
+//
+
+#import <AVFoundation/AVFoundation.h>
+#define QULibraryImportErrorDomain @"QULibraryImportErrorDomain"
+
+#define QUUnknownError @"QUUnknownError"
+#define QUFileExistsError @"QUFileExistsError"
+
+#define kQUUnknownError -65536
+#define kQUFileExistsError -48 //dupFNErr
+
+
+
+@class AVAssetExportSession;
+
+@interface AliyunLibraryMusicImport : NSObject {
+	AVAssetExportSession* exportSession;
+	NSError* movieFileErr;
+}
+
+/**
+ * Pass in the NSURL* you get from an MPMediaItem's 
+ * MPMediaItemPropertyAssetURL property to get the file's extension.
+ *
+ * Helpful in constructing the destination url for the
+ * imported file.
+ */
++ (NSString*)extensionForAssetURL:(NSURL*)assetURL;
+
+
+- (void)importAsset:(NSURL*)assetURL toURL:(NSURL*)destURL completionBlock:(void (^)(AliyunLibraryMusicImport* import))completionBlock;
+
+@property (readonly) NSError* error;
+@property (readonly) AVAssetExportSessionStatus status;
+@property (readonly) float progress;
+
+@end

+ 188 - 0
RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoCommonFile/Tools/MusicImport/AliyunLibraryMusicImport.m

@@ -0,0 +1,188 @@
+//
+//  AliyunLibraryMusicImport.m
+//  AliyunVideo
+//
+//  Created by TripleL on 17/3/6.
+//  Copyright (C) 2010-2017 Alibaba Group Holding Limited. All rights reserved.
+//
+
+#import "AliyunLibraryMusicImport.h"
+#import <AVFoundation/AVFoundation.h>
+
+@interface AliyunLibraryMusicImport()
+
++ (BOOL)validIpodLibraryURL:(NSURL*)url;
+- (void)extractQuicktimeMovie:(NSURL*)movieURL toFile:(NSURL*)destURL;
+
+@end
+
+
+@implementation AliyunLibraryMusicImport
+
++ (BOOL)validIpodLibraryURL:(NSURL*)url {
+	NSString* IPOD_SCHEME = @"ipod-library";
+	if (nil == url) return NO;
+	if (nil == url.scheme) return NO;
+	if ([url.scheme compare:IPOD_SCHEME] != NSOrderedSame) return NO;
+	if ([url.pathExtension compare:@"mp3"] != NSOrderedSame &&
+		[url.pathExtension compare:@"aif"] != NSOrderedSame &&
+		[url.pathExtension compare:@"m4a"] != NSOrderedSame &&
+		[url.pathExtension compare:@"wav"] != NSOrderedSame) {
+		return NO;
+	}
+	return YES;
+}
+
++ (NSString*)extensionForAssetURL:(NSURL*)assetURL {
+    if (nil == assetURL) {
+        return nil;
+    }
+    if (![AliyunLibraryMusicImport validIpodLibraryURL:assetURL]) {
+        return nil;
+    }
+	return assetURL.pathExtension;
+}
+
+- (void)doMp3ImportToFile:(NSURL*)destURL completionBlock:(void (^)(AliyunLibraryMusicImport* import))completionBlock {
+	//TODO: instead of putting this in the same directory as the dest file, we should probably stuff
+	//this in tmp
+	NSURL* tmpURL = [[destURL URLByDeletingPathExtension] URLByAppendingPathExtension:@"mov"];
+	[[NSFileManager defaultManager] removeItemAtURL:tmpURL error:nil];
+	exportSession.outputURL = tmpURL;
+	
+	exportSession.outputFileType = AVFileTypeQuickTimeMovie;
+	[exportSession exportAsynchronouslyWithCompletionHandler:^(void) {
+		if (exportSession.status == AVAssetExportSessionStatusFailed) {
+			completionBlock(self);
+		} else if (exportSession.status == AVAssetExportSessionStatusCancelled) {
+			completionBlock(self);
+		} else {
+			@try {
+				[self extractQuicktimeMovie:tmpURL toFile:destURL];
+			}
+			@catch (NSException * e) {
+				OSStatus code = noErr;
+				if ([e.name compare:QUUnknownError]) code = kQUUnknownError;
+				else if ([e.name compare:QUFileExistsError]) code = kQUFileExistsError;
+				NSDictionary* errorDict = [NSDictionary dictionaryWithObject:e.reason forKey:NSLocalizedDescriptionKey];
+				
+				movieFileErr = [[NSError alloc] initWithDomain:QULibraryImportErrorDomain code:code userInfo:errorDict];
+			}
+			//clean up the tmp .mov file
+			[[NSFileManager defaultManager] removeItemAtURL:tmpURL error:nil];
+			completionBlock(self);
+		}
+		
+		exportSession = nil;
+	}];	
+}
+
+- (void)importAsset:(NSURL*)assetURL toURL:(NSURL*)destURL completionBlock:(void (^)(AliyunLibraryMusicImport* import))completionBlock {
+    if (nil == assetURL || nil == destURL) {
+        return;
+    }
+    if (![AliyunLibraryMusicImport validIpodLibraryURL:assetURL]) {
+        return;
+    }
+    if ([[NSFileManager defaultManager] fileExistsAtPath:[destURL path]]) {
+        return;
+    }
+	
+	NSDictionary * options = [[NSDictionary alloc] init];
+	AVURLAsset* asset = [AVURLAsset URLAssetWithURL:assetURL options:options];	
+    if (nil == asset) {
+        return;
+    }
+        
+	exportSession = [[AVAssetExportSession alloc] initWithAsset:asset presetName:AVAssetExportPresetPassthrough];
+    if (nil == exportSession) {
+        return;
+    }
+	if ([[assetURL pathExtension] compare:@"mp3"] == NSOrderedSame) {
+		[self doMp3ImportToFile:destURL completionBlock:completionBlock];
+		return;
+	}
+
+	exportSession.outputURL = destURL;
+	NSLog(@"destURL = %@",destURL);
+	// set the output file type appropriately based on asset URL extension
+	if ([[assetURL pathExtension] compare:@"m4a"] == NSOrderedSame) {
+		exportSession.outputFileType = AVFileTypeAppleM4A;
+	} else if ([[assetURL pathExtension] compare:@"wav"] == NSOrderedSame) {
+		exportSession.outputFileType = AVFileTypeWAVE;
+	} else if ([[assetURL pathExtension] compare:@"aif"] == NSOrderedSame) {
+		exportSession.outputFileType = AVFileTypeAIFF;
+	} else {
+		
+	}
+
+	[exportSession exportAsynchronouslyWithCompletionHandler:^(void) {
+		completionBlock(self);
+		
+		exportSession = nil;
+	}];
+}
+
+- (void)extractQuicktimeMovie:(NSURL*)movieURL toFile:(NSURL*)destURL {
+	FILE* src = fopen([[movieURL path] cStringUsingEncoding:NSUTF8StringEncoding], "r");
+	if (NULL == src) {
+		return;
+	}
+	char atom_name[5];
+	atom_name[4] = '\0';
+	unsigned long atom_size = 0;
+	while (true) {
+		if (feof(src)) {
+			break;
+		}
+		fread((void*)&atom_size, 4, 1, src);
+		fread(atom_name, 4, 1, src);
+		atom_size = ntohl(atom_size);
+        const size_t bufferSize = 1024*100;
+		if (strcmp("mdat", atom_name) == 0) {
+			FILE* dst = fopen([[destURL path] cStringUsingEncoding:NSUTF8StringEncoding], "w");
+			unsigned char buf[bufferSize];
+			if (NULL == dst) {
+				fclose(src);
+                return;
+			}
+            // Thanks to Rolf Nilsson/Roni Music for pointing out the bug here:
+            // Quicktime atom size field includes the 8 bytes of the header itself.
+            atom_size -= 8;
+            while (atom_size != 0) {
+                size_t read_size = (bufferSize < atom_size)?bufferSize:atom_size;
+                if (fread(buf, read_size, 1, src) == 1) {
+                    fwrite(buf, read_size, 1, dst);
+                }
+                atom_size -= read_size;
+            }
+			fclose(dst);
+			fclose(src);
+			return;
+		}
+		if (atom_size == 0)
+			break; //0 atom size means to the end of file... if it's not the mdat chunk, we're done
+		fseek(src, atom_size, SEEK_CUR);
+	}
+	fclose(src);
+}
+
+- (NSError*)error {
+	if (movieFileErr) {
+		return movieFileErr;
+	}
+	return exportSession.error;
+}
+
+- (AVAssetExportSessionStatus)status {
+	if (movieFileErr) {
+		return AVAssetExportSessionStatusFailed;
+	}
+	return exportSession.status;
+}
+
+- (float)progress {
+	return exportSession.progress;
+}
+
+@end

RainbowPlanet/RainbowPlanet/Modules/PublishModule/PublishTakeVideo/AliyunPathManager.h → RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoCommonFile/Tools/PathManager/AliyunPathManager.h


+ 0 - 1
RainbowPlanet/RainbowPlanet/Modules/PublishModule/PublishTakeVideo/AliyunPathManager.m

@@ -7,7 +7,6 @@
 //
 
 #import "AliyunPathManager.h"
-//#import "PublishFilterView.swift"
 
 @implementation AliyunPathManager
 

+ 153 - 0
RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoCommonFile/Tools/UIConfig/AliyunIConfig.h

@@ -0,0 +1,153 @@
+//
+//  AliyunIConfig.h
+//  AliyunVideo
+//
+//  Created by mengt on 2017/4/25.
+//  Copyright (C) 2010-2017 Alibaba Group Holding Limited. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+
+@interface AliyunIConfig : NSObject
+
+
+/**
+ 录制模式
+
+ - AliyunIRecordActionTypeClick: 单击拍
+ */
+typedef NS_ENUM(NSInteger, AliyunIRecordActionType) {
+    AliyunIRecordActionTypeClick = 0
+};
+
+
+
+/**
+ 背景颜色
+ */
+@property (nonatomic, strong) UIColor *backgroundColor;
+
+/**
+ timelineView(缩略图)的TintColor
+ */
+@property (nonatomic, strong) UIColor *timelineTintColor;
+/**
+ timelineView(缩略图)的背景色
+ */
+@property (nonatomic, strong) UIColor *timelineBackgroundCollor;
+
+/**
+ 缩略图裁剪掉部分的颜色
+ */
+@property (nonatomic, strong) UIColor *timelineDeleteColor;
+
+/**
+ 时长显示的字体颜色
+ */
+@property (nonatomic, strong) UIColor *durationLabelTextColor;
+
+/**
+ 裁剪底部分割线的颜色
+ */
+@property (nonatomic, strong) UIColor *cutBottomLineColor;
+
+/**
+ 裁剪顶部分割线的颜色
+ */
+@property (nonatomic, strong) UIColor *cutTopLineColor;
+
+/**
+ 无滤镜效果的文字
+ */
+@property (nonatomic,strong) NSString *noneFilterText;
+
+/**
+ 隐藏时间显示lab
+ */
+@property (nonatomic, assign) BOOL hiddenDurationLabel;
+
+/**
+ 隐藏比例按钮
+ */
+@property (nonatomic, assign) BOOL hiddenRatioButton;
+
+/**
+ 隐藏美颜按钮
+ */
+@property (nonatomic, assign) BOOL hiddenBeautyButton;
+
+/**
+ 隐藏拍照按钮
+ */
+@property (nonatomic, assign) BOOL hiddenCameraButton;
+
+/**
+ 隐藏闪光灯开关按钮
+ */
+@property (nonatomic, assign) BOOL hiddenFlashButton;
+
+/**
+ 隐藏视频导入按钮
+ */
+@property (nonatomic, assign) BOOL hiddenImportButton;
+
+/**
+ 隐藏删除按钮
+ */
+@property (nonatomic, assign) BOOL hiddenDeleteButton;
+
+/**
+ 隐藏完成按钮
+ */
+@property (nonatomic, assign) BOOL hiddenFinishButton;
+
+/**
+ 只录制一段视频
+ */
+@property (nonatomic, assign) BOOL recordOnePart;
+
+/**
+ 显示相机按钮
+ */
+@property (nonatomic, assign) BOOL showCameraButton;
+
+/**
+ 图片资源的BundleName,
+ 这个可以在整体打包替换图片资源,只要图片名对上,然后这里改成你打包的BundleName就可以了
+ */
+@property (nonatomic, strong) NSString *imageBundleName;
+
+/**
+ 滤镜特效的BundleName
+ */
+@property (nonatomic, strong) NSString *filterBundleName;
+
+/**
+ 录制模式
+ */
+@property (nonatomic, assign) AliyunIRecordActionType recordType;
+
+/**
+ 滤镜效果数组
+ */
+@property (nonatomic, strong) NSArray *filterArray;
+
+/**
+ 获取当前配置
+
+ @return 当前配置
+ */
++ (AliyunIConfig *)config;
+
+/**
+ 设置一个配置
+
+ @param c 配置类
+ */
++ (void)setConfig:(AliyunIConfig *)c;
+
+- (NSString *)imageName:(NSString *)imageName;
+
+- (NSString *)filterPath:(NSString *)filterName;
+
+@end

Diferenças do arquivo suprimidas por serem muito extensas
+ 66 - 0
RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoCommonFile/Tools/UIConfig/AliyunIConfig.m


+ 14 - 0
RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoCommonFile/Tools/UIConfig/AliyunImage.h

@@ -0,0 +1,14 @@
+//
+//  AliyunImage.h
+//
+//  Created by TripleL on 17/5/9.
+//  Copyright © 2017年 Alibaba Group Holding Limited. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+
+@interface AliyunImage : UIImage
+
++ (UIImage *)imageNamed:(NSString *)name;
+
+@end

+ 19 - 0
RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoCommonFile/Tools/UIConfig/AliyunImage.m

@@ -0,0 +1,19 @@
+//
+//  AliyunImage.m
+//
+//  Created by TripleL on 17/5/9.
+//  Copyright © 2017年 Alibaba Group Holding Limited. All rights reserved.
+//
+
+#import "AliyunImage.h"
+#import "AVC_ShortVideo_Config.h"
+@implementation AliyunImage
+
++ (UIImage *)imageNamed:(NSString *)name {
+    
+    NSString *fullName = [[AliyunIConfig config] imageName:name];
+    
+    return [UIImage imageNamed:fullName];
+}
+
+@end

+ 25 - 0
RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoCommonFile/Vendor/Avasset+VideoSize/AVAsset+VideoInfo.h

@@ -0,0 +1,25 @@
+//
+//  AVAsset+VideoInfo.h
+//  AliyunVideo
+//
+//  Created by dangshuai on 17/1/13.
+//  Copyright (C) 2010-2017 Alibaba Group Holding Limited. All rights reserved.
+//
+
+#import <AVFoundation/AVFoundation.h>
+
+@interface AVAsset (VideoInfo)
+
+- (CGSize)avAssetNaturalSize;
+
+- (CGFloat)avAssetVideoTrackDuration;
+
+- (CGFloat)avAssetAudioTrackDuration;
+
+- (float)frameRate;
+
+- (NSString *)artist;
+
+- (NSString *)title;
+@end
+

+ 84 - 0
RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoCommonFile/Vendor/Avasset+VideoSize/AVAsset+VideoInfo.m

@@ -0,0 +1,84 @@
+//
+//  AVAsset+VideoInfo.m
+//  AliyunVideo
+//
+//  Created by dangshuai on 17/1/13.
+//  Copyright (C) 2010-2017 Alibaba Group Holding Limited. All rights reserved.
+//
+
+#import "AVAsset+VideoInfo.h"
+
+@implementation AVAsset (VideoInfo)
+
+- (CGSize)avAssetNaturalSize {
+    AVAssetTrack *assetTrackVideo;
+    NSArray *videoTracks = [self tracksWithMediaType:AVMediaTypeVideo];
+    if (videoTracks.count) {
+        assetTrackVideo = videoTracks[0];
+    }
+    float sw = assetTrackVideo.naturalSize.width, sh = assetTrackVideo.naturalSize.height;
+    BOOL isAssetPortrait = NO;
+    CGAffineTransform trackTrans = assetTrackVideo.preferredTransform;
+    if ((trackTrans.b == 1.0 && trackTrans.c == -1.0) || (trackTrans.b == -1.0 && trackTrans.c == 1.0)) {
+        isAssetPortrait = YES;
+    }
+    if (isAssetPortrait) {
+        float t = sw;
+        sw = sh;
+        sh = t;
+    }
+    return CGSizeMake(sw, sh);
+}
+
+- (float)frameRate {
+    AVAssetTrack *assetTrackVideo;
+    NSArray *videoTracks = [self tracksWithMediaType:AVMediaTypeVideo];
+    if (videoTracks.count) {
+        assetTrackVideo = videoTracks[0];
+    }
+    return assetTrackVideo.nominalFrameRate;
+}
+
+- (CGFloat)avAssetVideoTrackDuration {
+    
+    NSArray *videoTracks = [self tracksWithMediaType:AVMediaTypeVideo];
+    if (videoTracks.count) {
+        AVAssetTrack *track = videoTracks[0];
+        return CMTimeGetSeconds(CMTimeRangeGetEnd(track.timeRange));
+    }
+    
+    NSArray *audioTracks = [self tracksWithMediaType:AVMediaTypeAudio];
+    if (audioTracks.count) {
+        AVAssetTrack *track = audioTracks[0];
+        return CMTimeGetSeconds(CMTimeRangeGetEnd(track.timeRange));
+    }
+    
+    return -1;
+}
+
+- (CGFloat)avAssetAudioTrackDuration {
+    NSArray *audioTracks = [self tracksWithMediaType:AVMediaTypeAudio];
+    if (audioTracks.count) {
+        AVAssetTrack *track = audioTracks[0];
+        return CMTimeGetSeconds(CMTimeRangeGetEnd(track.timeRange));
+    }
+    
+    return -1;
+}
+
+- (NSString *)title {
+    NSArray<AVMetadataItem *> *artists = [AVMetadataItem metadataItemsFromArray:self.commonMetadata withKey:AVMetadataCommonKeyTitle keySpace:AVMetadataKeySpaceCommon];
+    if (artists.count) {
+        return (NSString *)[artists[0] value];
+    }
+    return nil;
+}
+
+- (NSString *)artist {
+    NSArray<AVMetadataItem *> *artists = [AVMetadataItem metadataItemsFromArray:self.commonMetadata withKey:AVMetadataCommonKeyArtist keySpace:AVMetadataKeySpaceCommon];
+    if (artists.count) {
+        return (NSString *)[artists[0] value];
+    }
+    return nil;
+}
+@end

RainbowPlanet/RainbowPlanet/Modules/PublishModule/PublishTakeVideo/QUProgressView.h → RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoCommonFile/Vendor/ProgressView/QUProgressView.h


+ 7 - 4
RainbowPlanet/RainbowPlanet/Modules/PublishModule/PublishTakeVideo/QUProgressView.m

@@ -7,6 +7,7 @@
 //
 
 #import "QUProgressView.h"
+#import "AVC_ShortVideo_Config.h"
 
 @implementation QUProgressView {
     NSTimer *_timer;
@@ -18,7 +19,7 @@
 - (instancetype)initWithFrame:(CGRect)frame {
     self = [super initWithFrame:frame];
     if (self) {
-        self.backgroundColor = [UIColor colorWithRed:239/255.0f green:75/255.0f blue:129/255.0f alpha:1.0];
+        self.backgroundColor = [AliyunIConfig config].timelineBackgroundCollor;
         [self defaultParam];
     }
     return self;
@@ -28,9 +29,9 @@
     _pointArray = [NSMutableArray arrayWithCapacity:0];
     _lineWidth = CGRectGetHeight(self.bounds) * [UIScreen mainScreen].scale;
     _colorNotice = [UIColor whiteColor];
-    _colorProgress = [UIColor colorWithRed:239/255.0f green:75/255.0f blue:129/255.0f alpha:1.0];
+    _colorProgress = [AliyunIConfig config].timelineTintColor;
     _colorSepatorPoint = [UIColor whiteColor];
-    _colorSelect = [UIColor redColor];
+    _colorSelect = [AliyunIConfig config].timelineDeleteColor;
     _selectedIndex = -1;
 }
 
@@ -82,6 +83,7 @@
     
     CGFloat w = CGRectGetWidth(self.superview.bounds);
     
+    NSLog(@"----videoCount == %ld", _videoCount);
     for (int i = 0; i < _videoCount; i++) {
         CGFloat sp = [_pointArray[i] floatValue];
         if (i == _selectedIndex) {
@@ -96,6 +98,7 @@
         CGContextStrokePath(context);
     }
     
+    NSLog(@"----pointArray.count == %ld", _pointArray.count);
     for (int i = 0; i < _pointArray.count; i++) {
         CGFloat p = [_pointArray[i] floatValue];
         CGContextSetStrokeColorWithColor(context, _colorSepatorPoint.CGColor);
@@ -115,7 +118,7 @@
     if ( _showBlink && (_showBlink ? ++_times : (_times=1)) && (_times%2 == 1)) {
         
         CGFloat x = [self endPointX];
-        CGContextSetStrokeColorWithColor(context, [UIColor colorWithRed:239/255.0f green:75/255.0f blue:129/255.0f alpha:1.0].CGColor);
+        CGContextSetStrokeColorWithColor(context, [[AliyunIConfig config] timelineBackgroundCollor].CGColor);
         CGContextMoveToPoint(context, x + 0.5, 0);
         CGContextAddLineToPoint(context, x + 4, 0);
         CGContextStrokePath(context);

+ 82 - 0
RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoCommonFile/Vendor/UIView+Progress/UIView+Progress.h

@@ -0,0 +1,82 @@
+//
+//  UIView+Progress.h
+//  
+//
+//  Created by lslin on 14-6-13.
+//  Copyright (c) 2014年 lessfun.com. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+
+#pragma mark - PieProgressView
+
+@interface PieProgressView : UIView
+
+/**
+ * The progress range from 0.0 to 1.0.
+ */
+@property (nonatomic) CGFloat progress;
+
+/**
+ * The border margin spacing. default is 6
+ */
+@property (nonatomic) CGFloat borderSpacing;
+
+/**
+ * The color of the progress, default is [UIColor clearColor]
+ */
+@property (nonatomic, strong) UIColor *progressColor;
+
+/**
+ * The color of background mask. default is (255, 255, 255, 0.5).
+ */
+@property (nonatomic, strong) UIColor *backgroundMaskColor;
+
+@end
+
+#pragma mark - RectProgressView
+
+@interface RectProgressView : UIView
+
+/**
+ * The progress range from 0.0 to 1.0.
+ */
+@property (nonatomic) CGFloat progress;
+
+/**
+ * The color of the progress, default is [UIColor clearColor]
+ */
+@property (nonatomic, strong) UIColor *progressColor;
+
+@end
+
+#pragma mark - UIView+Progress
+
+@interface UIView (Progress)
+
+/**
+ * Get PieProgressView to modify the property.
+ * @return PieProgressView, if not exists, will create a new one.
+ */
+- (PieProgressView *)pieProgressView;
+
+/**
+ * Update the progress status.
+ * @param progress is from 0 to 1. "1" means done。
+ */
+- (void)setPieProgress:(CGFloat)progress;
+
+/**
+ * Get RectProgressView to modify the property.
+ * @return RectProgressView, if not exists, will create a new one.
+ */
+- (RectProgressView *)rectProgressView;
+
+
+/**
+ * Update the progress status.
+ * @param progress is from 0 to 1. "1" means done。
+ */
+- (void)setRectProgress:(CGFloat)progress;
+
+@end

+ 150 - 0
RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoCommonFile/Vendor/UIView+Progress/UIView+Progress.m

@@ -0,0 +1,150 @@
+//
+//  UIView+Progress.m
+//  
+//
+//  Created by lslin on 14-6-13.
+//  Copyright (c) 2014年 lessfun.com. All rights reserved.
+//
+
+#import "UIView+Progress.h"
+
+#define MID(x, y, z)                      ( y < x ? x : (z < y ? z : y) )
+#define CGRectSetSize(r, w1, h1)          CGRectMake(r.origin.x, r.origin.y, w1, h1)
+
+static const int kPieProgressViewTag  = 201;
+static const int kRectProgressViewTag  = 202;
+
+@implementation PieProgressView
+
+- (id)initWithFrame:(CGRect)frame
+{
+    if (self = [super initWithFrame:frame]) {
+        _progress = 1.0;
+        _borderSpacing = 2;
+        _progressColor = [UIColor clearColor];
+        _backgroundMaskColor = [[UIColor whiteColor] colorWithAlphaComponent:0.5];
+        self.tag = kPieProgressViewTag;
+        
+        [self setBackgroundColor:[UIColor clearColor]];
+        self.userInteractionEnabled = NO;
+    }
+    return self;
+}
+
+- (void)setProgress:(CGFloat)progress
+{
+    _progress = MAX(0, progress);
+    if (_progress >= 1) {
+        [self removeFromSuperview];
+    }
+
+    [self setNeedsDisplay];
+}
+
+#pragma mark draw progress
+
+- (void)drawRect:(CGRect)rect
+{
+    CGFloat progressStart = -M_PI_2;
+    CGFloat progressEnd = (-M_PI_2 + M_PI * 2 * self.progress);
+    //progress
+    [self drawRect:rect withColor:_progressColor.CGColor startAngle:-M_PI_2 endAngle:progressEnd];
+    
+    //background
+    [self drawRect:rect withColor:_backgroundMaskColor.CGColor startAngle:progressEnd endAngle:progressStart];
+}
+
+- (void)drawRect:(CGRect)rect withColor:(CGColorRef)cgColor startAngle:(CGFloat)start endAngle:(CGFloat)end
+{
+    CGFloat radius = MIN(CGRectGetHeight(rect), CGRectGetWidth(rect)) * 0.5 - _borderSpacing;
+    CGFloat centerX = CGRectGetWidth(rect) * 0.5;
+    CGFloat centerY = CGRectGetHeight(rect) * 0.5;
+    
+    CGContextRef progressContext = UIGraphicsGetCurrentContext();
+    CGContextSetFillColorWithColor(progressContext, cgColor);
+    CGContextMoveToPoint(progressContext, centerX, centerY);
+    CGContextAddArc(progressContext, centerX, centerY, radius, start, end, 0);
+    CGContextClosePath(progressContext);
+    CGContextFillPath(progressContext);
+}
+
+@end
+
+#pragma mark - 
+
+@implementation RectProgressView
+
+- (id)initWithFrame:(CGRect)frame
+{
+    if (self = [super initWithFrame:frame]) {
+        _progress = 1.0;
+        _progressColor = [UIColor clearColor];
+        self.tag = kRectProgressViewTag;
+        
+        [self setBackgroundColor:[UIColor clearColor]];
+        self.userInteractionEnabled = NO;
+    }
+    return self;
+}
+
+- (void)setProgress:(CGFloat)progress
+{
+    _progress = MID(0, progress, 1);
+    
+    [self setNeedsDisplay];
+}
+
+#pragma mark draw progress
+
+- (void)drawRect:(CGRect)rect
+{
+    [self.progressColor setFill];
+    UIRectFill(CGRectSetSize(rect, CGRectGetWidth(rect) * self.progress, CGRectGetHeight(rect)));
+}
+
+@end
+
+#pragma mark - UIView+Progress
+
+@implementation UIView (Progress)
+
+- (PieProgressView *)pieProgressView
+{
+    UIView *view = [self viewWithTag:kPieProgressViewTag];
+    if (view && ![view isKindOfClass:[PieProgressView class]]) {
+        return nil;
+    }
+    PieProgressView *progressOverlay = (PieProgressView *)view;
+    if (!progressOverlay) {
+        progressOverlay = [[PieProgressView alloc] initWithFrame:self.bounds];
+        [self addSubview:progressOverlay];
+    }
+    return progressOverlay;
+}
+
+- (void)setPieProgress:(CGFloat)progress
+{
+    [[self pieProgressView] setProgress:progress];
+}
+
+- (RectProgressView *)rectProgressView
+{
+    UIView *view = [self viewWithTag:kRectProgressViewTag];
+    if (view && ![view isKindOfClass:[RectProgressView class]]) {
+        return nil;
+    }
+    RectProgressView *progressOverlay = (RectProgressView *)view;
+    if (!progressOverlay) {
+        progressOverlay = [[RectProgressView alloc] initWithFrame:self.bounds];
+        [self addSubview:progressOverlay];
+    }
+    return progressOverlay;
+}
+
+- (void)setRectProgress:(CGFloat)progress
+{
+    [[self rectProgressView] setProgress:progress];
+}
+
+
+@end

+ 51 - 0
RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoFile/Common/AliAssetImageGenerator/AliAssetImageGenerator.h

@@ -0,0 +1,51 @@
+//
+//  AliAssetImageGenerator.h
+//  AlivcSceneDemo
+//
+//  Created by Worthy on 2017/7/25.
+//  Copyright © 2017年 Worthy. All rights reserved.
+//
+
+#import <Foundation/Foundation.h>
+#import <UIKit/UIKit.h>
+#import <AVFoundation/AVFoundation.h>
+
+typedef NS_ENUM(NSUInteger, AliAssetInfoType) {
+    AliAssetInfoTypeVideo,
+    AliAssetInfoTypeImage
+};
+
+@interface AliAssetInfo : NSObject
+@property (nonatomic, copy) NSString *path;
+@property (nonatomic, assign) AliAssetInfoType type;
+@property (nonatomic, assign) CGFloat startTime;
+@property (nonatomic, assign) CGFloat duration;
+@property (nonatomic, assign) CGFloat animDuration;
+
+- (UIImage *)captureImageAtTime:(CGFloat)time outputSize:(CGSize)outputSize;
+-(CGFloat)realDuration;
+
+@end
+
+@interface AliAssetImageGenerator : NSObject
+
+@property (nonatomic) CGSize outputSize;
+@property (nonatomic) NSInteger imageCount; //图片数量
+@property (nonatomic, assign) CGFloat timePerImage; //2个图片的间隔时间
+@property (nonatomic, assign) CGFloat duration;
+
+- (void)addVideoWithPath:(NSString *)path startTime:(CGFloat)startTime duration:(CGFloat)duration animDuration:(CGFloat)animDuration;
+- (void)addImageWithPath:(NSString *)path duration:(CGFloat)duration animDuration:(CGFloat)animDuration;
+- (void)generateWithCompleteHandler:(void(^)(UIImage *))handler;
+- (void)cancel;
+/**
+ 获取视频缩略图
+
+ @param videoURL 视频地址
+ @param time 时间
+ @return 封面
+ */
++ (UIImage*)thumbnailImageForVideo:(NSURL *)videoURL atTime:(NSTimeInterval)time;
+
+
+@end

+ 194 - 0
RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoFile/Common/AliAssetImageGenerator/AliAssetImageGenerator.m

@@ -0,0 +1,194 @@
+//
+//  AliAssetImageGenerator.m
+//  AlivcSceneDemo
+//
+//  Created by Worthy on 2017/7/25.
+//  Copyright © 2017年 Worthy. All rights reserved.
+//
+
+#import "AliAssetImageGenerator.h"
+
+
+@interface AliAssetImageGenerator ()
+@property (nonatomic, strong) NSMutableArray<AliAssetInfo *> *assets;
+
+@property (nonatomic, assign) BOOL shouldCancel;
+@property (nonatomic, strong) dispatch_queue_t queue;
+@end
+
+
+@implementation AliAssetImageGenerator
+
+-(instancetype)init {
+    self = [super init];
+    if (self) {
+        _assets = [NSMutableArray array];
+        _imageCount = 8;
+        _outputSize = CGSizeMake(200,200);
+        _duration = 0;
+    }
+    return self;
+}
+
+-(void)addImageWithPath:(NSString *)path duration:(CGFloat)duration animDuration:(CGFloat)animDuration {
+    AliAssetInfo *info = [[AliAssetInfo alloc] init];
+    info.path = path;
+    info.duration = duration;
+    info.animDuration = animDuration;
+    info.type = AliAssetInfoTypeImage;
+    [_assets addObject:info];
+    _duration += [info realDuration];
+}
+
+-(void)addVideoWithPath:(NSString *)path startTime:(CGFloat)startTime duration:(CGFloat)duration animDuration:(CGFloat)animDuration {
+    AliAssetInfo *info = [[AliAssetInfo alloc] init];
+    info.path = path;
+    info.duration = duration;
+    info.animDuration = animDuration;
+    info.startTime = startTime;
+    info.type = AliAssetInfoTypeVideo;
+    [_assets addObject:info];
+    _duration += [info realDuration];
+}
+
+-(void)generateWithCompleteHandler:(void(^)(UIImage *))handler {
+    _shouldCancel = NO;
+    _queue = dispatch_queue_create("com.ali.thumb.generator", NULL);
+    //new
+    dispatch_async(_queue, ^{
+       
+        for (int imageIndex = 0; imageIndex < _imageCount; imageIndex++) {
+            CGFloat currentImageDuration = imageIndex * _timePerImage; //当前图片对应的时间节点
+            
+            CGFloat totalInfoDuration = 0; //资源的在总的里面的时间节点
+            for (int infoIndex = 0; infoIndex < _assets.count; infoIndex ++) {
+                AliAssetInfo *info = _assets[infoIndex];
+                CGFloat currentInfoDuration = [info realDuration]; //当前资源的时间
+                CGFloat preSourceTotalTime = totalInfoDuration;//当前资源之前的资源加起来的总时间
+                totalInfoDuration = totalInfoDuration + currentInfoDuration;
+                if (currentImageDuration < totalInfoDuration) {
+                    CGFloat relaTimeInCurrentInfo = currentImageDuration - preSourceTotalTime; // 图片在当前资源里的实际时间
+                    UIImage *image = [info captureImageAtTime:relaTimeInCurrentInfo outputSize:_outputSize];
+                    handler(image);
+                    break;
+                }
+                if (_shouldCancel) {
+                    break;
+                }
+                
+            }
+        }
+    });
+}
+
+-(void)cancel {
+    _shouldCancel = YES;
+}
+
++ (UIImage*) thumbnailImageForVideo:(NSURL *)videoURL atTime:(NSTimeInterval)time {
+    
+    AVURLAsset *asset = [[AVURLAsset alloc] initWithURL:videoURL options:nil];
+    NSParameterAssert(asset);
+    AVAssetImageGenerator *assetImageGenerator =[[AVAssetImageGenerator alloc] initWithAsset:asset];
+    assetImageGenerator.appliesPreferredTrackTransform = YES;
+    assetImageGenerator.maximumSize = CGSizeMake(300, 300);
+    assetImageGenerator.apertureMode = AVAssetImageGeneratorApertureModeEncodedPixels;
+    
+    
+    CGImageRef thumbnailImageRef = NULL;
+    CFTimeInterval thumbnailImageTime = time;
+    NSError *thumbnailImageGenerationError = nil;
+    thumbnailImageRef = [assetImageGenerator copyCGImageAtTime:CMTimeMake(thumbnailImageTime, 60)actualTime:NULL error:&thumbnailImageGenerationError];
+    
+    if(!thumbnailImageRef) {
+        NSLog(@"thumbnailImageGenerationError %@",thumbnailImageGenerationError);
+    }
+    UIImage*thumbnailImage = thumbnailImageRef ? [[UIImage alloc]initWithCGImage: thumbnailImageRef] : nil;
+    
+    return thumbnailImage;
+}
+
+
+@end
+
+#pragma mark - AliAssetInfo Class
+
+@interface AliAssetInfo ()
+@property (nonatomic, strong) AVAssetImageGenerator *generator;
+@end
+
+@implementation AliAssetInfo
+
+-(CGFloat)realDuration {
+    return _duration - _animDuration;
+}
+
+- (UIImage *)captureImageAtTime:(CGFloat)time outputSize:(CGSize)outputSize {
+    if (_type == AliAssetInfoTypeImage) {
+        return [self imageFromImageWithOutputSize:outputSize];
+    }else {
+        return [self imageFromVideoWithOutputSize:outputSize atTime:time];
+    }
+
+}
+
+- (UIImage *)imageFromImageWithOutputSize:(CGSize)outputSize {
+    UIImage *image = [UIImage imageWithContentsOfFile:_path];
+    CGFloat imageRatio = image.size.width / image.size.height;
+    if (image.size.width > image.size.height) {
+        outputSize.height = outputSize.width / imageRatio;
+    } else {
+        outputSize.width = outputSize.height * imageRatio;
+    }
+
+    UIGraphicsBeginImageContext(outputSize);
+    [image drawInRect:CGRectMake(0, 0, outputSize.width, outputSize.height)];
+    UIImage *picture = UIGraphicsGetImageFromCurrentImageContext();
+    UIGraphicsEndImageContext();
+    return picture;
+}
+
+- (UIImage *)imageFromVideoWithOutputSize:(CGSize)outputSize atTime:(CGFloat)atTime {
+    if (!_generator) {
+//        _generator = [[AVAssetImageGenerator alloc] initWithAsset:[self composition]];
+        AVURLAsset *asset = [[AVURLAsset alloc]initWithURL:[NSURL fileURLWithPath:_path] options:nil];
+        _generator = [[AVAssetImageGenerator alloc]initWithAsset:asset];
+        _generator.maximumSize = outputSize;
+        _generator.appliesPreferredTrackTransform = YES;
+//        _generator.requestedTimeToleranceAfter = kCMTimeZero;
+//        _generator.requestedTimeToleranceBefore = kCMTimeZero;
+    }
+    if (atTime < 0) {
+        atTime = 0;
+    }
+    CMTime time = CMTimeMake(atTime * 1000, 1000);
+    CGImageRef image = [_generator copyCGImageAtTime:time actualTime:NULL error:nil];
+    UIImage *picture = [UIImage imageWithCGImage:image];
+    CGImageRelease(image);
+    return picture;
+}
+
+
+-(AVComposition *)composition {
+    AVMutableComposition *composition = [AVMutableComposition composition];
+    AVMutableCompositionTrack *compositionVideoTrack = [composition addMutableTrackWithMediaType:AVMediaTypeVideo preferredTrackID:kCMPersistentTrackID_Invalid];
+    AVURLAsset *asset = [[AVURLAsset alloc] initWithURL:[NSURL fileURLWithPath:_path] options:nil];
+    AVAssetTrack *assetTrackVideo = nil;
+    if ([[asset tracksWithMediaType:AVMediaTypeVideo] count] != 0) {
+        assetTrackVideo = [asset tracksWithMediaType:AVMediaTypeVideo][0];
+    }
+    if (assetTrackVideo) {
+        CMTime start = CMTimeMake((_startTime-_animDuration)*1000, 1000);
+        CMTime duration = assetTrackVideo.timeRange.duration;
+        if (_duration) {
+            duration = CMTimeMake(_duration * 1000, 1000);
+        }
+        [compositionVideoTrack insertTimeRange:CMTimeRangeMake(start, duration) ofTrack:assetTrackVideo atTime:kCMTimeZero error:nil];
+        compositionVideoTrack.preferredTransform = assetTrackVideo.preferredTransform;
+        return composition;
+    }
+    return nil;
+}
+
+
+@end

+ 159 - 0
RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoFile/Common/AlivcShortVideoRoute.h

@@ -0,0 +1,159 @@
+//
+//  AlivcShortVideoRoute.h
+//  AliyunVideoClient_Entrance
+//
+//  Created by wanghao on 2018/10/19.
+//  Copyright © 2018年 Alibaba. All rights reserved.
+//
+
+#import <Foundation/Foundation.h>
+
+#import "AliyunMediaConfig.h"
+#import "AlivcEditUIConfig.h"
+#import "AlivcRecordUIConfig.h"
+
+NS_ASSUME_NONNULL_BEGIN
+
+/**
+ 短视频视图控制器类型 - 只支持专业版和标准版
+
+ - AlivcViewControlEditParam:        短视频编辑参数配置页
+ - AlivcViewControlEditVideoSelect:  短视频编辑视频选择页
+ - AlivcViewControlEdit:             短视频编辑页
+ - AlivcViewControlRecordParam:      短视频拍摄参数配置页
+ - AlivcViewControlRecord:           短视频拍摄页
+ - AlivcViewControlCropParam:        短视频裁剪参数配置页
+ - AlivcViewControlCropVideoSelect:  短视频裁剪视频选择页
+ - AlivcViewControlCrop:             短视频裁剪页
+ */
+typedef NS_ENUM(NSInteger, AlivcViewControlType){
+    AlivcViewControlEditParam = 0,
+    AlivcViewControlEditVideoSelect,
+    AlivcViewControlEdit, //目前暂不支持直接进入编辑界面,因为视频选择界面处理了视频的编解码,
+    AlivcViewControlRecordParam,
+    AlivcViewControlRecord,
+    AlivcViewControlCropParam,
+    AlivcViewControlCropVideoSelect,
+    AlivcViewControlCrop,
+};
+
+#pragma mark - FinishBlock Define - 最终输出以block参数的形式给出
+/**
+ 编辑完成动作类型定义
+
+ @param outputPath 编辑完成的视频的输出路径
+ */
+typedef void (^AlivcEditFinishBlock)(NSString *outputPath);
+
+/**
+ 录制完成动作类型定义
+ 
+ @param outputPath 录制完成输出路径
+ */
+typedef void (^AlivcRecordFinishBlock)(NSString *outputPath);
+
+/**
+ 裁剪完成动作类型定义
+ 
+ @param outputPath 录制完成输出路径
+ */
+typedef void (^AlivcCropFinishBlock)(NSString *outputPath);
+
+
+#pragma mark - RouteClassDefine
+
+/**
+ 短视频单独模块集成入口类
+ */
+@interface AlivcShortVideoRoute : NSObject
+
+/**
+ 单例 - 短视频的界面管理器,路由机制
+
+ @return 实例
+ */
++ (instancetype)shared;
+
+
+/**
+ 注册一个视频配置,目前所有模块公用一个视频配置,想要不同的配置,获取视图控制器之前,调用此方法更新值
+
+ @param config 视频配置
+ */
+-(void)registerMediaConfig:(AliyunMediaConfig *__nullable)config;
+
+#pragma mark - Record 录制输入输出配置
+
+/**
+ 输入 短视频录制页面的配置
+
+ @param config 录制页面UI配置类
+ */
+-(void)registerRecordUIConfig:(AlivcRecordUIConfig *__nullable)config;
+
+/**
+ 输入 注册一个录制完成动作
+ 输出 block里的参数
+ @param block 完成动作
+ */
+- (void)registerRecordFinishBlock:(AlivcRecordFinishBlock )block;
+
+#pragma mark - Edit 编辑输入输出配置
+
+/**
+ 注册编辑页面的UI配置类
+ 
+ @param config 编辑页面UI配置类
+ */
+-(void)registerEditUIConfig:(AlivcEditUIConfig *__nullable)config;
+
+/**
+ 配置视频编辑界面的单个视频路径
+
+ @param singleVideoPath 编辑界面的单个视频路径
+ */
+- (void)registerEditVideoPath:(NSString *__nullable)singleVideoPath;
+
+/**
+ 配置视频录制界面是否带音乐
+ 
+ @param hasRecordMusic 录制是否带音乐
+ */
+- (void)registerHasRecordMusic:(BOOL)hasRecordMusic;
+/**
+ 配置视频编辑界面的多个媒体资源的路径
+
+ @param mediasPath 多个媒体资源的路径
+ */
+- (void)registerEditMediasPath:(NSString *__nullable)mediasPath;
+
+/**
+ 注册一个编辑完成动作
+ 
+ @param block 完成动作
+ */
+- (void)registerEditFinishBlock:(AlivcEditFinishBlock )block;
+
+
+
+#pragma mark - Crop 裁剪参数输入输出配置
+
+/**
+ 注册一个裁剪完成动作
+ 
+ @param block 完成动作
+ */
+- (void)registerCropFinishBlock:(AlivcCropFinishBlock )block;
+
+
+/**
+ 获取一个短视频模块的一个视图控制器
+ 
+ @param type 控制器类型
+ @return 功能接入口控制器
+ */
+-(UIViewController *)alivcViewControllerWithType:(AlivcViewControlType )type;
+
+
+@end
+NS_ASSUME_NONNULL_END

+ 216 - 0
RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoFile/Common/AlivcShortVideoRoute.m

@@ -0,0 +1,216 @@
+//
+//  AlivcShortVideoRoute.m
+//  AliyunVideoClient_Entrance
+//
+//  Created by wanghao on 2018/10/19.
+//  Copyright © 2018年 Alibaba. All rights reserved.
+//
+
+#import "AlivcShortVideoRoute.h"
+#import "AliyunIConfig.h"
+#import "AliyunEffectPrestoreManager.h"
+#import "AlivcImage.h"
+
+@interface AlivcShortVideoRoute()
+
+@property (nonatomic, strong)AliyunMediaConfig *mediaConfig;//视频选择页参数配置类
+
+@property (nonatomic, strong)AlivcRecordUIConfig *recordUIConfig;//录制UI配置类
+
+@property (nonatomic, strong)AlivcEditUIConfig *editUIConfig;//编辑UI配置类
+
+@property (nonatomic, strong)NSString *editInputVideoPath;//编辑传入参数:单个视频的本地路径
+
+@property (nonatomic, assign)BOOL hasRecordMusic;//录制的时候是否带音乐
+
+@property (nonatomic, strong)NSString *editInputMediasPath;//编辑传入参数:多个媒体资源的本地存放文件夹路径
+
+@property (nonatomic, copy)AlivcRecordFinishBlock recordFinishBlock;//录制完成回调
+
+@property (nonatomic, copy)AlivcEditFinishBlock editFinishBlock;//编辑完成回调
+
+@property (nonatomic, copy)AlivcCropFinishBlock cropFinishBlock;//裁剪完成回调
+
+@end
+
+static AlivcShortVideoRoute *_instance = nil;
+
+@implementation AlivcShortVideoRoute
+
++ (instancetype)shared{
+   
+    return [[self alloc]init];
+}
+
++ (instancetype)allocWithZone:(struct _NSZone *)zone{
+    static dispatch_once_t onceToken;
+    dispatch_once(&onceToken, ^{
+        if (!_instance) {
+            _instance = [super allocWithZone:zone];
+            [AlivcImage setImageBundleName:@"AlivcShortVideoImage"];
+            [AliyunIConfig setConfig:[[AliyunIConfig alloc]init]];//注册功能配置类
+            [[[AliyunEffectPrestoreManager alloc]init] insertInitialData];//初始化动图资源
+        }
+        
+    });
+    return _instance;
+}
+// 为了严谨,也要重写copyWithZone 和 mutableCopyWithZone
+-(id)copyWithZone:(NSZone *)zone
+{
+    return _instance;
+}
+-(id)mutableCopyWithZone:(NSZone *)zone
+{
+    return _instance;
+}
+
+- (UIViewController *)alivcViewControllerWithType:(AlivcViewControlType )type{
+
+    
+//    if (type == AlivcViewControlEdit) {//暂时不放开直接从编辑页面进入,因为录制直接进编辑,可以用到这个,所以开启
+//        type = AlivcViewControlEditVideoSelect;
+//    }
+    UIViewController *controller;
+    switch (type) {
+        case AlivcViewControlEditParam:
+        {//短视频编辑参数配置页
+            NSLog(@"----短视频编辑参数配置页");
+        }
+            break;
+        case AlivcViewControlEditVideoSelect:
+        {//短视频编辑视频选择页
+            Class viewControllerClass = NSClassFromString(@"AliyunCompositionViewController");
+            controller = [[viewControllerClass alloc]init];
+            [controller setValue:self.mediaConfig forKey:@"compositionConfig"];
+        }
+            break;
+        case AlivcViewControlEdit:
+        {//短视频编辑页
+            Class viewControllerClass = NSClassFromString(@"AliyunEditViewController");
+            controller = [[viewControllerClass alloc]init];
+            if (self.mediaConfig) {
+                [controller setValue:self.mediaConfig forKey:@"config"];
+            }
+            if (self.editInputVideoPath) {
+                [controller setValue:self.editInputVideoPath forKey:@"videoPath"];
+            }
+            if (self.editInputMediasPath) {
+                [controller setValue:self.editInputMediasPath forKey:@"taskPath"];
+            }
+            if (self.editUIConfig) {
+                [controller setValue:self.editUIConfig forKey:@"uiConfig"];
+            }
+            if (self.editFinishBlock) {
+                [controller setValue:self.editFinishBlock forKey:@"finishBlock"];
+            }
+            
+            [controller setValue:@(self.hasRecordMusic) forKey:@"hasRecordMusic"];
+            
+        }
+            break;
+        case AlivcViewControlRecordParam:
+        {//短视频拍摄参数配置页
+            NSLog(@"----短视频拍摄参数配置页");
+        }
+            break;
+        case AlivcViewControlRecord:
+        {//短视频拍摄页
+            Class viewControllerClass = NSClassFromString(@"AliyunMagicCameraViewController");
+            controller = [[viewControllerClass alloc]init];
+
+            if (self.mediaConfig) {
+                [controller setValue:self.mediaConfig forKey:@"quVideo"];
+            }
+            if (self.recordUIConfig) {
+                [controller setValue:self.recordUIConfig forKey:@"uiConfig"];
+            }
+            if (self.recordFinishBlock) {
+                [controller setValue:self.recordFinishBlock forKey:@"finishBlock"];
+            }
+            
+        }
+            break;
+        case AlivcViewControlCropParam:
+        {//短视频裁剪参数配置页
+            NSLog(@"----短视频裁剪参数配置页");            
+        }
+            break;
+        case AlivcViewControlCropVideoSelect:
+        {//短视频裁剪页
+            Class viewControllerClass = NSClassFromString(@"AliyunCropViewController");
+            controller = [[viewControllerClass alloc]init];
+            [controller setValue:self.mediaConfig forKey:@"cutInfo"];
+        }
+            break;
+        case AlivcViewControlCrop:
+        {//短视频裁剪视频选择页
+            Class viewControllerClass = NSClassFromString(@"AliyunPhotoViewController");
+            controller = [[viewControllerClass alloc]init];
+            [controller setValue:self.mediaConfig forKey:@"cutInfo"];
+        }
+            break;
+            
+        default:
+            break;
+    }
+    
+    return controller;
+}
+
+-(AliyunMediaConfig *)mediaConfig{
+    
+    if (!_mediaConfig) {//默认配置
+        _mediaConfig = [AliyunMediaConfig defaultConfig];
+        _mediaConfig.minDuration = 2.0;
+        _mediaConfig.maxDuration = 10.0*60;
+        _mediaConfig.fps = 25;
+        _mediaConfig.gop = 5;
+        _mediaConfig.cutMode = AliyunMediaCutModeScaleAspectFill;
+        _mediaConfig.videoOnly = NO;
+        _mediaConfig.backgroundColor = [UIColor blackColor];
+        
+    }
+    return _mediaConfig;
+}
+
+#pragma mark - Register
+-(void)registerMediaConfig:(AliyunMediaConfig *)config{
+    _mediaConfig = config;
+}
+
+- (void)registerRecordUIConfig:(AlivcRecordUIConfig *)config{
+    _recordUIConfig = config;
+}
+
+- (void)registerEditUIConfig:(AlivcEditUIConfig *)config{
+    _editUIConfig = config;
+}
+
+- (void)registerEditVideoPath:(NSString *)singleVideoPath{
+    _editInputVideoPath = singleVideoPath;
+}
+
+- (void)registerEditMediasPath:(NSString *)mediasPath{
+    _editInputMediasPath = mediasPath;
+}
+
+- (void)registerRecordFinishBlock:(AlivcRecordFinishBlock)block{
+    _recordFinishBlock = block;
+}
+
+- (void)registerEditFinishBlock:(AlivcEditFinishBlock)block{
+    _editFinishBlock = block;
+}
+
+- (void)registerCropFinishBlock:(AlivcCropFinishBlock)block{
+    _cropFinishBlock = block;
+}
+
+- (void)registerHasRecordMusic:(BOOL)hasRecordMusic {
+    _hasRecordMusic = hasRecordMusic;
+}
+
+#pragma mark - other
+
+@end

+ 35 - 0
RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoFile/Common/FilterAbout/AlivcEditBottomHeaderView.h

@@ -0,0 +1,35 @@
+//
+//  AlivcEditBottomHeaderView.h
+//  AliyunVideoClient_Entrance
+//
+//  Created by wanghao on 2018/10/11.
+//  Copyright © 2018年 Alibaba. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+#import "UIButton+AliyunBlock.h"
+
+@interface AlivcEditBottomHeaderView : UIView
+
+/**
+ 设置headerView信息
+
+ @param icon 中间icon
+ @param titile 标题
+ */
+-(void)setTitle:(NSString *)titile icon:(UIImage *)icon;
+
+/**
+ 隐藏两侧按钮
+ */
+-(void)hiddenButton;
+
+/**
+ 绑定响应事件
+
+ @param applyOnClick 确认按钮事件
+ @param cancelOnClick 取消按钮事件
+ */
+-(void)bindingApplyOnClick:(OnClickBlock)applyOnClick cancelOnClick:(OnClickBlock)cancelOnClick;
+
+@end

+ 76 - 0
RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoFile/Common/FilterAbout/AlivcEditBottomHeaderView.m

@@ -0,0 +1,76 @@
+//
+//  AlivcEditBottomHeaderView.m
+//  AliyunVideoClient_Entrance
+//
+//  Created by wanghao on 2018/10/11.
+//  Copyright © 2018年 Alibaba. All rights reserved.
+//
+
+#import "AlivcEditBottomHeaderView.h"
+#import "AlivcEditIconButton.h"
+#import "AlivcImage.h"
+#import "AlivcMacro.h"
+
+#define AEBH_Icon_Size 40
+#define AEBH_SeparatorLine_Height 0.6
+
+@interface AlivcEditBottomHeaderView()
+
+@property (nonatomic, strong)AlivcEditIconButton *iconBtn;
+@property (nonatomic, strong)UIButton *cancelBtn;
+@property (nonatomic, strong)UIButton *enterBtn;
+@property (nonatomic, strong)UIView *separatorLine;//分割线
+
+
+@end
+
+@implementation AlivcEditBottomHeaderView
+
+-(id)initWithFrame:(CGRect)frame{
+    self = [super initWithFrame:frame];
+    if (self) {
+        [self layerSubviews];
+    }
+    return self;
+}
+
+-(void)layerSubviews{
+    _cancelBtn = [[UIButton alloc] initWithFrame:CGRectMake(0, (CGRectGetHeight(self.bounds)-CGRectGetHeight(self.bounds))/2, CGRectGetHeight(self.bounds), CGRectGetHeight(self.bounds))];
+    [_cancelBtn setImage:[AlivcImage imageNamed:@"shortVideo_edit_close"] forState:UIControlStateNormal];
+    [self addSubview:_cancelBtn];
+    
+    _iconBtn = [[AlivcEditIconButton alloc]initWithFrame:CGRectMake(CGRectGetMaxX(_cancelBtn.frame), (CGRectGetHeight(self.bounds)-AEBH_Icon_Size)/2, CGRectGetWidth(self.bounds)-CGRectGetMaxX(_cancelBtn.frame)*2, AEBH_Icon_Size)];
+    _iconBtn.userInteractionEnabled = NO;
+    [_iconBtn.titleLabel setFont:[UIFont systemFontOfSize:14]];
+    [self addSubview:_iconBtn];
+    
+    _enterBtn = [[UIButton alloc] initWithFrame:CGRectMake(CGRectGetMaxX(_iconBtn.frame), CGRectGetMinY(_cancelBtn.frame), CGRectGetHeight(_cancelBtn.bounds), CGRectGetHeight(_cancelBtn.bounds))];
+    [_enterBtn setImage:[AlivcImage imageNamed:@"shortVideo_edit_affirm"] forState:UIControlStateNormal];
+    [self addSubview:_enterBtn];
+    //        [_iconBtn setImageEdgeInsets:UIEdgeInsetsMake(10, 0, 10, 0)];
+
+    _separatorLine = [[UIView alloc] initWithFrame:CGRectMake(0, CGRectGetMaxY(self.frame)-AEBH_SeparatorLine_Height, ScreenWidth, AEBH_SeparatorLine_Height)];
+    _separatorLine.backgroundColor = AlivcOxRGB(0xc3c5c6);
+    _separatorLine.alpha = 0.5;
+    [self addSubview:_separatorLine];
+
+}
+-(void)hiddenButton{
+    _cancelBtn.hidden = YES;
+    _enterBtn.hidden = YES;
+}
+
+-(void)setTitle:(NSString *)titile icon:(UIImage *)icon{
+    [_iconBtn setImage:icon forState:UIControlStateNormal];
+    [_iconBtn setImage:icon forState:UIControlStateHighlighted];
+    [_iconBtn setTitle:titile forState:UIControlStateNormal];
+    [_iconBtn setTitle:titile forState:UIControlStateHighlighted];
+}
+
+-(void)bindingApplyOnClick:(OnClickBlock)applyOnClick cancelOnClick:(OnClickBlock)cancelOnClick{
+    [_cancelBtn aliyunOnClickBlock:cancelOnClick];
+    [_enterBtn aliyunOnClickBlock:applyOnClick];
+}
+
+
+@end

+ 16 - 0
RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoFile/Common/FilterAbout/AlivcEditIconButton.h

@@ -0,0 +1,16 @@
+//
+//  AlivcEditIconButton.h
+//  AliyunVideoClient_Entrance
+//
+//  Created by wanghao on 2018/10/12.
+//  Copyright © 2018年 Alibaba. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+
+/**
+ 自定义button,为了自由的调整imageview大小
+ */
+@interface AlivcEditIconButton : UIButton
+
+@end

+ 32 - 0
RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoFile/Common/FilterAbout/AlivcEditIconButton.m

@@ -0,0 +1,32 @@
+//
+//  AlivcEditIconButton.m
+//  AliyunVideoClient_Entrance
+//
+//  Created by wanghao on 2018/10/12.
+//  Copyright © 2018年 Alibaba. All rights reserved.
+//
+
+#import "AlivcEditIconButton.h"
+
+@implementation AlivcEditIconButton
+
+-(CGRect)imageRectForContentRect:(CGRect)contentRect{
+    
+    CGFloat imageW = 23;
+    
+    CGFloat imageH = 23;
+    
+    CGFloat imageX = [self getXAtImageWidth:imageW withContentRect:contentRect]-4;
+    
+    CGFloat imageY = (CGRectGetHeight(contentRect)-imageH)/2;
+    
+    return CGRectMake(imageX, imageY, imageW, imageH);
+}
+-(CGFloat)getXAtImageWidth:(CGFloat)imagew withContentRect:(CGRect)contentRect{
+    CGSize size = [self.currentTitle sizeWithFont:self.titleLabel.font constrainedToSize:CGSizeMake(MAXFLOAT, CGRectGetHeight(contentRect))];
+//    CGSize size = [self sizeThatFits:CGSizeMake(CGRectGetWidth(self.bounds), MAXFLOAT)];
+    CGFloat contentW = imagew+size.width;
+    CGFloat imageX = (CGRectGetWidth(self.bounds)-contentW)/2;
+    return imageX;
+}
+@end

+ 49 - 0
RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoFile/Common/FilterAbout/AliyunEffectFilterView.h

@@ -0,0 +1,49 @@
+//
+//  AliyunEffectFilterView.h
+//  qusdk
+//
+//  Created by Vienta on 2018/1/12.
+//  Copyright © 2018年 Alibaba Group Holding Limited. All rights reserved.
+//  编辑中滤镜、录制中滤镜、编辑中滤镜特效公用的view
+
+#import <UIKit/UIKit.h>
+#import "AliyunEffectFilterInfo.h"
+#import "AliyunEffectMvGroup.h"
+@protocol AliyunEffectFilter2ViewDelegate <NSObject>
+@optional
+
+/**
+ 选中某个滤镜滤镜
+
+ @param filter 滤镜数据模型
+ */
+- (void)didSelectEffectFilter:(AliyunEffectFilterInfo *)filter;
+
+
+@end
+
+@interface AliyunEffectFilterView : UIView
+
+/**
+ 此类的代理
+ */
+@property (nonatomic, weak) id<AliyunEffectFilter2ViewDelegate> delegate;
+
+/**
+ 选中的滤镜数据模型
+ */
+@property (nonatomic, strong) AliyunEffectInfo *selectedEffect;
+
+/**
+ 录制中的滤镜hideTop为Yes,编辑中的滤镜hideTop为No
+ */
+@property (nonatomic, assign) BOOL hideTop;
+
+
+/**
+ 更新选中的滤镜
+
+ @param filter 滤镜名称
+ */
+- (void)updateSelectedFilter:(AliyunEffectInfo *)filter;
+@end

+ 217 - 0
RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoFile/Common/FilterAbout/AliyunEffectFilterView.m

@@ -0,0 +1,217 @@
+//
+//  AliyunEffectFilterView.m
+//  qusdk
+//
+//  Created by Vienta on 2018/1/12.
+//  Copyright © 2018年 Alibaba Group Holding Limited. All rights reserved.
+//
+
+#import "AliyunEffectFilterView.h"
+#import "AliyunEffectFilterCell.h"
+#import "AliyunEffectInfo.h"
+#import "AliyunDBHelper.h"
+#import "AVC_ShortVideo_Config.h"
+#import "AliyunEffectResourceModel.h"
+#import "AlivcEditBottomHeaderView.h"
+#import "AlivcMacro.h"
+#import "AlivcImage.h"
+
+@interface AliyunEffectFilterView()
+
+/**
+ 显示view
+ */
+@property (nonatomic, strong) UICollectionView *collectionView;
+
+/**
+ 数据模型数组
+ */
+@property (nonatomic, strong) NSMutableArray *dataArray;
+
+/**
+ FMDB的封装类
+ */
+@property (nonatomic, strong) AliyunDBHelper *dbHelper;
+
+/**
+ 数据类型
+ */
+@property (nonatomic, assign) NSInteger effectType;
+
+/**
+ 选中滤镜的序号
+ */
+@property (nonatomic, assign) NSInteger selectIndex;
+
+@property (nonatomic, strong) AlivcEditBottomHeaderView *headerView;
+@end
+
+@implementation AliyunEffectFilterView
+
+- (instancetype)initWithFrame:(CGRect)frame {
+    self = [super initWithFrame:frame];
+    if (self) {
+        
+        self.backgroundColor = [UIColor clearColor];
+       
+        _dbHelper = [[AliyunDBHelper alloc] init];
+        _dataArray = [[NSMutableArray alloc] init];
+        _selectIndex = -1;
+        [self addSubViews];
+    }
+    return self;
+}
+
+
+/**
+ 添加子控件
+ */
+- (void)addSubViews {
+
+    _headerView = [[AlivcEditBottomHeaderView alloc]initWithFrame:CGRectMake(0, 0, CGRectGetWidth(self.bounds), 45)];
+    [_headerView setTitle:@"滤镜" icon:[AlivcImage imageNamed:@"shortVideo_fliter"]];
+    [_headerView hiddenButton];
+    [self addSubview:_headerView];
+    UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init];
+    layout.scrollDirection = UICollectionViewScrollDirectionHorizontal;
+    layout.itemSize = CGSizeMake(50, 70);
+    layout.sectionInset = UIEdgeInsetsMake(5, 20, 20, 22);
+    layout.minimumInteritemSpacing = 20;
+    layout.minimumLineSpacing = 20;
+    
+    _collectionView = [[UICollectionView alloc] initWithFrame:CGRectMake(0, 62.5, ScreenWidth, 102) collectionViewLayout:layout];
+    _collectionView.backgroundColor = [UIColor clearColor];
+    _collectionView.showsHorizontalScrollIndicator = NO;
+    [_collectionView registerNib:[UINib nibWithNibName:@"AliyunEffectFilterCell" bundle:nil] forCellWithReuseIdentifier:@"AliyunEffectFilterCell"];
+    [_collectionView registerNib:[UINib nibWithNibName:@"AliyunEffectFilterCell" bundle:nil] forCellWithReuseIdentifier:@"AliyunEffectFilterFuncCell"];
+    _collectionView.dataSource = (id<UICollectionViewDataSource>)self;
+    _collectionView.delegate = (id<UICollectionViewDelegate>)self;
+    [self addSubview:_collectionView];
+    
+    [self reloadDataWithEffectType:AliyunEffectTypeFilter];
+}
+
+
+/**
+ 重写hideTop的回调方法
+
+ @param hideTop 录制中的滤镜hideTop为Yes,编辑中的滤镜hideTop为No
+ */
+- (void)setHideTop:(BOOL)hideTop{
+    _hideTop = hideTop;
+    _headerView.hidden = hideTop;
+    _collectionView.frame = CGRectMake(0, 20, ScreenWidth, 102);
+    
+}
+
+
+- (void)reloadDataWithEffectType:(NSInteger)eType {
+
+    _effectType = eType;
+    
+    [_dataArray removeAllObjects];
+    
+    if (_selectIndex == -1) {
+        _selectIndex = 0; //默认是不选中
+    }
+    
+    [_dbHelper queryResourceWithEffecInfoType:eType success:^(NSArray *infoModelArray) {
+        for (AliyunEffectMvGroup *mvGroup in infoModelArray) {
+            [_dataArray addObject:mvGroup];
+            if (_selectedEffect) {
+                if (mvGroup.eid == _selectedEffect.eid) {
+                    _selectIndex = [infoModelArray indexOfObject:mvGroup] + 1;
+                }
+            }
+        }
+        
+        if (eType != AliyunEffectTypeSpecialFilter) {
+            dispatch_async(dispatch_get_main_queue(), ^{
+                [_collectionView reloadData];
+            });
+        }
+       
+    } failure:^(NSError *error) {
+        
+    }];
+    
+    
+}
+
+- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section {
+    return _dataArray.count;
+}
+
+- (__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath {
+    
+    AliyunEffectFilterCell *cell;
+    if (indexPath.row == 0 || indexPath.row == _dataArray.count - 1) {
+        cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"AliyunEffectFilterFuncCell" forIndexPath:indexPath];
+    } else {
+        cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"AliyunEffectFilterCell" forIndexPath:indexPath];
+        
+    }
+    
+    
+    AliyunEffectInfo *effectInfo = _dataArray[indexPath.row];
+    [cell cellModel:effectInfo];
+    if (_effectType != AliyunEffectTypeSpecialFilter) {
+        if (indexPath.row == _selectIndex) {
+            [cell setSelected:YES];
+            NSLog(@"滤镜测试%@:选中:%ld",effectInfo.name,_selectIndex);
+        }else{
+            [cell setSelected:NO];
+            NSLog(@"滤镜测试%@:不选中:%ld",effectInfo.name,indexPath.row);
+        }
+    }
+    if (_effectType == AliyunEffectTypeFilter) {
+        if (indexPath.row == 0) {
+            cell.imageView.contentMode = UIViewContentModeCenter;
+            cell.imageView.backgroundColor = rgba(255, 255, 255, 0.2);
+            cell.imageView.image = [AlivcImage imageNamed:@"shortVideo_clear"];
+            cell.nameLabel.text = @"无效果";
+        }else{
+            cell.imageView.contentMode = UIViewContentModeScaleAspectFill;
+            cell.imageView.backgroundColor = [UIColor clearColor];
+        }
+    }
+    
+    [cell setExclusiveTouch:YES];
+    return cell;
+}
+
+- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath {
+    if (_effectType != AliyunEffectTypeSpecialFilter) {
+        AliyunEffectFilterCell *lastSelectCell = (AliyunEffectFilterCell *)[collectionView cellForItemAtIndexPath:[NSIndexPath indexPathForItem:_selectIndex inSection:0]];
+        NSLog(@"滤镜测试:不选中:%ld",_selectIndex);
+        [lastSelectCell setSelected:NO];
+    }
+    
+    AliyunEffectInfo *currentEffect = _dataArray[indexPath.row];
+    if (_effectType == AliyunEffectTypeFilter) {
+        [_delegate didSelectEffectFilter:(AliyunEffectFilterInfo *)currentEffect];
+        _selectIndex = indexPath.row;
+    }
+}
+
+//- (void)setSelectedEffect:(AliyunEffectInfo *)selectedEffect{
+//    _selectedEffect = selectedEffect;
+//    if(selectedEffect){
+//        //获得index
+//        self.selectIndex = 3;
+//    }
+//}
+
+- (void)updateSelectedFilter:(AliyunEffectInfo *)filter{
+    for (int i = 0; i < _dataArray.count; i++) {
+        AliyunEffectInfo *tmpFilter = _dataArray[i];
+        if ([filter.name isEqualToString:tmpFilter.name]) {
+            self.selectIndex  = i;
+            break;
+        }
+    }
+    NSIndexPath *indexPath = [NSIndexPath indexPathForItem:_selectIndex inSection:0];
+    [self collectionView:self.collectionView didSelectItemAtIndexPath:indexPath];
+    [self.collectionView scrollToItemAtIndexPath:indexPath atScrollPosition:UICollectionViewScrollPositionCenteredHorizontally animated:NO];
+}
+@end

+ 14 - 0
RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoFile/Common/Model/AliyunCustomFilter.h

@@ -0,0 +1,14 @@
+//
+//  AliyunCustomFilter.h
+//  qusdk
+//
+//  Created by Worthy on 2017/8/10.
+//  Copyright © 2017年 Alibaba Group Holding Limited. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+
+@interface AliyunCustomFilter : NSObject
+- (instancetype)initWithSize:(CGSize)size;
+- (int)render:(int)srcTexture size:(CGSize)size;
+@end

+ 204 - 0
RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoFile/Common/Model/AliyunCustomFilter.m

@@ -0,0 +1,204 @@
+//
+//  AliyunCustomFilter.m
+//  qusdk
+//
+//  Created by Worthy on 2017/8/10.
+//  Copyright © 2017年 Alibaba Group Holding Limited. All rights reserved.
+//
+
+#import "AliyunCustomFilter.h"
+#import <OpenGLES/ES2/gl.h>
+#define STRINGIZE(x) #x
+#define STRINGIZE2(x) STRINGIZE(x)
+#define SHADER_STRING(text) @ STRINGIZE2(text)
+
+NSString *const VertexShaderString = SHADER_STRING
+(
+ attribute vec4 position;
+ attribute vec4 inputTextureCoordinate;
+ varying vec2 textureCoordinate;
+ void main()
+ {
+     gl_Position = position;
+     textureCoordinate = inputTextureCoordinate.xy;
+ }
+ );
+
+NSString *const FragmentShaderString = SHADER_STRING
+(
+
+ varying highp vec2 textureCoordinate;
+ 
+ uniform sampler2D inputImageTexture;
+ 
+ const mediump vec3 luminanceWeighting = vec3(0.2125, 0.7154, 0.0721);
+ 
+ void main()
+ {
+     lowp vec4 textureColor = texture2D(inputImageTexture, textureCoordinate);
+     lowp float luminance = dot(textureColor.rgb, luminanceWeighting);
+     lowp vec3 greyScaleColor = vec3(luminance);
+     
+     gl_FragColor = vec4(mix(greyScaleColor, textureColor.rgb, 2.5), textureColor.w);
+     
+ }
+ );
+@implementation AliyunCustomFilter {
+    GLuint _frameBuffer;
+    GLuint _program;
+    GLuint _positionSlot;
+    GLuint _texCoordSlot;
+    GLuint _inputTexture;
+    GLuint _outputTexture;
+}
+
+-(instancetype)initWithSize:(CGSize)size {
+    self = [super init];
+    if (self) {
+        [self setupProgram];
+        [self setupTextureWithSize:size];
+    }
+    return self;
+}
+
+- (int)render:(int)srcTexture size:(CGSize)size {
+    glUseProgram(_program);
+    glBindFramebuffer(GL_FRAMEBUFFER, _frameBuffer);
+    glViewport(0, 0, size.width, size.height);
+    glClearColor(0, 0, 1, 0);
+    glClear(GL_COLOR_BUFFER_BIT);
+    glActiveTexture(GL_TEXTURE0);
+    glBindTexture(GL_TEXTURE_2D, srcTexture);
+    glUniform1i(_inputTexture, 0);
+
+    GLfloat positionCoords[] = {
+        -1.0f, -1.0f, 0.0f,
+        1.0f, -1.0f, 0.0f,
+        -1.0f, 1.0f, 0.0f,
+        1.0f, 1.0f, 0.0f,
+    };
+    GLfloat textureCoords[] = {
+        0.0f, 0.0f,
+        1.0f, 0.0f,
+        0.0f, 1.0f,
+        1.0f, 1.0f,
+    };
+
+    glVertexAttribPointer(_positionSlot, 3, GL_FLOAT, 0, 0, positionCoords);
+    glVertexAttribPointer(_texCoordSlot, 2, GL_FLOAT, 0, 0, textureCoords);
+    glEnableVertexAttribArray(_positionSlot);
+    glEnableVertexAttribArray(_texCoordSlot);
+    glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
+
+    return _outputTexture;
+}
+
+- (void)setupTextureWithSize:(CGSize)size {
+    glGenFramebuffers(1, &_frameBuffer);
+    glBindFramebuffer(GL_FRAMEBUFFER, _frameBuffer);
+    
+
+    glActiveTexture(GL_TEXTURE0);
+    glGenTextures(1, &_outputTexture);
+    glBindTexture(GL_TEXTURE_2D, _outputTexture);
+    
+    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
+    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
+    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
+    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
+    glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, size.width, size.height, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
+    glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, _outputTexture, 0);
+    GLenum status = glCheckFramebufferStatus(GL_FRAMEBUFFER);
+    NSAssert(status == GL_FRAMEBUFFER_COMPLETE, @"Incomplete filter FBO: %d", status);
+    
+}
+
+
+- (void)setupProgram
+{
+    GLuint vertexShader = [self loadShader:GL_VERTEX_SHADER
+                                   withString:VertexShaderString];
+    GLuint fragmentShader = [self loadShader:GL_FRAGMENT_SHADER
+                                     withString:FragmentShaderString];
+    
+    _program = glCreateProgram();
+    if (!_program) {
+        NSLog(@"Failed to create program.");
+        return;
+    }
+    
+    glAttachShader(_program, vertexShader);
+    glAttachShader(_program, fragmentShader);
+    
+    glLinkProgram(_program);
+    
+    // 检查错误
+    GLint linked;
+    glGetProgramiv(_program, GL_LINK_STATUS, &linked );
+    if (!linked)
+    {
+        GLint infoLen = 0;
+        glGetProgramiv (_program, GL_INFO_LOG_LENGTH, &infoLen );
+        
+        if (infoLen > 1)
+        {
+            char * infoLog = malloc(sizeof(char) * infoLen);
+            glGetProgramInfoLog (_program, infoLen, NULL, infoLog );
+            NSLog(@"Error linking program:\n%s\n", infoLog );
+            
+            free (infoLog );
+        }
+        
+        glDeleteProgram(_program);
+        _program = 0;
+        return;
+    }
+    
+    glUseProgram(_program);
+    
+    _positionSlot = glGetAttribLocation(_program, "position");
+    _texCoordSlot = glGetAttribLocation(_program, "inputTextureCoordinate");
+    _inputTexture = glGetUniformLocation(_program, "inputImageTexture");
+}
+
+-(GLuint)loadShader:(GLenum)type withString:(NSString *)shaderString
+{
+    // Create the shader object
+    GLuint shader = glCreateShader(type);
+    if (shader == 0) {
+        NSLog(@"Error: failed to create shader.");
+        return 0;
+    }
+    
+    // Load the shader source
+    const char * shaderStringUTF8 = [shaderString UTF8String];
+    glShaderSource(shader, 1, &shaderStringUTF8, NULL);
+    
+    // Compile the shader
+    glCompileShader(shader);
+    
+    // Check the compile status
+    GLint compiled = 0;
+    glGetShaderiv(shader, GL_COMPILE_STATUS, &compiled);
+    
+    if (!compiled) {
+        GLint infoLen = 0;
+        glGetShaderiv ( shader, GL_INFO_LOG_LENGTH, &infoLen );
+        
+        if (infoLen > 1) {
+            char * infoLog = malloc(sizeof(char) * infoLen);
+            glGetShaderInfoLog (shader, infoLen, NULL, infoLog);
+            NSLog(@"Error compiling shader:\n%s\n", infoLog );
+            
+            free(infoLog);
+        }
+        
+        glDeleteShader(shader);
+        return 0;
+    }
+    
+    return shader;
+}
+
+
+@end

+ 21 - 0
RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoFile/Common/Model/AliyunEffectFilterInfo.h

@@ -0,0 +1,21 @@
+//
+//  AliyunEffectFilterInfo.h
+//  AliyunVideo
+//
+//  Created by dangshuai on 17/3/11.
+//  Copyright (C) 2010-2017 Alibaba Group Holding Limited. All rights reserved.
+//
+
+#import "AliyunEffectInfo.h"
+
+/**
+ 滤镜特效model
+ */
+@interface AliyunEffectFilterInfo : AliyunEffectInfo
+
+/**
+ 滤镜特效Icon
+ */
+@property (nonatomic, copy) NSString *iconPath;
+
+@end

+ 40 - 0
RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoFile/Common/Model/AliyunEffectFilterInfo.m

@@ -0,0 +1,40 @@
+//
+//  AliyunEffectFilterInfo.m
+//  AliyunVideo
+//
+//  Created by dangshuai on 17/3/11.
+//  Copyright (C) 2010-2017 Alibaba Group Holding Limited. All rights reserved.
+//
+
+#import "AliyunEffectFilterInfo.h"
+#import "AliyunIConfig.h"
+
+@implementation AliyunEffectFilterInfo
+
+- (NSString *)localFilterIconPath {
+    NSString *bundle = [[NSBundle mainBundle] bundlePath];
+    if (self.eid == -1) {
+        // 原片
+        NSString *imagePath = [[AliyunIConfig config] imageName:@"origin_filter_icon"];
+        return [bundle stringByAppendingPathComponent:imagePath];
+    }
+    if (self.iconPath) {
+        return [bundle stringByAppendingPathComponent:self.iconPath];
+    }
+    
+    NSString *string = [NSString stringWithFormat:@"%@/%@",self.resourcePath, self.icon];
+    NSString *imagePath = [bundle stringByAppendingPathComponent:string];
+    self.iconPath = string;
+    return imagePath;
+}
+
+- (NSString *)localFilterResourcePath {
+    if ( self.name == nil || [self.name isEqualToString:@"原片"]) {
+        return nil;
+    }
+    NSString *bundle = [[NSBundle mainBundle] bundlePath];
+    NSString *str = [bundle stringByAppendingPathComponent:self.resourcePath];
+    return str;
+}
+
+@end

+ 91 - 0
RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoFile/Common/Model/AliyunEffectInfo.h

@@ -0,0 +1,91 @@
+//
+//  AliyunEffectInfo.h
+//  AliyunVideo
+//
+//  Created by dangshuai on 17/3/11.
+//  Copyright (C) 2010-2017 Alibaba Group Holding Limited. All rights reserved.
+//
+
+#import <Foundation/Foundation.h>
+#import "JSONModel.h"
+
+/**
+ 滤镜model基类
+ */
+@interface AliyunEffectInfo : JSONModel
+
+/**
+ 数据ID
+ */
+@property (nonatomic, assign) NSInteger eid;
+
+/**
+ 数据类型
+ */
+@property (nonatomic, assign) NSInteger effectType;
+/**
+ 滤镜类型
+ */
+@property (nonatomic, assign) NSInteger filterType;
+
+/**
+ 滤镜分类名称
+ */
+@property (nonatomic, copy) NSString *filterTypeName;
+/**
+ 滤镜分组id
+ */
+@property (nonatomic, assign) NSInteger groupId;
+
+/**
+ 图标
+ */
+@property (nonatomic, copy) NSString *icon;
+
+/**
+ 名称
+ */
+@property (nonatomic, copy) NSString *name;
+
+/**
+ 滤镜描述
+ */
+@property (nonatomic, copy) NSString *edescription;
+
+/**
+ 是否在数据库里包含
+ */
+@property (nonatomic, assign) BOOL isDBContain;
+
+/**
+ 分组名称
+ */
+@property (nonatomic, copy) NSString *groupName;
+
+/**
+ download URL
+ */
+@property (nonatomic, copy) NSString *url;
+@property (nonatomic, copy) NSString *md5;
+
+/**
+ 资源路径
+ */
+@property (nonatomic, copy) NSString *resourcePath;
+
+
+/**
+ 获取本地滤镜Icon路径
+
+ @return 本地滤镜Icon路径
+ */
+- (NSString *)localFilterIconPath;
+
+/**
+ 获取滤镜资源本地路径
+
+ @return 滤镜资源本地路径
+ */
+- (NSString *)localFilterResourcePath;
+
+@end

+ 54 - 0
RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoFile/Common/Model/AliyunEffectInfo.m

@@ -0,0 +1,54 @@
+//
+//  AliyunEffectInfo.m
+//  AliyunVideo
+//
+//  Created by dangshuai on 17/3/11.
+//  Copyright (C) 2010-2017 Alibaba Group Holding Limited. All rights reserved.
+//
+
+#import "AliyunEffectInfo.h"
+#import "AliyunEffectResourceModel.h"
+
+@implementation AliyunEffectInfo
+
++ (BOOL)propertyIsOptional:(NSString *)propertyName {
+    return YES;
+}
+
+- (NSString *)localFilterIconPath {
+    return nil;
+}
+
+- (NSString *)localFilterResourcePath {
+    return nil;
+}
+
+- (NSString *)filterTypeName{
+    NSString *typeName = @"";
+    switch (_filterType) {
+        case AliyunFilterTypNone:
+            typeName = @"";
+            break;
+        case AliyunFilterTypeFace:
+            typeName = @"人物类";
+            break;
+        case AliyunFilterTypeFood:
+            typeName = @"食物类";
+            break;
+        case AliyunFilterTypeScenery:
+            typeName = @"风景类";
+            break;
+        case AliyunFilterTypePet:
+            typeName = @"宠物类";
+            break;
+        case AliyunFilterTypeSpecialStyle:
+            typeName = @"特殊风格类";
+            break;
+        default:
+            break;
+    }
+    return typeName;
+}
+
+
+@end

+ 21 - 0
RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoFile/Common/Model/AliyunEffectMusicInfo.h

@@ -0,0 +1,21 @@
+//
+//  AliyunEffectMusicInfo.h
+//  AliyunVideo
+//
+//  Created by dangshuai on 17/3/11.
+//  Copyright (C) 2010-2017 Alibaba Group Holding Limited. All rights reserved.
+//
+
+#import "AliyunEffectInfo.h"
+
+/**
+ music信息Model
+ */
+@interface AliyunEffectMusicInfo : AliyunEffectInfo
+
+/**
+ 唯一标识
+ */
+@property (nonatomic, strong) NSString *tag;
+
+@end

+ 19 - 0
RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoFile/Common/Model/AliyunEffectMusicInfo.m

@@ -0,0 +1,19 @@
+//
+//  AliyunEffectMusicInfo.m
+//  AliyunVideo
+//
+//  Created by dangshuai on 17/3/11.
+//  Copyright (C) 2010-2017 Alibaba Group Holding Limited. All rights reserved.
+//
+
+#import "AliyunEffectMusicInfo.h"
+
+@implementation AliyunEffectMusicInfo
+
++ (JSONKeyMapper *)keyMapper {
+    
+    return [[JSONKeyMapper alloc] initWithModelToJSONDictionary:@{@"eid":@"id",
+                                                                  @"edescription":@"description"}];
+}
+
+@end

+ 48 - 0
RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoFile/Common/Model/AliyunEffectMvGroup.h

@@ -0,0 +1,48 @@
+//
+//  AliyunEffectMvInfo.h
+//  AliyunVideo
+//
+//  Created by dangshuai on 17/3/11.
+//  Copyright (C) 2010-2017 Alibaba Group Holding Limited. All rights reserved.
+//
+
+#import "AliyunEffectInfo.h"
+#import "AliyunEffectMvInfo.h"
+
+
+/**
+ MV比例
+
+ - AliyunEffectMVRatio9To16: 9:16
+ - AliyunEffectMVRatio3To4: 3:4
+ - AliyunEffectMVRatio1To1: 1:1
+ - AliyunEffectMVRatio4To3: 4:3
+ - AliyunEffectMVRatio16To9: 16:9
+ */
+typedef NS_ENUM(NSInteger, AliyunEffectMVRatio) {
+    AliyunEffectMVRatio9To16,
+    AliyunEffectMVRatio3To4,
+    AliyunEffectMVRatio1To1,
+    AliyunEffectMVRatio4To3,
+    AliyunEffectMVRatio16To9,
+};
+
+/**
+ MV组信息
+ */
+@interface AliyunEffectMvGroup : AliyunEffectInfo
+
+/**
+ MV列表
+ */
+@property (nonatomic, copy) NSArray <AliyunEffectMvInfo *> *mvList;
+
+/**
+ 根据MV比例获取MV资源本地路径
+
+ @param r MV比例
+ @return MV资源本地路径
+ */
+- (NSString *)localResoucePathWithVideoRatio:(AliyunEffectMVRatio)r;
+
+@end

+ 94 - 0
RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoFile/Common/Model/AliyunEffectMvGroup.m

@@ -0,0 +1,94 @@
+//
+//  AliyunEffectMvInfo.m
+//  AliyunVideo
+//
+//  Created by dangshuai on 17/3/11.
+//  Copyright (C) 2010-2017 Alibaba Group Holding Limited. All rights reserved.
+//
+
+#import "AliyunEffectMvGroup.h"
+
+@implementation AliyunEffectMvGroup
+
+
+- (NSString *)localResoucePathWithVideoRatio:(AliyunEffectMVRatio)r {
+    
+    if (!self.resourcePath) return nil;
+    
+    NSString *rootPath = [self localMVSourcePath];
+    NSString *folderName = nil;
+    NSArray *subPaths = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:rootPath error:nil];
+    if (subPaths.count) {
+        BOOL hasFolder = NO;
+        for (NSString *subPath in subPaths) {
+            if ([subPath hasPrefix:@"folder"]) {
+                hasFolder = YES;
+                folderName = subPath;
+                break;
+            }
+        }
+        if (!hasFolder) {
+            return rootPath;
+        }
+    }
+    
+    NSString *folder = folderName;
+    NSLog(@"%@",folder);
+    float videoAspect;
+    switch (r) {
+        case AliyunEffectMVRatio1To1:
+            folder = @"folder1.1";
+            videoAspect = 1 / 1.0;
+            break;
+        case AliyunEffectMVRatio16To9:
+            folder = @"folder16.9";
+            videoAspect = 16 / 9.0;
+            break;
+        case AliyunEffectMVRatio9To16:
+            folder = @"folder9.16";
+            videoAspect = 9 / 16.0;
+            break;
+        case AliyunEffectMVRatio4To3:
+            folder = @"folder4.3";
+            videoAspect = 4 / 3.0;
+            break;
+        case AliyunEffectMVRatio3To4:
+            folder = @"folder1.1";
+            videoAspect = 3 / 4.0;
+            break;
+        default:
+            break;
+    }
+    if (folder) {
+        NSString *path = [rootPath stringByAppendingPathComponent:folder];
+        BOOL exists = [[NSFileManager defaultManager] fileExistsAtPath:path];
+        if (exists) {
+            return path;
+        } else {
+            // 不存在时  取分辨率最近值的mv
+            NSDictionary *dic = @{@(fabs(videoAspect - (9/16.0))):@"folder9.16",
+                                  @(fabs(videoAspect - (3/4.0))):@"folder3.4",
+                                  @(fabs(videoAspect - (1.0))):@"folder1.1",
+                                  @(fabs(videoAspect - (4/3.0))):@"folder4.3",
+                                  @(fabs(videoAspect - (16/9.0))):@"folder16.9"};
+            NSArray *keySort = [[dic allKeys] sortedArrayUsingSelector:@selector(compare:)];
+            
+            for (int index = 0; index < keySort.count; index ++) {
+                NSNumber *currentMinKey = keySort[index];
+                NSString *currentPath = [rootPath stringByAppendingPathComponent:[dic objectForKey:currentMinKey]];
+                if ([[NSFileManager defaultManager] fileExistsAtPath:currentPath]){
+                    NSLog(@"mvPath:%@", currentPath);
+                    return currentPath;
+                }
+            }
+
+        }
+    }
+    return rootPath;
+}
+
+- (NSString *)localMVSourcePath {
+    return [NSHomeDirectory() stringByAppendingPathComponent:self.resourcePath];
+}
+
+@end

+ 35 - 0
RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoFile/Common/Model/AliyunEffectMvInfo.h

@@ -0,0 +1,35 @@
+//
+//  AliyunEffectAspectListModel.h
+//  AliyunVideo
+//
+//  Created by TripleL on 17/3/6.
+//  Copyright (C) 2010-2017 Alibaba Group Holding Limited. All rights reserved.
+//
+
+#import "JSONModel.h"
+
+@protocol AliyunEffectMvInfo
+@end
+
+/**
+ MV信息model
+ */
+@interface AliyunEffectMvInfo : JSONModel
+
+/**
+ 资源路径
+ */
+@property (nonatomic, copy) NSString *resourcePath;
+
+/* aspect类型
+ * 1.  1:1
+ * 2.  4:3
+ * 3.  16:9
+ */
+@property (nonatomic, copy) NSString *aspect;
+
+@property (nonatomic, copy) NSString *download;
+
+@property (nonatomic, copy) NSString *md5;
+
+@end

+ 17 - 0
RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoFile/Common/Model/AliyunEffectMvInfo.m

@@ -0,0 +1,17 @@
+//
+//  AliyunEffectAspectListModel.m
+//  AliyunVideo
+//
+//  Created by TripleL on 17/3/6.
+//  Copyright (C) 2010-2017 Alibaba Group Holding Limited. All rights reserved.
+//
+
+#import "AliyunEffectMvInfo.h"
+
+@implementation AliyunEffectMvInfo
+
++ (BOOL)propertyIsOptional:(NSString *)propertyName {
+    
+    return YES;
+}
+@end

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

+ 18 - 0
RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoFile/Common/QUTimeline/AliyunTimelineFilterItem.h

@@ -0,0 +1,18 @@
+//
+//  AliyunTimelineFilterItem.h
+//  qusdk
+//
+//  Created by Vienta on 2018/1/15.
+//  Copyright © 2018年 Alibaba Group Holding Limited. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+
+@interface AliyunTimelineFilterItem : NSObject
+
+@property (nonatomic, assign) CGFloat startTime;
+@property (nonatomic, assign) CGFloat endTime;
+@property (nonatomic, strong) UIColor *displayColor;
+@property (nonatomic, strong) id obj;
+
+@end

+ 13 - 0
RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoFile/Common/QUTimeline/AliyunTimelineFilterItem.m

@@ -0,0 +1,13 @@
+//
+//  AliyunTimelineFilterItem.m
+//  qusdk
+//
+//  Created by Vienta on 2018/1/15.
+//  Copyright © 2018年 Alibaba Group Holding Limited. All rights reserved.
+//
+
+#import "AliyunTimelineFilterItem.h"
+
+@implementation AliyunTimelineFilterItem
+
+@end

+ 20 - 0
RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoFile/Common/QUTimeline/AliyunTimelineItem.h

@@ -0,0 +1,20 @@
+//
+//  AliyunTimelineItem.h
+//  AliyunVideo
+//
+//  Created by Vienta on 2017/3/15.
+//  Copyright (C) 2010-2017 Alibaba Group Holding Limited. All rights reserved.
+//
+
+#import <Foundation/Foundation.h>
+#import <CoreGraphics/CoreGraphics.h>
+
+@interface AliyunTimelineItem : NSObject
+
+@property (nonatomic, assign) CGFloat startTime;
+@property (nonatomic, assign) CGFloat endTime;
+@property (nonatomic, assign) BOOL isEdit;
+@property (nonatomic, weak) id obj;
+@property (nonatomic, assign) CGFloat minDuration;
+
+@end

+ 15 - 0
RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoFile/Common/QUTimeline/AliyunTimelineItem.m

@@ -0,0 +1,15 @@
+
+//
+//  AliyunTimelineItem.m
+//  AliyunVideo
+//
+//  Created by Vienta on 2017/3/15.
+//  Copyright (C) 2010-2017 Alibaba Group Holding Limited. All rights reserved.
+//
+
+#import "AliyunTimelineItem.h"
+
+@implementation AliyunTimelineItem
+
+@end
+

+ 34 - 0
RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoFile/Common/QUTimeline/AliyunTimelineItemCell.h

@@ -0,0 +1,34 @@
+//
+//  AliyunTimelineItemCell.h
+//  QPSDKCore
+//
+//  Created by Vienta on 2016/11/25.
+//  Copyright © 2016年 lyle. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+
+
+@interface AliyunTimelinePercent : NSObject
+
+@property (nonatomic, assign) CGFloat leftPercent;
+@property (nonatomic, assign) CGFloat rightPercent;
+@property (nonatomic, strong) UIColor *color;
+
+@end
+
+
+@interface AliyunTimelineItemCell : UICollectionViewCell
+
+@property (nonatomic, assign) CGFloat mappedBeginTime;
+@property (nonatomic, assign) CGFloat mappedEndTime;
+@property (nonatomic, strong) UIImageView *imageView;
+
+- (void)setMappedBeginTime:(CGFloat)mappedBeginTime
+                   endTime:(CGFloat)mappedEndTime
+                     image:(UIImage *)image
+          timelinePercents:(NSArray *)percents
+    timelineFilterPercents:(NSArray *)filterPercents
+timelineTimeFilterPercents:(NSArray *)timeFilterPercents;
+
+@end

+ 175 - 0
RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoFile/Common/QUTimeline/AliyunTimelineItemCell.m

@@ -0,0 +1,175 @@
+//
+//  AliyunTimelineItemCell.m
+//  QPSDKCore
+//
+//  Created by Vienta on 2016/11/25.
+//  Copyright © 2016年 lyle. All rights reserved.
+//
+
+#import "AliyunTimelineItemCell.h"
+#import "AlivcMacro.h"
+
+@implementation AliyunTimelinePercent
+
+
+
+@end
+
+
+@interface AliyunTimelineItemCell ()
+
+@property (nonatomic, strong) UIView *greyView;
+@property (nonatomic, strong) NSMutableArray *greyViews;
+@property (nonatomic, strong) NSMutableArray *percents;
+@property (nonatomic, strong) NSMutableArray *filterPercents;
+@property (nonatomic, strong) NSMutableArray *filterViews;
+@property (nonatomic, strong) NSMutableArray *timeFilterPercents;
+@property (nonatomic, strong) NSMutableArray *timeFilterViews;
+
+@end
+
+@implementation AliyunTimelineItemCell
+
+- (instancetype)initWithFrame:(CGRect)frame
+{
+    if (self = [super initWithFrame:frame]) {
+        UIColor *backgroundColor = [UIColor clearColor];
+        self.backgroundColor = backgroundColor;
+        self.imageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, CGRectGetWidth(frame), CGRectGetHeight(frame))];
+        self.imageView.contentMode = UIViewContentModeScaleAspectFill;
+        self.imageView.clipsToBounds = YES;
+        [self addSubview:self.imageView];
+        
+        self.greyView = [[UIView alloc] initWithFrame:CGRectZero];
+        [self addSubview:self.greyView];
+        self.greyView.backgroundColor = AlivcOxRGBA(0x3CF2FF, 0.7);
+        self.greyView.hidden = YES;
+    }
+    return self;
+}
+
+
+- (void)layoutSubviews
+{
+    [super layoutSubviews];
+    self.imageView.bounds = self.bounds;
+}
+
+- (void)refreshGreyviews
+{
+    for (AliyunTimelinePercent *percent in self.percents) {
+        CGFloat x = percent.leftPercent * self.bounds.size.width;
+        CGFloat width = (percent.rightPercent - percent.leftPercent) * self.bounds.size.width;
+        CGRect frame = CGRectMake(x, 0, width, CGRectGetHeight(self.bounds));
+        UIView *greyview = [[UIView alloc] initWithFrame:frame];
+        greyview.backgroundColor = AlivcOxRGBA(0x3CF2FF, 0.7);
+//        greyview.backgroundColor = [[UIColor whiteColor] colorWithAlphaComponent:.4];
+        [self addSubview:greyview];
+        [self.greyViews addObject:greyview];
+    }
+}
+
+- (void)refreshFilterviews {
+    for (AliyunTimelinePercent *percent in self.filterPercents) {
+        CGFloat x = percent.leftPercent * self.bounds.size.width;
+        CGFloat width = (percent.rightPercent - percent.leftPercent) * self.bounds.size.width;
+        CGRect frame = CGRectMake(x, 0, width, CGRectGetHeight(self.bounds));
+        UIView *filterView = [[UIView alloc] initWithFrame:frame];
+        filterView.backgroundColor = percent.color;
+        [self addSubview:filterView];
+        [self.filterViews addObject:filterView];
+    }
+}
+
+- (void)refreshTimeFilterviews {
+    for (AliyunTimelinePercent *percent in self.timeFilterPercents) {
+        CGFloat x = percent.leftPercent * self.bounds.size.width;
+        CGFloat width = (percent.rightPercent - percent.leftPercent) * self.bounds.size.width;
+        CGRect frame = CGRectMake(x, 0, width, CGRectGetHeight(self.bounds));
+        UIView *filterView = [[UIView alloc] initWithFrame:frame];
+        filterView.backgroundColor = percent.color;
+        [self addSubview:filterView];
+        [self.timeFilterViews addObject:filterView];
+    }
+}
+
+- (void)setMappedBeginTime:(CGFloat)mappedBeginTime
+                   endTime:(CGFloat)mappedEndTime
+                     image:(UIImage *)image
+          timelinePercents:(NSArray *)percents
+    timelineFilterPercents:(NSArray *)filterPercents
+timelineTimeFilterPercents:(NSArray *)timeFilterPercents
+{
+    self.mappedBeginTime = mappedBeginTime;
+    self.mappedEndTime = mappedEndTime;
+    
+    if (![self.imageView.image isEqual:image]) {
+        [self.imageView setImage:image];
+    }
+    
+    [self.percents removeAllObjects];
+    [self.percents addObjectsFromArray:percents];
+    [self.greyViews makeObjectsPerformSelector:@selector(removeFromSuperview)];
+    [self.greyViews removeAllObjects];
+    [self refreshGreyviews];
+
+    [self.filterPercents removeAllObjects];
+    [self.filterPercents addObjectsFromArray:filterPercents];
+    [self.filterViews makeObjectsPerformSelector:@selector(removeFromSuperview)];
+    [self.filterViews removeAllObjects];
+    [self refreshFilterviews];
+
+
+    [self.timeFilterPercents removeAllObjects];
+    [self.timeFilterPercents addObjectsFromArray:timeFilterPercents];
+    [self.timeFilterViews makeObjectsPerformSelector:@selector(removeFromSuperview)];
+    [self.timeFilterViews removeAllObjects];
+    
+    [self refreshTimeFilterviews];
+}
+
+- (NSMutableArray *)greyViews
+{
+    if (!_greyViews) {
+        _greyViews = [[NSMutableArray alloc] init];
+    }
+    return _greyViews;
+}
+
+- (NSMutableArray *)percents
+{
+    if (!_percents) {
+        _percents = [[NSMutableArray alloc] init];
+    }
+    return _percents;
+}
+
+- (NSMutableArray *)filterPercents {
+    if (!_filterPercents) {
+        _filterPercents = [[NSMutableArray alloc] init];
+    }
+    return _filterPercents;
+}
+
+- (NSMutableArray *)filterViews {
+    if (!_filterViews) {
+        _filterViews = [[NSMutableArray alloc] init];
+    }
+    return _filterViews;
+}
+
+- (NSMutableArray *)timeFilterPercents {
+    if (!_timeFilterPercents) {
+        _timeFilterPercents = [[NSMutableArray alloc] init];
+    }
+    return _timeFilterPercents;
+}
+
+- (NSMutableArray *)timeFilterViews {
+    if (!_timeFilterViews) {
+        _timeFilterViews = [[NSMutableArray alloc] init];
+    }
+    return _timeFilterViews;
+}
+
+@end

+ 25 - 0
RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoFile/Common/QUTimeline/AliyunTimelineMediaInfo.h

@@ -0,0 +1,25 @@
+//
+//  AliyunTimelineMediaInfo.h
+//  qusdk_debug
+//
+//  Created by Vienta on 2017/6/28.
+//  Copyright © 2017年 Alibaba Group Holding Limited. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+
+typedef enum : NSUInteger {
+    AliyunTimelineMediaInfoTypeVedio = 0,
+    AliyunTimelineMediaInfoTypePhoto = 1,
+    AliyunTimelineMediaInfoTypeGif = 3
+} AliyunTimelineMediaInfoType;
+
+@interface AliyunTimelineMediaInfo : NSObject
+
+@property (nonatomic, assign) AliyunTimelineMediaInfoType mediaType; //媒体类型 视频或者图片
+@property (nonatomic, copy) NSString *path;     //媒体资源路径
+@property (nonatomic, assign) CGFloat duration; //媒体持续时长
+@property (nonatomic, assign) CGFloat startTime; //媒体持续时长
+@property (nonatomic, assign) int rotate;//旋转角度
+
+@end

+ 13 - 0
RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoFile/Common/QUTimeline/AliyunTimelineMediaInfo.m

@@ -0,0 +1,13 @@
+//
+//  AliyunTimelineMediaInfo.m
+//  qusdk_debug
+//
+//  Created by Vienta on 2017/6/28.
+//  Copyright © 2017年 Alibaba Group Holding Limited. All rights reserved.
+//
+
+#import "AliyunTimelineMediaInfo.h"
+
+@implementation AliyunTimelineMediaInfo
+
+@end

+ 18 - 0
RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoFile/Common/QUTimeline/AliyunTimelineTimeFilterItem.h

@@ -0,0 +1,18 @@
+//
+//  AliyunTimelineTimeFilterItem.h
+//  qusdk
+//
+//  Created by Vienta on 2018/2/26.
+//  Copyright © 2018年 Alibaba Group Holding Limited. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+
+@interface AliyunTimelineTimeFilterItem : NSObject
+
+@property (nonatomic, assign) CGFloat startTime;
+@property (nonatomic, assign) CGFloat endTime;
+@property (nonatomic, strong) UIColor *displayColor;
+@property (nonatomic, strong) id obj;
+
+@end

+ 23 - 0
RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoFile/Common/QUTimeline/AliyunTimelineTimeFilterItem.m

@@ -0,0 +1,23 @@
+//
+//  AliyunTimelineTimeFilterItem.m
+//  qusdk
+//
+//  Created by Vienta on 2018/2/26.
+//  Copyright © 2018年 Alibaba Group Holding Limited. All rights reserved.
+//
+
+#import "AliyunTimelineTimeFilterItem.h"
+#import "UIColor+AlivcHelper.h"
+#import "AlivcMacro.h"
+
+@implementation AliyunTimelineTimeFilterItem
+- (instancetype)init
+{
+    self = [super init];
+    if (self) {
+        _displayColor = [UIColor colorWithHexString:@"0x3CF2FF" alpha:0.7];
+        
+    }
+    return self;
+}
+@end

+ 229 - 0
RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoFile/Common/QUTimeline/AliyunTimelineView.h

@@ -0,0 +1,229 @@
+//
+//  AliyunTimelineView.h
+//  QPSDKCore
+//
+//  Created by Vienta on 2016/11/25.
+//  Copyright © 2016年 lyle. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+#import "AliyunTimelineItem.h"
+#import "AliyunTimelineMediaInfo.h"
+#import "AliyunTimelineFilterItem.h"
+#import "AliyunTimelineTimeFilterItem.h"
+
+@protocol AliyunTimelineViewDelegate;
+
+@interface AliyunTimelineView : UIView
+
+/**
+ 代理
+ */
+@property (nonatomic, weak) id<AliyunTimelineViewDelegate> delegate;
+
+
+/**
+ 区域编辑 - 左边的滑动块图片对应的名称
+ */
+@property (nonatomic, copy) NSString *leftPinchImageName;
+
+/**
+ 区域编辑 - 右边的滑动块图片对应的名称
+ */
+@property (nonatomic, copy) NSString *rightPinchImageName;
+
+/**
+ 区域编辑 - 背景图片
+ */
+@property (nonatomic, copy) NSString *pinchBgImageName;
+
+/**
+ 中间指针的颜色
+ */
+@property (nonatomic, strong) UIColor *indicatorColor;
+
+/**
+ 区域编辑 - 左右滑动拉出区域的背景颜色
+ */
+@property (nonatomic, strong) UIColor *pinchBgColor;
+
+
+/**
+ 总的实际的时间
+ */
+@property (nonatomic, assign) CGFloat actualDuration;
+
+
+/**
+ 第一帧图片
+ */
+@property (nonatomic, strong) UIImage *coverImage;
+
+/**
+ 同步获取第一帧图片
+
+ @return 图片
+ */
+- (UIImage *)getCoverImageSync;
+/**
+ 装载数据,用来显示
+
+ @param clips 媒体片段
+ @param segment 段长(指的是一个屏幕宽度的视频时长  单位:s)
+ @param photos 一个段长上需要显示的图片个数 默认为8
+ */
+- (void)setMediaClips:(NSArray<AliyunTimelineMediaInfo *> *)clips segment:(CGFloat)segment photosPersegent:(NSInteger)photos;
+
+/**
+ 获取当前时间指针所指向的时间
+
+ @return 时间
+ */
+- (CGFloat)getCurrentTime;
+
+/**
+ 视频播放过程中,传入当前播放的时间,导航条进行相应的展示
+
+ @param time 当前播放时间
+ */
+- (void)seekToTime:(CGFloat)time;
+
+
+/**
+ 取消当前控件行为 例如:在滑动时,调用此方法则不再滑动
+ */
+- (void)cancel;
+
+/**
+ 添加显示元素 (例如加动图后,需要构建timelineItem对象,并且传入用来显示)
+
+ @param timelineItem 显示元素
+ */
+- (void)addTimelineItem:(AliyunTimelineItem *)timelineItem;
+
+/**
+ 删除显示元素
+
+ @param timelineItem 显示元素
+ */
+- (void)removeTimelineItem:(AliyunTimelineItem *)timelineItem;
+
+/**
+ 传入Timeline进入编辑
+
+ @param timelineItem timelineItem
+ */
+- (void)editTimelineItem:(AliyunTimelineItem *)timelineItem;
+
+/**
+ timelineView编辑完成
+ */
+- (void)editTimelineComplete;
+
+/**
+ 从vid获取AliyunTimelineItem对象
+
+ @param obj obj
+ @return AliyunTimelineItem
+ */
+- (AliyunTimelineItem *)getTimelineItemWithOjb:(id)obj;
+
+/**
+ 动效滤镜的显示元素
+ 添加元素
+
+ @param filterItem 动效滤镜元素
+ */
+- (void)addTimelineFilterItem:(AliyunTimelineFilterItem *)filterItem;
+
+/**
+ 更新进度
+
+ @param filterItem 动效滤镜
+ */
+- (void)updateTimelineFilterItems:(AliyunTimelineFilterItem *)filterItem;
+
+/**
+ 删除动效滤镜显示元素
+
+ @param filterItem 动效滤镜元素
+ */
+- (void)removeTimelineFilterItem:(AliyunTimelineFilterItem *)filterItem;
+
+/**
+ 删除最后一个滤镜显示元素
+ */
+- (void)removeLastFilterItemFromTimeline;
+
+/**
+ 删除所有的动效元素
+ */
+- (void)removeAllFilterItemFromTimeline;
+/**
+ 时间特效的显示元素
+
+ @param timeFilterItem 时间特效元素
+ */
+- (void)addTimelineTimeFilterItem:(AliyunTimelineTimeFilterItem *)timeFilterItem;
+
+/**
+ 删除时间特效元素
+
+ @param timeFilterItem 时间特效元素
+ */
+- (void)removeTimelineTimeFilterItem:(AliyunTimelineTimeFilterItem *)timeFilterItem;
+
+- (void)removeAllTimelineTimeFilterItem;
+
+/**
+ 更新透明度
+
+ @param alpha 透明度
+ */
+- (void)updateTimelineViewAlpha:(CGFloat)alpha;
+
+
+/**
+ 停止滑动
+ */
+- (void)stopSlid;
+
+@end
+
+
+
+
+@protocol AliyunTimelineViewDelegate <NSObject>
+/**
+ 回调拖动的item对象(在手势结束时发生)
+
+ @param item timeline对象
+ */
+- (void)timelineDraggingTimelineItem:(AliyunTimelineItem *)item;
+
+
+/**
+ 回调timeline开始被手动滑动
+ */
+- (void)timelineBeginDragging;
+
+- (void)timelineDraggingAtTime:(CGFloat)time;
+
+- (void)timelineEndDraggingAndDecelerate:(CGFloat)time;
+
+- (void)timelineCurrentTime:(CGFloat)time duration:(CGFloat)duration;
+
+/**
+ 调节覆盖时长的拖动事件
+
+ @param time 当前时间
+ */
+- (void)timelineEditDraggingAtTime:(CGFloat)time;
+
+
+
+@end
+
+
+
+

Diferenças do arquivo suprimidas por serem muito extensas
+ 1107 - 0
RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoFile/Common/QUTimeline/AliyunTimelineView.m


+ 125 - 0
RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoFile/Common/ResourceManager/Manager/AliyunDBHelper.h

@@ -0,0 +1,125 @@
+//
+//  QUDBManager.h
+//  AliyunVideo
+//
+//  Created by TripleL on 17/3/2.
+//  Copyright (C) 2010-2017 Alibaba Group Holding Limited. All rights reserved.
+//
+
+#import <Foundation/Foundation.h>
+@class AliyunEffectResourceModel;
+@class AliyunEffectInfo;
+
+@interface AliyunDBHelper : NSObject
+
+
+/**
+ 打开数据库
+
+ @param success 成功回调
+ @param failure 失败回调
+ */
+- (void)openResourceDBSuccess:(void(^)(NSString *path))success
+                      failure:(void(^)(NSError *error))failure;
+
+/**
+ 添加数据AliyunEffectResourceModel
+
+ @param model AliyunEffectResourceModel
+ */
+- (void)insertDataWithEffectResourceModel:(AliyunEffectResourceModel *)model;
+
+
+
+/**
+ 添加数据AliyunEffectInfo
+
+ @param info AliyunEffectInfo
+ */
+- (void)insertDataWithEffectInfo:(AliyunEffectInfo *)info;
+
+
+/**
+ 删除数据
+
+ @param model 资源model
+ */
+- (void)deleteDataWithEffectResourceModel:(AliyunEffectResourceModel *)model;
+
+
+
+/**
+ 修改数据
+
+ @param model 资源model
+ */
+- (void)updateDataWithEffectResourceModel:(AliyunEffectResourceModel *)model;
+
+
+/**
+ 查找某类型资源的全部数据 该方法返回的是大类AliyunEffectResourceModel
+
+ @param type 素材类别 参考AliyunEffectResourceModel的AliyunEffectType注释
+ @param success 成功回调 资源数组
+ @param failure 失败回调
+ */
+- (void)queryAllResourcesWithEffectType:(NSInteger)type
+                                success:(void(^)(NSArray *resourceArray))success
+                                faliure:(void(^)(NSError *error))failure;
+
+/**
+ 查询某一个资源是否在数据库中AliyunEffectResourceModel
+
+ @param model AliyunEffectResourceModel
+ @return 是否存在于数据库
+ */
+- (BOOL)queryOneResourseWithEffectResourceModel:(AliyunEffectResourceModel *)model;
+
+
+
+/**
+ 查询某一个资源是否在数据库中AliyunEffectInfo
+
+ @param info AliyunEffectInfo
+ @return 是否存在于数据库
+ */
+- (BOOL)queryOneResourseWithEffectInfo:(AliyunEffectInfo *)info;
+
+
+
+
+/**
+ 查询某单个AliyunEffectInfo数据
+
+ @param effectType 数据类型
+ @param effectId id
+ @return 有数据返回AliyunEffectInfo 无数据返回nil
+ */
+- (AliyunEffectInfo *)queryEffectInfoWithEffectType:(NSInteger)effectType
+                                        effctId:(NSInteger)effectId;
+
+
+
+/**
+ 查询某类别素材的全部数据 改方法会返回对应的AliyunEffectInfo
+
+ @param infoType 查询类别type 1: 字体 2: 动图 3:imv 4:滤镜 5:音乐 6:字幕
+ @param success 成功回调
+ @param failure 失败回调
+ */
+- (void)queryResourceWithEffecInfoType:(NSInteger)infoType
+                               success:(void(^)(NSArray *infoModelArray))success
+                               failure:(void(^)(NSError *error))failure;
+
+
+
+/**
+ 关闭数据库
+ */
+- (void)closeDB;
+// 录制界面音乐的本地资源获取
+- (void)queryMusicResourceWithEffecInfoType:(NSInteger)infoType
+                                    success:(void(^)(NSArray *infoModelArray))success
+                                    failure:(void(^)(NSError *error))failure;
+
+@end

Diferenças do arquivo suprimidas por serem muito extensas
+ 385 - 0
RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoFile/Common/ResourceManager/Manager/AliyunDBHelper.m


+ 39 - 0
RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoFile/Common/ResourceManager/Manager/AliyunEffectModelTransManager.h

@@ -0,0 +1,39 @@
+//
+//  AliyunEffectModelTransManager.h
+//  AliyunVideo
+//
+//  Created by TripleL on 17/3/11.
+//  Copyright (C) 2010-2017 Alibaba Group Holding Limited. All rights reserved.
+//
+
+#import <Foundation/Foundation.h>
+@class AliyunEffectResourceModel;
+@class AliyunEffectInfo;
+
+@interface AliyunEffectModelTransManager : NSObject
+
+
+
++ (AliyunEffectModelTransManager *)manager;
+
+
+/**
+ AliyunEffectResourceModel转换为AliyunEffectInfo
+
+ @param resourceModel AliyunEffectResourceModel
+ @return AliyunEffectInfo
+ */
+- (AliyunEffectInfo *)transEffectInfoModelWithResourceModel:(AliyunEffectResourceModel *)resourceModel;
+
+
+
+
+/**
+ AliyunEffectInfo转换为AliyunEffectResourceModel
+
+ @param info AliyunEffectInfo
+ @return AliyunEffectResourceModel
+ */
+- (AliyunEffectResourceModel *)transResourceModelWithEffectInfo:(AliyunEffectInfo *)info;
+
+@end

+ 120 - 0
RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoFile/Common/ResourceManager/Manager/AliyunEffectModelTransManager.m

@@ -0,0 +1,120 @@
+//
+//  AliyunEffectModelTransManager.m
+//  AliyunVideo
+//
+//  Created by TripleL on 17/3/11.
+//  Copyright (C) 2010-2017 Alibaba Group Holding Limited. All rights reserved.
+//
+
+#import "AliyunEffectModelTransManager.h"
+#import "AliyunEffectResourceModel.h"
+#import "AliyunEffectInfo.h"
+#import "AliyunEffectFilterInfo.h"
+#import "AliyunEffectMusicInfo.h"
+#import <objc/runtime.h>
+
+
+@implementation AliyunEffectModelTransManager
+
+static AliyunEffectModelTransManager *manager = nil;
++ (AliyunEffectModelTransManager *)manager {
+    
+    static dispatch_once_t onceToken;
+    dispatch_once(&onceToken, ^{
+        manager = [[AliyunEffectModelTransManager alloc] init];
+    });
+    return manager;
+}
+
+
+- (AliyunEffectInfo *)transEffectInfoModelWithResourceModel:(AliyunEffectResourceModel *)resourceModel {
+    
+    if (!resourceModel) {
+        return nil;
+    }
+    
+    NSDictionary *resourceDic = [self dictionaryWithModel:resourceModel];
+    
+    switch (resourceModel.effectType) {
+        case 4:
+        case 7:
+            return [self effectFilterWithResourceDic:resourceDic];
+            break;
+        case 5:
+            return [self effectMusicWithResourceDic:resourceDic];
+            break;
+        default:
+            return [[AliyunEffectInfo alloc] init];
+            break;
+    }
+    
+}
+
+- (AliyunEffectResourceModel *)transResourceModelWithEffectInfo:(AliyunEffectInfo *)info {
+    
+    NSDictionary *infoDic = [self dictionaryWithModel:info];
+    AliyunEffectResourceModel *model = [[AliyunEffectResourceModel alloc] initWithDictionary:infoDic error:nil];
+    [model setValue:[infoDic objectForKey:@"pasterList"] forKey:@"pasterList"];
+    [model setValue:[infoDic objectForKey:@"mvList"] forKey:@"mvList"];
+    
+    return model;
+}
+
+#pragma mark - AliyunEffectResourceModel转AliyunEffectInfo
+
+- (AliyunEffectFilterInfo *)effectFilterWithResourceDic:(NSDictionary *)resourceDic {
+    
+    AliyunEffectFilterInfo *filterModel = [[AliyunEffectFilterInfo alloc] initWithDictionary:resourceDic error:nil];
+    return filterModel;
+}
+
+- (AliyunEffectMusicInfo *)effectMusicWithResourceDic:(NSDictionary *)resourceDic {
+    
+    AliyunEffectMusicInfo *musicModel = [[AliyunEffectMusicInfo alloc] initWithDictionary:resourceDic error:nil];
+    return musicModel;
+}
+
+
+#pragma mark - Model转Dictionary
+- (NSDictionary *)dictionaryWithModel:(id)model {
+    if (model == nil) {
+        return nil;
+    }
+    // TODO:不知道为什么musicInfoModel不能转。。。。
+    NSMutableDictionary *dict = [[NSMutableDictionary alloc] init];
+    
+    // 获取类名/根据类名获取类对象
+    NSString *className = NSStringFromClass([model class]);
+    id classObject = objc_getClass([className UTF8String]);
+    
+    // 获取所有属性
+    UInt32 count = 0;
+    objc_property_t *properties = class_copyPropertyList(classObject, &count);
+    
+    // 遍历所有属性
+    for (int i = 0; i < count; i++) {
+        // 取得属性
+        objc_property_t property = properties[i];
+        // 取得属性名
+        NSString *propertyName = [[NSString alloc] initWithCString:property_getName(property)
+                                                          encoding:NSUTF8StringEncoding];
+        // 取得属性值
+        id propertyValue = nil;
+        id valueObject = [model valueForKey:propertyName];
+        
+        if ([valueObject isKindOfClass:[NSDictionary class]]) {
+            propertyValue = [NSDictionary dictionaryWithDictionary:valueObject];
+        } else if ([valueObject isKindOfClass:[NSArray class]]) {
+            propertyValue = [NSArray arrayWithArray:valueObject];
+        } else {
+            propertyValue = [NSString stringWithFormat:@"%@", [model valueForKey:propertyName]];
+        }
+        
+        [dict setObject:propertyValue forKey:propertyName];
+    }
+    free(properties);
+    
+    return [dict copy];
+}
+
+@end

+ 29 - 0
RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoFile/Common/ResourceManager/Manager/AliyunEffectPrestoreManager.h

@@ -0,0 +1,29 @@
+//
+//  AliyunEffectPrestoreManager.h
+//  AliyunVideo
+//
+//  Created by TripleL on 17/3/21.
+//  Copyright (C) 2010-2017 Alibaba Group Holding Limited. All rights reserved.
+//
+
+#import <Foundation/Foundation.h>
+
+@interface AliyunEffectPrestoreManager : NSObject
+
+/**
+ 添加原始数据
+ 
+ 如滤镜、MV的原片等
+ */
+
+- (void)insertInitialData;
+
+
+/**
+ 删除原始数据的沙盒拷贝
+
+ @param type 类型
+ */
+- (void)removeInitialDataWithType:(NSInteger)type;
+
+@end

+ 181 - 0
RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoFile/Common/ResourceManager/Manager/AliyunEffectPrestoreManager.m

@@ -0,0 +1,181 @@
+//
+//  AliyunEffectPrestoreManager.m
+//  AliyunVideo
+//
+//  Created by TripleL on 17/3/21.
+//  Copyright (C) 2010-2017 Alibaba Group Holding Limited. All rights reserved.
+//
+
+#import "AliyunEffectPrestoreManager.h"
+#import "AliyunDBHelper.h"
+#import "AliyunEffectResourceModel.h"
+
+@interface AliyunEffectPrestoreManager ()
+
+@property (nonatomic, strong) AliyunDBHelper *helper;
+
+@end
+
+@implementation AliyunEffectPrestoreManager
+
+
+#pragma mark - 初始化本地资源
+- (void)insertInitialData {
+    
+    self.helper = [[AliyunDBHelper alloc] init];
+    
+    [self.helper openResourceDBSuccess:nil failure:nil];
+    
+    NSArray *filters = [self localFilters];
+    if (filters.count > 0) {
+        for (NSDictionary *dic in filters) {
+            AliyunEffectResourceModel *resource = [[AliyunEffectResourceModel alloc] init];
+            resource.effectType = [dic[@"effectType"] integerValue];
+            resource.eid = [dic[@"eid"] integerValue];
+            resource.icon = dic[@"icon"];
+            resource.resourcePath = dic[@"resourcePath"];
+            resource.name = dic[@"name"];
+            resource.filterType = [dic[@"filterType"]  integerValue];
+            [self.helper insertDataWithEffectResourceModel:resource];
+        }
+    }
+    
+    AliyunEffectResourceModel *fontModel = [self localResourcesWithEffectType:1];
+    if (fontModel) {
+        [self.helper insertDataWithEffectResourceModel:fontModel];
+    }
+    
+    AliyunEffectResourceModel *pasterModel = [self localResourcesWithEffectType:2];
+    if (pasterModel) {
+        [self.helper insertDataWithEffectResourceModel:pasterModel];
+    }
+    
+    AliyunEffectResourceModel *captionModel = [self localResourcesWithEffectType:6];
+    if (captionModel) {
+        [self.helper insertDataWithEffectResourceModel:captionModel];
+    }
+    
+    AliyunEffectResourceModel *mvModel = [self localResourcesWithEffectType:3];
+    if (mvModel) {
+        [self.helper insertDataWithEffectResourceModel:mvModel];
+    }
+    
+    [self.helper closeDB];
+}
+
+
+- (NSArray *)localFilters {
+    NSString *localVerson = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleShortVersionString"];
+    NSString *key = [NSString stringWithFormat:@"LocalFilter-%@",localVerson];
+    if ([[NSUserDefaults standardUserDefaults] boolForKey:key]) {
+        return nil;
+    }
+    [[NSUserDefaults standardUserDefaults] setBool:YES forKey:key];
+    [[NSUserDefaults standardUserDefaults] synchronize];
+    NSURL *url = [[NSBundle mainBundle] URLForResource:@"LocalFilter" withExtension:@"json"];
+    NSData *json = [NSData dataWithContentsOfURL:url];
+    if (json) {
+        NSError *err = nil;
+        NSArray *filters = [NSJSONSerialization JSONObjectWithData:json
+                                                           options:NSJSONReadingAllowFragments error:&err];
+        return filters;
+    }
+    return nil;
+}
+
+
+/**
+ 加载本地数据 不包含滤镜
+ 
+ @param type 加载资源类型 1: 字体 2: 动图 3:imv 5:音乐 6:字幕
+ @return 加载的model
+ */
+- (AliyunEffectResourceModel *)localResourcesWithEffectType:(NSInteger)type {
+    
+    NSString *typeString = @"";
+    switch (type) {
+        case 1:
+            typeString = @"LocalFont";
+            break;
+        case 2:
+            typeString = @"LocalPaster";
+            break;
+        case 3:
+            typeString = @"LocalMV";
+            break;
+        case 5:
+            typeString = @"LocalMusic";
+            break;
+        case 6:
+            typeString = @"LocalCaption";
+            break;
+        default:
+            typeString = @"";
+            break;
+    }
+    //版本升级后 本地资源需要重新插入到表中
+    NSString *localVerson = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleShortVersionString"];
+    NSString *key = [NSString stringWithFormat:@"%@%@",typeString,localVerson];
+    
+    if ([[NSUserDefaults standardUserDefaults] boolForKey:key]) {
+        return nil;
+    }
+    [[NSUserDefaults standardUserDefaults] setBool:YES forKey:key];
+    [[NSUserDefaults standardUserDefaults] synchronize];
+    
+    NSURL *url = [[NSBundle mainBundle] URLForResource:typeString withExtension:@"json"];
+    NSData *json = [NSData dataWithContentsOfURL:url];
+    if (json) {
+        NSError *err = nil;
+        NSDictionary *modelDic = [NSJSONSerialization JSONObjectWithData:json
+                                                                 options:NSJSONReadingAllowFragments error:&err];
+        
+        AliyunEffectResourceModel *model = [[AliyunEffectResourceModel alloc] initWithDictionary:modelDic error:nil];
+        NSString *fileString = [[NSBundle mainBundle] pathForResource:model.resourcePath ofType:nil];
+        NSString *toFileName = [NSString stringWithFormat:@"%ld-%@", model.eid, model.name];
+        
+        if (fileString && [[NSFileManager defaultManager] fileExistsAtPath:fileString]) {
+            
+            NSURL *fileURL = [NSURL fileURLWithPath:fileString];
+            NSURL *toURL = [NSURL fileURLWithPath:[[model storageFullPath] stringByAppendingPathComponent:toFileName]];
+            dispatch_async(dispatch_get_global_queue(0, 0), ^{
+                NSError *error;
+                BOOL copyed = [[NSFileManager defaultManager] copyItemAtURL:fileURL toURL:toURL error:&error];
+                
+                NSLog(@"Errror:%@ copy:%d", error, copyed);
+            });
+            NSString *toPath = [[[model storageDirectory] stringByAppendingPathComponent:toFileName] stringByAppendingPathComponent:model.name];
+            [model setValue:toPath forKey:@"resourcePath"];
+        }
+        return model;
+    }
+    return nil;
+}
+
+
+- (void)removeInitialDataWithType:(NSInteger)type {
+    NSString *typeString = @"";
+    switch (type) {
+        case 1:
+            typeString = @"LocalFont";
+            break;
+        case 2:
+            typeString = @"LocalPaster";
+            break;
+        case 3:
+            typeString = @"LocalMV";
+            break;
+        case 5:
+            typeString = @"LocalMusic";
+            break;
+        case 6:
+            typeString = @"LocalCaption";
+            break;
+        default:
+            typeString = @"";
+            break;
+    }
+    [[NSUserDefaults standardUserDefaults] setBool:NO forKey:typeString];
+}
+
+@end

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

@@ -0,0 +1,37 @@
+//
+//  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

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

@@ -0,0 +1,274 @@
+//
+//  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

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

@@ -0,0 +1,47 @@
+//
+//  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

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

@@ -0,0 +1,116 @@
+//
+//  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

+ 95 - 0
RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoFile/Common/ResourceManager/Models/AliyunEffectResourceModel.h

@@ -0,0 +1,95 @@
+//
+//  AliyunEffectResourceModel.h
+//  AliyunVideo
+//
+//  Created by TripleL on 17/3/6.
+//  Copyright (C) 2010-2017 Alibaba Group Holding Limited. All rights reserved.
+//
+
+#import "JSONModel.h"
+#import "AliyunEffectMvInfo.h"
+
+//素材类别 1: 字体 2: 动图 3:imv 4:滤镜 5:音乐 6:字幕
+typedef NS_ENUM(NSInteger, AliyunEffectType){
+    AliyunEffectTypeFont = 1,
+    AliyunEffectTypePaster = 2,
+    AliyunEffectTypeMV = 3,
+    AliyunEffectTypeFilter = 4,
+    AliyunEffectTypeMusic = 5,
+    AliyunEffectTypeCaption = 6,
+    AliyunEffectTypeSpecialFilter = 7,
+};
+
+
+typedef enum : NSUInteger {
+     AliyunFilterTypNone = 0,          //无效果
+    AliyunFilterTypeFace = 1,          //人物
+    AliyunFilterTypeFood = 2,          //食物
+    AliyunFilterTypeScenery = 3,       //风景
+    AliyunFilterTypePet = 4,           //宠物
+    AliyunFilterTypeSpecialStyle = 5   //特殊风格
+} AliyunFilterType;
+
+@interface AliyunEffectResourceModel : JSONModel
+
+/*
+ * Local
+ */
+
+//素材类别
+@property (nonatomic, assign) AliyunEffectType effectType;
+// 用于判断数据库是否包含该资源
+@property (nonatomic, assign) BOOL isDBContain;
+// 资源路径
+@property (nonatomic, copy) NSString *resourcePath;
+// 字体在字体库中的名称
+@property (nonatomic, copy) NSString *fontName;
+// 字幕在config中的字体id
+@property (nonatomic, assign) NSInteger configFontId;
+// 字幕在config中的字体name
+@property (nonatomic, copy) NSString *configFontName;
+//滤镜的类型
+@property (nonatomic, assign) AliyunFilterType filterType;
+
+/*
+ * 以下均为server返回字段
+ */
+
+// id
+@property (nonatomic, assign) NSInteger eid;
+@property (nonatomic, assign) BOOL isNew;
+@property (nonatomic, assign) NSInteger level;
+
+// 名称
+@property (nonatomic, copy) NSString *name;
+@property (nonatomic, copy) NSString *cnName;
+@property (nonatomic, copy) NSString *key;
+@property (nonatomic, copy) NSString *category;
+// 下载路径 动图 MV 字幕等在第二层
+@property (nonatomic, copy) NSString *url;
+@property (nonatomic, copy) NSString *md5;
+@property (nonatomic, copy) NSString *banner;
+@property (nonatomic, copy) NSString *icon;
+// 描述
+@property (nonatomic, copy) NSString *edescription;
+@property (nonatomic, copy) NSString *preview;
+@property (nonatomic, copy) NSString *tag;
+@property (nonatomic, copy) NSString *cat;
+@property (nonatomic, copy) NSString *previewPic;
+@property (nonatomic, copy) NSString *previewMp4;
+@property (nonatomic, copy) NSString *duration;
+@property (nonatomic, copy) NSString *type;
+@property (nonatomic, copy) NSString *sort;
+@property (nonatomic, copy) NSArray <AliyunEffectMvInfo > *mvList;
+
+
+//
+- (NSString *)storageFullPath;
+- (NSString *)storageDirectory;
++ (NSString *)storageDirectoryWithEffectType:(AliyunEffectType)type;
+
+
++ (NSString *)effectNameByPath:(NSString *)path;
++ (id)effectIdByPath:(NSString *)path;
+
+@end

+ 90 - 0
RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoFile/Common/ResourceManager/Models/AliyunEffectResourceModel.m

@@ -0,0 +1,90 @@
+//
+//  AliyunEffectResourceModel.m
+//  AliyunVideo
+//
+//  Created by TripleL on 17/3/6.
+//  Copyright (C) 2010-2017 Alibaba Group Holding Limited. All rights reserved.
+//
+
+#import "AliyunEffectResourceModel.h"
+#import "AliyunPathManager.h"
+
+@implementation AliyunEffectResourceModel
+
++ (BOOL)propertyIsOptional:(NSString *)propertyName {
+    
+    return YES;
+}
+
++ (JSONKeyMapper *)keyMapper {
+    
+    return [[JSONKeyMapper alloc] initWithModelToJSONDictionary:@{@"eid":@"id",
+                                                                  @"edescription":@"description",
+                                                                  @"mvList":@"aspectList"}];
+}
+
+
+- (NSString *)storageFullPath {
+    NSString *fullPath = [NSHomeDirectory() stringByAppendingPathComponent:[self storageDirectory]];
+    if (![[NSFileManager defaultManager] fileExistsAtPath:fullPath]) {
+        [[NSFileManager defaultManager] createDirectoryAtPath:fullPath withIntermediateDirectories:YES attributes:nil error:nil];
+    }
+    return fullPath;
+}
+
+-(NSString *)storageDirectory {
+    
+    return [[self class] storageDirectoryWithEffectType:self.effectType];
+}
+
++ (NSString *)storageDirectoryWithEffectType:(AliyunEffectType)type {
+    
+    NSString *path = @"pasterRes";
+    switch (type) {
+        case AliyunEffectTypeMV:
+            path = @"mvRes";
+            break;
+        case AliyunEffectTypeFilter:
+            path = @"filterRes";
+            break;
+        case AliyunEffectTypeMusic:
+            path = @"musicRes";
+            break;
+        case AliyunEffectTypeFont:
+            path = @"fontRes";
+            break;
+        case AliyunEffectTypePaster:
+            path = @"pasterRes";
+            break;
+        case AliyunEffectTypeCaption:
+            path = @"subtitleRes";
+            break;
+        default:
+            break;
+    }
+    return [[AliyunPathManager resourceRelativeDir] stringByAppendingPathComponent:path];
+}
+
++ (NSString *)effectNameByPath:(NSString *)path
+{
+    NSRange range = [path rangeOfString:@"-"];
+    if (range.length <= 0) {
+        return nil;
+    }
+    
+    NSString *effectName = [path substringFromIndex:NSMaxRange(range)];
+    return effectName;
+}
+
++ (id)effectIdByPath:(NSString *)path
+{
+    NSArray *components = [path componentsSeparatedByString:@"-"];
+    if (components.count <= 1) {
+        NSError *err = [[NSError alloc] initWithDomain:@"Resource Err" code:-9090 userInfo:nil];
+        return err;
+    }
+    return [components firstObject];
+}
+
+
+@end

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

@@ -0,0 +1,27 @@
+//
+//  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

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

@@ -0,0 +1,83 @@
+//
+//  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

+ 59 - 0
RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoFile/Common/ResourceManager/Views/AliyunEffectFilterCell.h

@@ -0,0 +1,59 @@
+//
+//  AliyunEffectFilterCell.h
+//  AliyunVideo
+//
+//  Created by dangshuai on 17/3/13.
+//  Copyright (C) 2010-2017 Alibaba Group Holding Limited. All rights reserved.
+//  滤镜、特效、MV模块用到的cell
+
+#import <UIKit/UIKit.h>
+#import "AliyunEffectInfo.h"
+@interface AliyunEffectFilterCell : UICollectionViewCell
+
+/**
+ 下载的view
+ */
+@property (weak, nonatomic) IBOutlet UIImageView *downloadImageView;
+
+/**
+ 名称Label
+ */
+@property (weak, nonatomic) IBOutlet UILabel *nameLabel;
+
+/**
+ 图片显示的view
+ */
+@property (weak, nonatomic) IBOutlet UIImageView *imageView;
+
+/**
+ 被选中的按钮
+ */
+@property (weak, nonatomic) IBOutlet UIButton *selectedButton;
+
+/**
+ 是否是音效
+ */
+@property (assign, nonatomic) BOOL isAudioEffect;
+
+/**
+ 给cell数据
+
+ @param effectInfo 数据模型
+ */
+- (void)cellModel:(AliyunEffectInfo *)effectInfo;
+
+/**
+ 是否应该显示下载的view
+
+ @param flag 是否显示
+ */
+- (void)shouldDownload:(BOOL)flag;
+
+/**
+ 刷新进度的方法
+
+ @param progress 进度(0-1)
+ */
+- (void)downloadProgress:(CGFloat)progress;
+
+@end

+ 134 - 0
RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoFile/Common/ResourceManager/Views/AliyunEffectFilterCell.m

@@ -0,0 +1,134 @@
+//
+//  AliyunEffectFilterCell.m
+//  AliyunVideo
+//
+//  Created by dangshuai on 17/3/13.
+//  Copyright (C) 2010-2017 Alibaba Group Holding Limited. All rights reserved.
+//
+
+#import "AliyunEffectFilterCell.h"
+#import "AVC_ShortVideo_Config.h"
+#import "UIView+Progress.h"
+#import "AliyunEffectResourceModel.h"
+#import "AlivcImage.h"
+#import "AlivcMacro.h"
+
+@interface AliyunEffectFilterCell ()
+
+/**
+ MV中的中间黑洞
+ */
+@property (weak, nonatomic) IBOutlet UIImageView *mvCenterImageView;
+
+/**
+ 数据ID
+ */
+@property (nonatomic, assign) NSInteger eid;
+
+/**
+ 下载进度view
+ */
+@property (nonatomic, strong) UIView *pieView;
+
+/**
+ 数据类型
+ */
+@property (assign, nonatomic) NSInteger type;
+
+@end
+
+@implementation AliyunEffectFilterCell
+
+- (void)awakeFromNib {
+    [super awakeFromNib];
+    _imageView.layer.cornerRadius = 25;
+    _imageView.layer.masksToBounds = YES;
+    _imageView.layer.borderColor = AlivcOxRGB(0x00c1de).CGColor;
+    
+
+    self.downloadImageView.backgroundColor = [UIColor clearColor];
+    self.downloadImageView.image = [AlivcImage imageNamed:@"shortVideo_download"];
+    [self addSubview:self.downloadImageView];
+    self.downloadImageView.hidden = YES;
+    
+    _pieView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 50, 50)];
+    [self addSubview:_pieView];
+    _pieView.backgroundColor = [UIColor clearColor];
+    [_pieView pieProgressView].progressColor = [UIColor colorWithRed:27.0/255 green:33.0/255 blue:51.0/255 alpha:0.8] ;
+    _pieView.hidden = YES;
+    
+}
+
+- (void)shouldDownload:(BOOL)flag
+{
+    self.downloadImageView.hidden = flag;
+    if (flag == YES) {
+        self.pieView.hidden = YES;
+    }
+}
+
+- (void)cellModel:(AliyunEffectInfo *)effectInfo {
+    self.type = effectInfo.effectType;
+    _nameLabel.text = effectInfo.name;
+    _eid = effectInfo.eid;
+    if (self.isAudioEffect) {
+        _mvCenterImageView.hidden = YES;
+        _imageView.image = [AlivcImage imageNamed:effectInfo.icon];
+    }else if (effectInfo.effectType == AliyunEffectTypeFilter || effectInfo.effectType == AliyunEffectTypeSpecialFilter) {
+        _mvCenterImageView.hidden = YES;
+        _imageView.image = [UIImage imageWithContentsOfFile:[effectInfo localFilterIconPath]];
+        if ((effectInfo.effectType == AliyunEffectTypeSpecialFilter)&&(effectInfo.eid == -1)) {
+            _imageView.image = [AlivcImage imageNamed:effectInfo.icon];
+        }
+    } else if (effectInfo.effectType == AliyunEffectTypeMV) {
+        if (effectInfo.eid == -1) {
+            _mvCenterImageView.hidden = YES;
+            _imageView.image = [AlivcImage imageNamed:effectInfo.icon];
+        } else {
+            _mvCenterImageView.hidden = NO;
+            _mvCenterImageView.image  = [AlivcImage imageNamed:@"shortVideo_edit_center"];
+            NSURL *url = [NSURL URLWithString:[effectInfo.icon stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]];
+            
+            if([effectInfo.icon isEqualToString:@"shortVideo_mv_default"]){
+                _imageView.image = [AlivcImage imageNamed:@"shortVideo_mv_default"];
+            }else{
+                NSLog(@"----设置mv图片");
+            }
+            
+            
+        }
+    }
+}
+
+- (void)layoutSubviews{
+    [super layoutSubviews];
+    self.downloadImageView.frame = CGRectMake(CGRectGetWidth(self.frame) - 16, CGRectGetWidth(self.frame) - 16, 16, 16);
+    _pieView.frame = CGRectMake(0, 0, 50, 50);
+    _pieView.layer.masksToBounds = YES;
+    _pieView.layer.cornerRadius = 50 / 2.0;
+}
+
+/**
+ 重写selected的set方法
+
+ @param selected 是否选中
+ */
+- (void)setSelected:(BOOL)selected {
+    [super setSelected:selected];
+    if (self.type == AliyunEffectTypeSpecialFilter && !self.isAudioEffect) {
+        return;
+    }
+    self.selectedButton.hidden = !selected;
+
+}
+
+- (void)downloadProgress:(CGFloat)progress
+{
+    _pieView.hidden = NO;
+    [_pieView setPieProgress:progress];
+    if (progress == 1) {
+        _pieView.hidden = YES;
+    }
+}
+
+@end

+ 92 - 0
RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoFile/Common/ResourceManager/Views/AliyunEffectFilterCell.xib

@@ -0,0 +1,92 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="14113" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
+    <device id="retina4_7" orientation="portrait">
+        <adaptation id="fullscreen"/>
+    </device>
+    <dependencies>
+        <deployment identifier="iOS"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14088"/>
+        <capability name="Aspect ratio constraints" minToolsVersion="5.1"/>
+        <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
+    </dependencies>
+    <objects>
+        <placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
+        <placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
+        <collectionViewCell opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" id="gTV-IL-0wX" customClass="AliyunEffectFilterCell">
+            <rect key="frame" x="0.0" y="0.0" width="98" height="116"/>
+            <autoresizingMask key="autoresizingMask"/>
+            <view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center">
+                <rect key="frame" x="0.0" y="0.0" width="98" height="116"/>
+                <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
+                <subviews>
+                    <imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="uJ7-8S-mmE">
+                        <rect key="frame" x="0.0" y="0.0" width="98" height="98"/>
+                        <constraints>
+                            <constraint firstAttribute="width" secondItem="uJ7-8S-mmE" secondAttribute="height" multiplier="1:1" id="Q7K-mv-XSj"/>
+                            <constraint firstAttribute="width" constant="98" id="yp9-UA-RuW"/>
+                        </constraints>
+                    </imageView>
+                    <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="BL2-7v-gYm">
+                        <rect key="frame" x="0.0" y="103" width="98" height="14.5"/>
+                        <fontDescription key="fontDescription" type="system" pointSize="12"/>
+                        <color key="textColor" red="0.76470588235294112" green="0.77254901960784317" blue="0.77647058823529413" alpha="1" colorSpace="calibratedRGB"/>
+                        <nil key="highlightedColor"/>
+                    </label>
+                    <imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="QTe-6e-hxx">
+                        <rect key="frame" x="40" y="40" width="18" height="18"/>
+                        <constraints>
+                            <constraint firstAttribute="height" constant="18" id="JId-8z-3y9"/>
+                            <constraint firstAttribute="width" constant="18" id="c92-9d-GHw"/>
+                        </constraints>
+                    </imageView>
+                    <imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="C2e-MY-zbj">
+                        <rect key="frame" x="82" y="82" width="16" height="16"/>
+                        <constraints>
+                            <constraint firstAttribute="height" constant="16" id="PHo-oD-ktg"/>
+                            <constraint firstAttribute="width" constant="16" id="g9J-X0-Zhi"/>
+                        </constraints>
+                    </imageView>
+                    <button hidden="YES" opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Hc3-Ms-Bhd">
+                        <rect key="frame" x="0.0" y="0.0" width="98" height="98"/>
+                        <color key="backgroundColor" red="0.0" green="0.75686274509803919" blue="0.87058823529411766" alpha="1" colorSpace="calibratedRGB"/>
+                        <state key="normal" image="AlivcShortVideoImage.bundle/shortVideo_edit_affirm"/>
+                        <userDefinedRuntimeAttributes>
+                            <userDefinedRuntimeAttribute type="number" keyPath="layer.cornerRadius">
+                                <integer key="value" value="25"/>
+                            </userDefinedRuntimeAttribute>
+                            <userDefinedRuntimeAttribute type="boolean" keyPath="layer.maskToBounds" value="YES"/>
+                        </userDefinedRuntimeAttributes>
+                    </button>
+                </subviews>
+            </view>
+            <constraints>
+                <constraint firstAttribute="trailing" secondItem="uJ7-8S-mmE" secondAttribute="trailing" id="3T1-Xp-ggT"/>
+                <constraint firstAttribute="trailing" secondItem="Hc3-Ms-Bhd" secondAttribute="trailing" id="52T-9U-1kN"/>
+                <constraint firstItem="QTe-6e-hxx" firstAttribute="centerX" secondItem="uJ7-8S-mmE" secondAttribute="centerX" id="AU0-hp-Xju"/>
+                <constraint firstItem="QTe-6e-hxx" firstAttribute="centerY" secondItem="uJ7-8S-mmE" secondAttribute="centerY" id="DUD-Pp-Eee"/>
+                <constraint firstItem="BL2-7v-gYm" firstAttribute="leading" secondItem="gTV-IL-0wX" secondAttribute="leading" id="G2F-WW-MAm"/>
+                <constraint firstAttribute="trailing" secondItem="C2e-MY-zbj" secondAttribute="trailing" id="IpZ-fx-7ag"/>
+                <constraint firstItem="Hc3-Ms-Bhd" firstAttribute="top" secondItem="gTV-IL-0wX" secondAttribute="top" id="K8I-pE-ofy"/>
+                <constraint firstItem="BL2-7v-gYm" firstAttribute="top" secondItem="C2e-MY-zbj" secondAttribute="bottom" constant="5" id="RRw-Xz-oHO"/>
+                <constraint firstItem="BL2-7v-gYm" firstAttribute="top" secondItem="Hc3-Ms-Bhd" secondAttribute="bottom" constant="5" id="XlX-eG-5jl"/>
+                <constraint firstItem="BL2-7v-gYm" firstAttribute="top" secondItem="uJ7-8S-mmE" secondAttribute="bottom" constant="5" id="lHV-cz-n2o"/>
+                <constraint firstItem="uJ7-8S-mmE" firstAttribute="top" secondItem="gTV-IL-0wX" secondAttribute="top" id="mC4-H4-Aar"/>
+                <constraint firstAttribute="trailing" secondItem="BL2-7v-gYm" secondAttribute="trailing" id="sKt-Ka-bRN"/>
+                <constraint firstItem="uJ7-8S-mmE" firstAttribute="leading" secondItem="gTV-IL-0wX" secondAttribute="leading" id="sWu-IT-x6U"/>
+                <constraint firstItem="Hc3-Ms-Bhd" firstAttribute="leading" secondItem="gTV-IL-0wX" secondAttribute="leading" id="y9z-fa-Eyc"/>
+            </constraints>
+            <size key="customSize" width="98" height="119"/>
+            <connections>
+                <outlet property="downloadImageView" destination="C2e-MY-zbj" id="dSS-uE-j6J"/>
+                <outlet property="imageView" destination="uJ7-8S-mmE" id="4as-zD-5Sv"/>
+                <outlet property="mvCenterImageView" destination="QTe-6e-hxx" id="POO-wq-CnM"/>
+                <outlet property="nameLabel" destination="BL2-7v-gYm" id="Qdl-0n-m6G"/>
+                <outlet property="selectedButton" destination="Hc3-Ms-Bhd" id="B4R-s1-jeJ"/>
+            </connections>
+            <point key="canvasLocation" x="-100" y="110"/>
+        </collectionViewCell>
+    </objects>
+    <resources>
+        <image name="AlivcShortVideoImage.bundle/shortVideo_edit_affirm" width="16" height="16"/>
+    </resources>
+</document>

+ 85 - 0
RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoFile/Common/UIConfig/AlivcEditUIConfig.h

@@ -0,0 +1,85 @@
+//
+//  AlivcEditVCUIConfig.h
+//  AliyunVideoClient_Entrance
+//
+//  Created by Zejian Cai on 2018/10/9.
+//  Copyright © 2018年 Alibaba. All rights reserved.
+//  编辑界面的UI配置
+
+#import "AlivcShortVideoUIConfig.h"
+
+@interface AlivcEditUIConfig : AlivcShortVideoUIConfig
+
+/**
+ 滤镜item对应的图片
+ */
+@property (strong, nonatomic) UIImage *filterImage;
+
+/**
+ 音乐
+ */
+@property (strong, nonatomic) UIImage *musicImage;
+
+/**
+ 动图
+ */
+@property (strong, nonatomic) UIImage *pasterImage;
+
+/**
+ 字幕
+ */
+@property (strong, nonatomic) UIImage *captionImage;
+
+/**
+ MV
+ */
+@property (strong, nonatomic) UIImage *mvImage;
+
+/**
+ 音效
+ */
+@property (strong, nonatomic) UIImage *soundImage;
+
+/**
+ 特效
+ */
+@property (strong, nonatomic) UIImage *effectImage;
+
+/**
+ 时间特效
+ */
+@property (strong, nonatomic) UIImage *timeImage;
+
+/**
+ 转场
+ */
+@property (strong, nonatomic) UIImage *translationImage;
+
+/**
+ 封面选择
+ */
+@property (strong, nonatomic) UIImage *coverImage;
+
+/**
+ 涂鸦
+ */
+@property (strong, nonatomic) UIImage *paintImage;
+
+
+/**
+ 播放对应图片
+ */
+@property (strong, nonatomic) UIImage *playImage;
+
+/**
+ 暂停对应图片
+ */
+@property (strong, nonatomic) UIImage *pauseImage;
+
+/**
+ 编辑完成对应图片
+ */
+@property (strong, nonatomic) UIImage *finishImage;
+
+
+@end

+ 45 - 0
RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoFile/Common/UIConfig/AlivcEditUIConfig.m

@@ -0,0 +1,45 @@
+//
+//  AlivcEditVCUIConfig.m
+//  AliyunVideoClient_Entrance
+//
+//  Created by Zejian Cai on 2018/10/9.
+//  Copyright © 2018年 Alibaba. All rights reserved.
+//
+
+#import "AlivcEditUIConfig.h"
+#import "AlivcImage.h"
+
+
+@implementation AlivcEditUIConfig
+- (instancetype)init{
+    self = [super init];
+    if(self){
+        [self setDefaultValue];
+    }
+    return self;
+}
+
+- (void)setDefaultValue{
+    
+    self.backgroundColor = [UIColor blackColor];
+    self.backImage = [UIImage imageNamed:@"avcBackIcon"];
+
+    _filterImage = [AlivcImage imageNamed:@"alivc_svEdit_filter"];
+    
+    _musicImage = [AlivcImage imageNamed:@"alivc_svEdit_music"];
+    _pasterImage = [AlivcImage imageNamed:@"alivc_svEdit_paster"];
+    _captionImage = [AlivcImage imageNamed:@"alivc_svEdit_subtitle"];
+    _mvImage = [AlivcImage imageNamed:@"alivc_svEdit_mv"];
+    _soundImage =[AlivcImage imageNamed:@"alivc_svEdit_audio"];
+    _effectImage = [AlivcImage imageNamed:@"alivc_svEdit_effect"];
+    _timeImage = [AlivcImage imageNamed:@"alivc_svEdit_time"];
+    _translationImage = [AlivcImage imageNamed:@"alivc_svEdit_translation"];
+    _paintImage = [AlivcImage imageNamed:@"alivc_svEdit_paint"];
+    _coverImage = [AlivcImage imageNamed:@"alivc_svEdit_cover"];
+    
+    _playImage = [AlivcImage imageNamed:@"alivc_shortVideo_play"];
+    _pauseImage = [AlivcImage imageNamed:@"alivc_svEdit_pause"];
+    _finishImage = [AlivcImage imageNamed:@"shortVideo_finishButtonNormal"];
+    
+}
+@end

+ 58 - 0
RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoFile/Common/UIConfig/AlivcRecordUIConfig.h

@@ -0,0 +1,58 @@
+//
+//  AlivcShootVCUIConfig.h
+//  AliyunVideoClient_Entrance
+//
+//  Created by Zejian Cai on 2018/10/9.
+//  Copyright © 2018年 Alibaba. All rights reserved.
+//  短视频拍摄界面的UI配置
+
+#import "AlivcShortVideoUIConfig.h"
+
+@interface AlivcRecordUIConfig : AlivcShortVideoUIConfig
+
+/**
+ 音乐按钮图片
+ */
+@property (strong, nonatomic) UIImage *musicImage;
+
+/**
+ 滤镜按钮图片
+ */
+@property (strong, nonatomic) UIImage *filterImage;
+
+/**
+ 切换摄像头的图片
+ */
+@property (strong, nonatomic) UIImage *switchCameraImage;
+
+/**
+ 完成的按钮图片 - 不可用
+ */
+@property (strong, nonatomic) UIImage *finishImageUnable;
+
+/**
+ 完成的按钮图片 - 可用
+ */
+@property (strong, nonatomic) UIImage *finishImageEnable;
+
+/**
+ 拍摄按钮图片 - 未开始拍摄
+ */
+@property (strong, nonatomic) UIImage *videoShootImageNormal;
+
+/**
+ 拍摄按钮图片 - 拍摄中
+ */
+@property (strong, nonatomic) UIImage *videoShootImageShooting;
+
+/**
+ 回删对应的图片
+ */
+@property (strong, nonatomic) UIImage *deleteImage;
+
+/**
+ 拍摄中红点对应的图片
+ */
+@property (strong, nonatomic) UIImage *dotImage;
+
+@end

+ 0 - 0
RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoFile/Common/UIConfig/AlivcRecordUIConfig.m


Alguns arquivos não foram mostrados porque muitos arquivos mudaram nesse diff