短視頻網站源碼乾貨分享:如何實現背景音樂和美顏功能

作爲互聯網行業的後起之秀,短視頻衝破“包圍圈”深受大衆喜愛。隨着網民娛樂需求的不斷提高,對於視頻錄製的形式也提出了更高要求。短視頻網站源碼身爲短視頻功能構成的基石,展現出了十分重要的作用。
以下提供短視頻中實現背景音樂功能相關的源代碼供大家參考:

#pragma mark - top10
-(void)pullTopTenMusic {
    
    NSString *url = [purl stringByAppendingFormat:@"?service=Music.hotLists&uid=%@",[Config getOwnID]];
    WeakSelf;
    [YBNetworking postWithUrl:url Dic:nil Suc:^(NSDictionary *data, NSString *code, NSString *msg) {
        [_tableView.mj_header endRefreshing];
        [_tableView.mj_footer endRefreshing];
        if ([code isEqual:@"0"]) {
            NSArray *infoA = [data valueForKey:@"info"];
            if (_paging == 1) {
                [self.allArray removeAllObjects];
            }
            if (infoA.count<=0) {
                [_tableView.mj_footer endRefreshingWithNoMoreData];
            }else {
                [self.allArray addObjectsFromArray:infoA];
            }
            if (self.allArray.count==0) {
                [PublicView showTextNoData:weakSelf.tableView text1:@"對不起~" text2:@"沒有搜索到相關內容"];
            }else{
                [PublicView hiddenTextNoData:weakSelf.tableView];
            }
            [self.tableView reloadData];
        }else{
            [PublicView showTextNoData:weakSelf.tableView text1:@"對不起~" text2:@"沒有搜索到相關內容"];
            [YBMsgPop showPop:msg];
        }
    } Fail:^(id fail) {
        [_tableView.mj_header endRefreshing];
        [_tableView.mj_footer endRefreshing];
    }];
    
}
#pragma mark 收藏
-(void)pullCollectMusic {
    
    NSString *url = [purl stringByAppendingFormat:@"?service=Music.getCollectMusicLists&uid=%@&p=%d",[Config getOwnID],_paging];
    WeakSelf;
    [YBNetworking postWithUrl:url Dic:nil Suc:^(NSDictionary *data, NSString *code, NSString *msg) {
        [_tableView.mj_header endRefreshing];
        [_tableView.mj_footer endRefreshing];
        if ([code isEqual:@"0"]) {
            NSArray *infoA = [data valueForKey:@"info"];
            if (_paging == 1) {
                [self.allArray removeAllObjects];
            }
            if (infoA.count<=0) {
                [_tableView.mj_footer endRefreshingWithNoMoreData];
            }else {
                [self.allArray addObjectsFromArray:infoA];
            }
            
            if (self.allArray.count==0) {
                [PublicView showTextNoData:weakSelf.tableView text1:@"" text2:@"沒有收藏音樂"];
            }else{
                [PublicView hiddenTextNoData:weakSelf.tableView];
            }
            [self.tableView reloadData];
        }else{
            [PublicView showTextNoData:weakSelf.tableView text1:@"" text2:@"沒有收藏音樂"];
            [YBMsgPop showPop:msg];
        }
    } Fail:^(id fail) {
        [_tableView.mj_header endRefreshing];
        [_tableView.mj_footer endRefreshing];
    }];
}
#pragma mark - 搜索
-(void)pullSearchMusic {
    NSString *url = [purl stringByAppendingFormat:@"?service=Music.searchMusic&key=%@&p=%duid=%@",self.search.text,_paging,[Config getOwnID]];
    url = [url stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]];
    WeakSelf;
    [YBNetworking postWithUrl:url Dic:nil Suc:^(NSDictionary *data, NSString *code, NSString *msg) {
        [_tableView.mj_header endRefreshing];
        [_tableView.mj_footer endRefreshing];
        if ([code isEqual:@"0"]) {
            //指示器消失
            [PublicView indictorHide];
            NSArray *infoA = [data valueForKey:@"info"];
            if (_paging == 1) {
                [self.allArray removeAllObjects];
            }
            if (infoA.count<=0) {
                [_tableView.mj_footer endRefreshingWithNoMoreData];
            }else {
                [self.allArray addObjectsFromArray:infoA];
            }
            
            if (self.allArray.count ==0) {
                [PublicView showTextNoData:weakSelf.tableView text1:@"對不起~" text2:@"沒有搜索到相關內容"];
            }else{
                [PublicView hiddenTextNoData:weakSelf.tableView];
            }
            [self.tableView reloadData];
        }else{
            [PublicView showTextNoData:weakSelf.tableView text1:@"對不起~" text2:@"沒有搜索到相關內容"];
            [YBMsgPop showPop:msg];
            //指示器消失
            [PublicView indictorHide];
        }
    } Fail:^(id fail) {
        //指示器消失
        [PublicView indictorHide];
        [_tableView.mj_header endRefreshing];
        [_tableView.mj_footer endRefreshing];
    }];
}

“愛美之心人皆有之”,短視頻選擇的受衆羣體基本都屬於年輕羣體,所以美顏功能成爲必備功能。

@property(nonatomic, strong) UIView *beautyView; // 美顏窗口
@property(nonatomic, strong) UIView *faceTrimView; // 美型窗口
@property(nonatomic, strong) UIView *stickerView; // 貼紙窗口
@property(nonatomic, strong) UIView *filterView; // 濾鏡窗口
@property(nonatomic, strong) UIView *rockView; // Rock窗口
@property(nonatomic, strong) UIView *distortionView; // 哈哈鏡窗口@property(nonatomic, strong) UIView *greenScreenView; // 綠幕窗口
@property(nonatomic, strong) UISlider *faceTrimEyeMagnifyingSlider; // 美型-大眼拉條
@property(nonatomic, strong) UILabel *faceTrimEyeMagnifyingLabel; // 美型-大眼標籤
@property(nonatomic, strong) UISlider *faceTrimChinSlimmingSlider; // 美型-瘦臉拉條
@property(nonatomic, strong) UILabel *faceTrimChinSlimmingLabel; // 美型-瘦臉標籤

對於開發短視頻來說,短視頻網站源碼是必不可少的。以上爲短視頻中背景音樂和美顏功能的部分源碼,本文僅供參考學習,轉載請註明出處,想要了解其他方面的源碼請閱讀其他文章。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章