Преглед изворни кода

音乐合成 && 流程完善

Chris пре 5 година
родитељ
комит
711823bee6

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

@@ -561,6 +561,8 @@
 		BD477F6322C23D66008BE2CB /* AliyunReachability.m in Sources */ = {isa = PBXBuildFile; fileRef = BD477F6222C23D66008BE2CB /* AliyunReachability.m */; };
 		BD4B50AC22BC7DEA0073B516 /* FilterResource.bundle in Resources */ = {isa = PBXBuildFile; fileRef = BD4B50AB22BC7DEA0073B516 /* FilterResource.bundle */; };
 		BD4B50AE22BC815F0073B516 /* PublishFilterCollectionCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = BD4B50AD22BC815F0073B516 /* PublishFilterCollectionCell.swift */; };
+		BD50F47022E157F50077D4BF /* PublishRecordMusicView.swift in Sources */ = {isa = PBXBuildFile; fileRef = BD50F46F22E157F50077D4BF /* PublishRecordMusicView.swift */; };
+		BD50F47222E158FB0077D4BF /* PublishAgreementController.swift in Sources */ = {isa = PBXBuildFile; fileRef = BD50F47122E158FB0077D4BF /* PublishAgreementController.swift */; };
 		BD5CA89222DD73A500364A67 /* PublishMusicVolumnView.swift in Sources */ = {isa = PBXBuildFile; fileRef = BD5CA89122DD73A500364A67 /* PublishMusicVolumnView.swift */; };
 		BD5CA89522DDA2A100364A67 /* CustomSlider.swift in Sources */ = {isa = PBXBuildFile; fileRef = BD5CA89422DDA2A100364A67 /* CustomSlider.swift */; };
 		BD61225422C355C800D3F513 /* AliyunMagicCameraViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = BD61225322C355C800D3F513 /* AliyunMagicCameraViewController.m */; };
@@ -1294,6 +1296,8 @@
 		BD477F6222C23D66008BE2CB /* AliyunReachability.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AliyunReachability.m; sourceTree = "<group>"; };
 		BD4B50AB22BC7DEA0073B516 /* FilterResource.bundle */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.plug-in"; path = FilterResource.bundle; sourceTree = "<group>"; };
 		BD4B50AD22BC815F0073B516 /* PublishFilterCollectionCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PublishFilterCollectionCell.swift; sourceTree = "<group>"; };
+		BD50F46F22E157F50077D4BF /* PublishRecordMusicView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PublishRecordMusicView.swift; sourceTree = "<group>"; };
+		BD50F47122E158FB0077D4BF /* PublishAgreementController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PublishAgreementController.swift; sourceTree = "<group>"; };
 		BD5CA89122DD73A500364A67 /* PublishMusicVolumnView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PublishMusicVolumnView.swift; sourceTree = "<group>"; };
 		BD5CA89422DDA2A100364A67 /* CustomSlider.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CustomSlider.swift; sourceTree = "<group>"; };
 		BD61225222C355C800D3F513 /* AliyunMagicCameraViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AliyunMagicCameraViewController.h; sourceTree = "<group>"; };
@@ -5097,10 +5101,12 @@
 			isa = PBXGroup;
 			children = (
 				BDBC0AF122DDD7E800CA788E /* PublishMusicChooseView.swift */,
+				BD50F46F22E157F50077D4BF /* PublishRecordMusicView.swift */,
 				BDD9377622DF3B47002D11B3 /* PublishMusicListController.swift */,
 				BDD9377422DEF371002D11B3 /* PublishMusicListCell.swift */,
 				BD5CA89122DD73A500364A67 /* PublishMusicVolumnView.swift */,
 				BDBC0AF522DDEA4E00CA788E /* PublishRecommendMusicController.swift */,
+				BD50F47122E158FB0077D4BF /* PublishAgreementController.swift */,
 			);
 			path = PublishMusicAbout;
 			sourceTree = "<group>";
@@ -6339,6 +6345,7 @@
 				BD12203622AF807C0051C7C2 /* MessagePlanetActivityController.swift in Sources */,
 				BD13B6C222BA034D008BB323 /* PublishEditAddImgCollectionCell.swift in Sources */,
 				A7778CAB2244B12500C7C47A /* CountDownManager.swift in Sources */,
+				BD50F47222E158FB0077D4BF /* PublishAgreementController.swift in Sources */,
 				A775CBFE2237493600EBDCF8 /* ShoppingMallNavigationBarView.swift in Sources */,
 				A71AA5212272E527008FF1A5 /* Extension+UINavigationController.swift in Sources */,
 				BD981A8F22C9FEEF0043D951 /* CommunityPublishModel.swift in Sources */,
@@ -6520,6 +6527,7 @@
 				BD6EDF48229007EA009A20FE /* OrderApplyRefundModel.swift in Sources */,
 				A770E5EB22D424A300CBD0A4 /* CommunityPostCommentIdModel.swift in Sources */,
 				A72A7388223396CB00B21995 /* ApiMacro.swift in Sources */,
+				BD50F47022E157F50077D4BF /* PublishRecordMusicView.swift in Sources */,
 				A72A72B922321DE000B21995 /* Extension+Array.swift in Sources */,
 				A70B2C492288416F00B2449F /* ProductDetailHotSellCollectionViewCell.swift in Sources */,
 				A71901692275464000104A50 /* ProvinceCityAreaView.swift in Sources */,

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

@@ -81,16 +81,6 @@ AliyunIExporterCallback, AliyunIPlayerCallback, AliyunMusicPickViewControllerDel
 @property (nonatomic, strong) UIView *rateViewWithDim;
 
 
-/**
- 保存的时间特效
- */
-@property(nonatomic, strong) AliyunEffectTimeFilter *storeTimeFilter;
-
-/**
- 当前的时间特效
- */
-@property(nonatomic, strong) AliyunEffectTimeFilter *currentTimeFilter;
-
 @property(nonatomic, strong) AliyunDBHelper *dbHelper;
 
 @property(nonatomic, assign) BOOL isExporting;
@@ -118,6 +108,9 @@ AliyunIExporterCallback, AliyunIPlayerCallback, AliyunMusicPickViewControllerDel
 // 配乐のView
 @property (nonatomic, strong) PublishMusicChooseView *musicView;
 
+@property (nonatomic, assign) CGFloat originAudioVolumn;
+@property (nonatomic, assign) CGFloat backAudioVolumn;
+
 /**
  当前控制器是否可见
  */
@@ -610,7 +603,7 @@ AliyunIExporterCallback, AliyunIPlayerCallback, AliyunMusicPickViewControllerDel
     [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(applicationWillResignActive) name:UIApplicationWillResignActiveNotification object:nil];
     [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(resourceDeleteNoti:) name:AliyunEffectResourceDeleteNotification object:nil];
     [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(downloadMusicAndCombineNoti:) name:@"DownloadMusicAndCombineNoti" object:nil];
-    
+    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(changeAudioVolumn:) name:@"ChangeAudioVolumnNoti" object:nil];
 }
 
 - (void)removeNotifications {
@@ -624,6 +617,15 @@ AliyunIExporterCallback, AliyunIPlayerCallback, AliyunMusicPickViewControllerDel
     [self downloadFileFromServerWithUrlStr:urlStr];
 }
 
+- (void)changeAudioVolumn:(NSNotification *)noti {
+    NSDictionary *paraDic = noti.object;
+    self.originAudioVolumn = [paraDic[@"origin"] floatValue];
+    self.backAudioVolumn   = [paraDic[@"back"] floatValue];
+
+    [self.editor setMainStreamsAudioWeight:_originAudioVolumn];
+    [self.editor setAudioMixWeight:_backAudioVolumn];
+}
+
 
 //资源删除通知
 - (void)resourceDeleteNoti:(NSNotification *)noti {
@@ -704,7 +706,7 @@ AliyunIExporterCallback, AliyunIPlayerCallback, AliyunMusicPickViewControllerDel
         NSLog(@"\n------下载音乐成功!path == %@", musicFilePath);
         
         
-        
+        // FIXME: to be fixed
         AVURLAsset *asset = [AVURLAsset assetWithURL:[NSURL fileURLWithPath:musicFilePath]];
         CGFloat musicDuration = [asset avAssetVideoTrackDuration];
         
@@ -1207,8 +1209,6 @@ AliyunIExporterCallback, AliyunIPlayerCallback, AliyunMusicPickViewControllerDel
 
 //音乐
 - (void)musicButtonClicked {
-    //    [self enterEditWithActionType:AliyunEditSouceClickTypeMusic];
-    //    [self pause];
     
 //    AliyunMusicPickViewController *vc =
 //    [[AliyunMusicPickViewController alloc] init];
@@ -1218,7 +1218,7 @@ AliyunIExporterCallback, AliyunIPlayerCallback, AliyunMusicPickViewControllerDel
 //    vc.delegate = self;
 //    [self.navigationController pushViewController:vc animated:YES];
     
-//    self.volumnView = [PublishMusicVolumnView publishMusicVolumnView];
+    [self pause];
     self.musicView = [PublishMusicChooseView publishMusicChooseViewWithAttachedView:self.view];
     
 }
@@ -1301,12 +1301,10 @@ AliyunIExporterCallback, AliyunIPlayerCallback, AliyunMusicPickViewControllerDel
     timeFilter.type = TimeFilterTypeSpeed;
     timeFilter.param = rate;
     [self.editor applyTimeFilter:timeFilter];
-    self.currentTimeFilter = timeFilter;
     [self resume];
 }
 
 - (void)didSelectNone {
-    self.currentTimeFilter = nil;
     [_editor removeTimeFilter];
     [self resume];
 }

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

@@ -162,7 +162,7 @@
 @property(nonatomic, strong) AliyunEffectFilterView *filterView;
 
 // 配乐のView
-@property (nonatomic, strong) PublishMusicChooseView *musicView;
+@property (nonatomic, strong) PublishRecordMusicView *musicView;
 
 @end
 
@@ -433,8 +433,8 @@
     [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(appWillResignActive:) name:UIApplicationWillResignActiveNotification object:nil];
     [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(appDidBecomeActive:) name:UIApplicationDidBecomeActiveNotification object:nil];
     [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(resourceDelete:) name:AliyunEffectResourceDeleteNotification object:nil];
-    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(musicViewDidClose) name:@"CloseMusicChooseViewNoti" object:nil];
-    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(downloadMusicAndCombineNoti:) name:@"DownloadMusicAndCombineNoti" object:nil];
+    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(musicViewDidClose) name:@"RecordCloseMusicChooseViewNoti" object:nil];
+    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(downloadMusicAndCombineNoti:) name:@"RecordDownloadMusicAndCombineNoti" object:nil];
 }
 
 - (void)downloadMusicAndCombineNoti:(NSNotification *)noti {
@@ -830,7 +830,7 @@
 //    self.needStopPreview =NO;
 //    [self.navigationController pushViewController:vc animated:YES];
     
-    self.musicView = [PublishMusicChooseView publishMusicChooseViewWithAttachedView:self.view];    
+    self.musicView = [PublishRecordMusicView publishRecordMusicViewWithAttachedView:self.view];
     if (self.hideSegmentBlock) {
         self.hideSegmentBlock(true);
         self.magicCameraView.rateView.hidden = true;

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

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

+ 1 - 1
RainbowPlanet/RainbowPlanet/Modules/PublishModule/PublishMusicAbout/PublishMusicChooseView.swift

@@ -4,7 +4,7 @@
 //
 //  Created by Christopher on 2019/7/16.
 //  Copyright © 2019 RainbowPlanet. All rights reserved.
-//  选择音乐のView
+//  编辑视频--选择音乐のView
 
 import UIKit
 import FWPopupView

+ 1 - 1
RainbowPlanet/RainbowPlanet/Modules/PublishModule/PublishMusicAbout/PublishMusicListCell.swift

@@ -127,7 +127,7 @@ class PublishMusicListCell: UITableViewCell {
         useButton.titleLabel?.font = kRegularFont13
         useButton.setBackgroundImage(UIImage.imageWithColor(color: k62CC74Color), for: UIControl.State.normal)
         useButton.setTitleColor(kEnabledTitleColor, for: UIControl.State.normal)
-        useButton.layer.cornerRadius = kScaleValue(value: 13)
+        useButton.layer.cornerRadius = 13
         useButton.layer.masksToBounds = true
         useButton.rx.tap.subscribe(onNext: { [weak self] in
             if let useClickClosure = self?.useClickClosure {

+ 9 - 7
RainbowPlanet/RainbowPlanet/Modules/PublishModule/PublishMusicAbout/PublishMusicVolumnView.swift

@@ -193,17 +193,15 @@ class PublishMusicVolumnView: FWPopupView {
     @objc func originValueChanged(_ sender: Any?) {
         let slider = sender as? UISlider
         
-        let sliderRate = CGFloat((slider?.value ?? 0.0) / (slider?.maximumValue ?? 0.0))
-        print("\n-------- originSliderRate = \(sliderRate)")
-        
+        let sliderRate = (slider?.value ?? 0.0) / (slider?.maximumValue ?? 0.0)
+        self.originVolumn = sliderRate
     }
     
     @objc func backValueChanged(_ sender: Any?) {
         let slider = sender as? UISlider
         
-        let sliderRate = CGFloat((slider?.value ?? 0.0) / (slider?.maximumValue ?? 0.0))
-        
-        print("\n-------- backSliderRate = \(sliderRate)")
+        let sliderRate = (slider?.value ?? 0.0) / (slider?.maximumValue ?? 0.0)
+        self.backVolumn = sliderRate
     }
     
     /// 初始化View
@@ -225,7 +223,11 @@ class PublishMusicVolumnView: FWPopupView {
         }).disposed(by: view.disposeBag)
         
         view.applyButton.rx.tap.subscribe(onNext: {(data) in
-            print("----点击了-应用")
+            var paraDic = Dictionary<String, Any>()
+            paraDic.updateValue(view.originVolumn*100, forKey: "origin")
+            paraDic.updateValue(view.backVolumn*100, forKey: "back")
+            NotificationCenter.default.post(name: NSNotification.Name(rawValue: "ChangeAudioVolumnNoti"), object: paraDic)
+            
             view.hide()
         }).disposed(by: view.disposeBag)
         

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

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

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

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