播放背景音乐
20
Music+CoreDataClass.h
Normal file
@@ -0,0 +1,20 @@
|
||||
//
|
||||
// Music+CoreDataClass.h
|
||||
//
|
||||
//
|
||||
// Created by 冯硕 on 2022/5/9.
|
||||
//
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <CoreData/CoreData.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface Music : NSManagedObject
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
||||
#import "Music+CoreDataProperties.h"
|
13
Music+CoreDataClass.m
Normal file
@@ -0,0 +1,13 @@
|
||||
//
|
||||
// Music+CoreDataClass.m
|
||||
//
|
||||
//
|
||||
// Created by 冯硕 on 2022/5/9.
|
||||
//
|
||||
//
|
||||
|
||||
#import "Music+CoreDataClass.h"
|
||||
|
||||
@implementation Music
|
||||
|
||||
@end
|
28
Music+CoreDataProperties.h
Normal file
@@ -0,0 +1,28 @@
|
||||
//
|
||||
// Music+CoreDataProperties.h
|
||||
//
|
||||
//
|
||||
// Created by 冯硕 on 2022/5/9.
|
||||
//
|
||||
//
|
||||
|
||||
#import "Music+CoreDataClass.h"
|
||||
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface Music (CoreDataProperties)
|
||||
|
||||
+ (NSFetchRequest<Music *> *)fetchRequest NS_SWIFT_NAME(fetchRequest());
|
||||
|
||||
@property (nullable, nonatomic, copy) NSString *author;
|
||||
@property (nullable, nonatomic, copy) NSString *filePath;
|
||||
@property (nullable, nonatomic, copy) NSString *musicArtists;
|
||||
@property (nullable, nonatomic, copy) NSString *musicId;
|
||||
@property (nullable, nonatomic, copy) NSString *musicName;
|
||||
@property (nullable, nonatomic, retain) NSData *songAlbum;
|
||||
@property (nullable, nonatomic, copy) NSString *songName;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
25
Music+CoreDataProperties.m
Normal file
@@ -0,0 +1,25 @@
|
||||
//
|
||||
// Music+CoreDataProperties.m
|
||||
//
|
||||
//
|
||||
// Created by 冯硕 on 2022/5/9.
|
||||
//
|
||||
//
|
||||
|
||||
#import "Music+CoreDataProperties.h"
|
||||
|
||||
@implementation Music (CoreDataProperties)
|
||||
|
||||
+ (NSFetchRequest<Music *> *)fetchRequest {
|
||||
return [NSFetchRequest fetchRequestWithEntityName:@"Music"];
|
||||
}
|
||||
|
||||
@dynamic author;
|
||||
@dynamic filePath;
|
||||
@dynamic musicArtists;
|
||||
@dynamic musicId;
|
||||
@dynamic musicName;
|
||||
@dynamic songAlbum;
|
||||
@dynamic songName;
|
||||
|
||||
@end
|
@@ -367,6 +367,8 @@
|
||||
E82D5C76276AEB5100858D6D /* NameplateModel.m in Sources */ = {isa = PBXBuildFile; fileRef = E82D5C75276AEB5100858D6D /* NameplateModel.m */; };
|
||||
E82D5C7A276B25D100858D6D /* SpriteSheetImageManager.m in Sources */ = {isa = PBXBuildFile; fileRef = E82D5C79276B25D100858D6D /* SpriteSheetImageManager.m */; };
|
||||
E82D5C7D276B343300858D6D /* YYAnimatedImageView+ImageShow.m in Sources */ = {isa = PBXBuildFile; fileRef = E82D5C7C276B343300858D6D /* YYAnimatedImageView+ImageShow.m */; };
|
||||
E82E74FD2828B23D00C25EF7 /* xplan-ios.xcdatamodeld in Sources */ = {isa = PBXBuildFile; fileRef = E82E74FB2828B23D00C25EF7 /* xplan-ios.xcdatamodeld */; };
|
||||
E82E75062828E76400C25EF7 /* XPCoreDataManager.m in Sources */ = {isa = PBXBuildFile; fileRef = E82E75052828E76400C25EF7 /* XPCoreDataManager.m */; };
|
||||
E82EE0F8272FDDFA00D15DC1 /* UserPrivacyView.m in Sources */ = {isa = PBXBuildFile; fileRef = E82EE0F7272FDDFA00D15DC1 /* UserPrivacyView.m */; };
|
||||
E833ED0D274FAD1C00A2463B /* XPKickUserModel.m in Sources */ = {isa = PBXBuildFile; fileRef = E833ED0C274FAD1C00A2463B /* XPKickUserModel.m */; };
|
||||
E836DBCD279BF2F10056F7DD /* XPLittleGameRoomListView.m in Sources */ = {isa = PBXBuildFile; fileRef = E836DBCC279BF2F10056F7DD /* XPLittleGameRoomListView.m */; };
|
||||
@@ -523,6 +525,14 @@
|
||||
E88B5CBD26FB3BDF00DA9178 /* XPTeenagerAlertView.m in Sources */ = {isa = PBXBuildFile; fileRef = E88B5CBC26FB3BDF00DA9178 /* XPTeenagerAlertView.m */; };
|
||||
E88B5CC126FB407B00DA9178 /* XPMineUserInfoViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = E88B5CC026FB407B00DA9178 /* XPMineUserInfoViewController.m */; };
|
||||
E88B5CC526FB42B000DA9178 /* XPMineUserInfoHeaderView.m in Sources */ = {isa = PBXBuildFile; fileRef = E88B5CC426FB42B000DA9178 /* XPMineUserInfoHeaderView.m */; };
|
||||
E88C72912828EA4E0047FB2B /* Music+CoreDataProperties.m in Sources */ = {isa = PBXBuildFile; fileRef = E88C728F2828EA4E0047FB2B /* Music+CoreDataProperties.m */; };
|
||||
E88C72922828EA4E0047FB2B /* Music+CoreDataClass.m in Sources */ = {isa = PBXBuildFile; fileRef = E88C72902828EA4E0047FB2B /* Music+CoreDataClass.m */; };
|
||||
E88C72952828F1AD0047FB2B /* XPRoomMusicLibraryViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = E88C72942828F1AD0047FB2B /* XPRoomMusicLibraryViewController.m */; };
|
||||
E88C72992828F3620047FB2B /* XPRoomMusicLibraryTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = E88C72982828F3620047FB2B /* XPRoomMusicLibraryTableViewCell.m */; };
|
||||
E88C729C2828F37D0047FB2B /* XPRoomMusicLibraryEmptyTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = E88C729B2828F37D0047FB2B /* XPRoomMusicLibraryEmptyTableViewCell.m */; };
|
||||
E88C72A02828FCD40047FB2B /* XPMusicLibraryPlayView.m in Sources */ = {isa = PBXBuildFile; fileRef = E88C729F2828FCD40047FB2B /* XPMusicLibraryPlayView.m */; };
|
||||
E88C72A3282917590047FB2B /* XPRoomMusicVoiceSettingView.m in Sources */ = {isa = PBXBuildFile; fileRef = E88C72A2282917590047FB2B /* XPRoomMusicVoiceSettingView.m */; };
|
||||
E88C72A6282921D60047FB2B /* XPRoomBackMusicPlayerView.m in Sources */ = {isa = PBXBuildFile; fileRef = E88C72A5282921D60047FB2B /* XPRoomBackMusicPlayerView.m */; };
|
||||
E890BC04273CF0500007C46B /* XPGiftCountModel.m in Sources */ = {isa = PBXBuildFile; fileRef = E890BC03273CF0500007C46B /* XPGiftCountModel.m */; };
|
||||
E890BC07273CF1800007C46B /* XPGiftCountCollectionViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = E890BC06273CF1800007C46B /* XPGiftCountCollectionViewCell.m */; };
|
||||
E890BC0D273D09A50007C46B /* XPGiftCountView.m in Sources */ = {isa = PBXBuildFile; fileRef = E890BC0C273D09A50007C46B /* XPGiftCountView.m */; };
|
||||
@@ -1512,6 +1522,9 @@
|
||||
E82D5C79276B25D100858D6D /* SpriteSheetImageManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SpriteSheetImageManager.m; sourceTree = "<group>"; };
|
||||
E82D5C7B276B343300858D6D /* YYAnimatedImageView+ImageShow.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "YYAnimatedImageView+ImageShow.h"; sourceTree = "<group>"; };
|
||||
E82D5C7C276B343300858D6D /* YYAnimatedImageView+ImageShow.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "YYAnimatedImageView+ImageShow.m"; sourceTree = "<group>"; };
|
||||
E82E74FC2828B23D00C25EF7 /* xplan-ios.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = "xplan-ios.xcdatamodel"; sourceTree = "<group>"; };
|
||||
E82E75042828E76400C25EF7 /* XPCoreDataManager.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPCoreDataManager.h; sourceTree = "<group>"; };
|
||||
E82E75052828E76400C25EF7 /* XPCoreDataManager.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPCoreDataManager.m; sourceTree = "<group>"; };
|
||||
E82EE0F6272FDDFA00D15DC1 /* UserPrivacyView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = UserPrivacyView.h; sourceTree = "<group>"; };
|
||||
E82EE0F7272FDDFA00D15DC1 /* UserPrivacyView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = UserPrivacyView.m; sourceTree = "<group>"; };
|
||||
E833ED0B274FAD1C00A2463B /* XPKickUserModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPKickUserModel.h; sourceTree = "<group>"; };
|
||||
@@ -1839,6 +1852,22 @@
|
||||
E88B5CC026FB407B00DA9178 /* XPMineUserInfoViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPMineUserInfoViewController.m; sourceTree = "<group>"; };
|
||||
E88B5CC326FB42B000DA9178 /* XPMineUserInfoHeaderView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPMineUserInfoHeaderView.h; sourceTree = "<group>"; };
|
||||
E88B5CC426FB42B000DA9178 /* XPMineUserInfoHeaderView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPMineUserInfoHeaderView.m; sourceTree = "<group>"; };
|
||||
E88C728D2828EA4E0047FB2B /* Music+CoreDataProperties.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "Music+CoreDataProperties.h"; sourceTree = "<group>"; };
|
||||
E88C728E2828EA4E0047FB2B /* Music+CoreDataClass.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "Music+CoreDataClass.h"; sourceTree = "<group>"; };
|
||||
E88C728F2828EA4E0047FB2B /* Music+CoreDataProperties.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "Music+CoreDataProperties.m"; sourceTree = "<group>"; };
|
||||
E88C72902828EA4E0047FB2B /* Music+CoreDataClass.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "Music+CoreDataClass.m"; sourceTree = "<group>"; };
|
||||
E88C72932828F1AD0047FB2B /* XPRoomMusicLibraryViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPRoomMusicLibraryViewController.h; sourceTree = "<group>"; };
|
||||
E88C72942828F1AD0047FB2B /* XPRoomMusicLibraryViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPRoomMusicLibraryViewController.m; sourceTree = "<group>"; };
|
||||
E88C72972828F3620047FB2B /* XPRoomMusicLibraryTableViewCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPRoomMusicLibraryTableViewCell.h; sourceTree = "<group>"; };
|
||||
E88C72982828F3620047FB2B /* XPRoomMusicLibraryTableViewCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPRoomMusicLibraryTableViewCell.m; sourceTree = "<group>"; };
|
||||
E88C729A2828F37D0047FB2B /* XPRoomMusicLibraryEmptyTableViewCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPRoomMusicLibraryEmptyTableViewCell.h; sourceTree = "<group>"; };
|
||||
E88C729B2828F37D0047FB2B /* XPRoomMusicLibraryEmptyTableViewCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPRoomMusicLibraryEmptyTableViewCell.m; sourceTree = "<group>"; };
|
||||
E88C729E2828FCD40047FB2B /* XPMusicLibraryPlayView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPMusicLibraryPlayView.h; sourceTree = "<group>"; };
|
||||
E88C729F2828FCD40047FB2B /* XPMusicLibraryPlayView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPMusicLibraryPlayView.m; sourceTree = "<group>"; };
|
||||
E88C72A1282917590047FB2B /* XPRoomMusicVoiceSettingView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPRoomMusicVoiceSettingView.h; sourceTree = "<group>"; };
|
||||
E88C72A2282917590047FB2B /* XPRoomMusicVoiceSettingView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPRoomMusicVoiceSettingView.m; sourceTree = "<group>"; };
|
||||
E88C72A4282921D60047FB2B /* XPRoomBackMusicPlayerView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPRoomBackMusicPlayerView.h; sourceTree = "<group>"; };
|
||||
E88C72A5282921D60047FB2B /* XPRoomBackMusicPlayerView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPRoomBackMusicPlayerView.m; sourceTree = "<group>"; };
|
||||
E890BC02273CF0500007C46B /* XPGiftCountModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPGiftCountModel.h; sourceTree = "<group>"; };
|
||||
E890BC03273CF0500007C46B /* XPGiftCountModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPGiftCountModel.m; sourceTree = "<group>"; };
|
||||
E890BC05273CF1800007C46B /* XPGiftCountCollectionViewCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPGiftCountCollectionViewCell.h; sourceTree = "<group>"; };
|
||||
@@ -4287,6 +4316,27 @@
|
||||
path = SpriteSheetManager;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
E82E74F92828B1FC00C25EF7 /* Model */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
E88C728D2828EA4E0047FB2B /* Music+CoreDataProperties.h */,
|
||||
E88C728E2828EA4E0047FB2B /* Music+CoreDataClass.h */,
|
||||
E88C728F2828EA4E0047FB2B /* Music+CoreDataProperties.m */,
|
||||
E88C72902828EA4E0047FB2B /* Music+CoreDataClass.m */,
|
||||
);
|
||||
path = Model;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
E82E74FA2828B20F00C25EF7 /* Presenter */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
E82E74FB2828B23D00C25EF7 /* xplan-ios.xcdatamodeld */,
|
||||
E82E75042828E76400C25EF7 /* XPCoreDataManager.h */,
|
||||
E82E75052828E76400C25EF7 /* XPCoreDataManager.m */,
|
||||
);
|
||||
path = Presenter;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
E838D99D275E1B6C0079E0B5 /* AnimationView */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
@@ -5016,6 +5066,30 @@
|
||||
path = MineInfo;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
E88C72962828F3410047FB2B /* Cell */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
E88C72972828F3620047FB2B /* XPRoomMusicLibraryTableViewCell.h */,
|
||||
E88C72982828F3620047FB2B /* XPRoomMusicLibraryTableViewCell.m */,
|
||||
E88C729A2828F37D0047FB2B /* XPRoomMusicLibraryEmptyTableViewCell.h */,
|
||||
E88C729B2828F37D0047FB2B /* XPRoomMusicLibraryEmptyTableViewCell.m */,
|
||||
);
|
||||
path = Cell;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
E88C729D2828FCB10047FB2B /* SubViews */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
E88C729E2828FCD40047FB2B /* XPMusicLibraryPlayView.h */,
|
||||
E88C729F2828FCD40047FB2B /* XPMusicLibraryPlayView.m */,
|
||||
E88C72A1282917590047FB2B /* XPRoomMusicVoiceSettingView.h */,
|
||||
E88C72A2282917590047FB2B /* XPRoomMusicVoiceSettingView.m */,
|
||||
E88C72A4282921D60047FB2B /* XPRoomBackMusicPlayerView.h */,
|
||||
E88C72A5282921D60047FB2B /* XPRoomBackMusicPlayerView.m */,
|
||||
);
|
||||
path = SubViews;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
E8937ABF276C3ECF00B2C7E1 /* enterroom */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
@@ -6323,7 +6397,9 @@
|
||||
E8E859E628264F0000EE4857 /* BackMusic */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
E82E74F92828B1FC00C25EF7 /* Model */,
|
||||
E8E859EA28264F4C00EE4857 /* View */,
|
||||
E82E74FA2828B20F00C25EF7 /* Presenter */,
|
||||
);
|
||||
path = BackMusic;
|
||||
sourceTree = "<group>";
|
||||
@@ -6331,8 +6407,12 @@
|
||||
E8E859EA28264F4C00EE4857 /* View */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
E88C729D2828FCB10047FB2B /* SubViews */,
|
||||
E88C72962828F3410047FB2B /* Cell */,
|
||||
E8E859E728264F4500EE4857 /* XPRoomTransferMusicViewController.h */,
|
||||
E8E859E828264F4500EE4857 /* XPRoomTransferMusicViewController.m */,
|
||||
E88C72932828F1AD0047FB2B /* XPRoomMusicLibraryViewController.h */,
|
||||
E88C72942828F1AD0047FB2B /* XPRoomMusicLibraryViewController.m */,
|
||||
);
|
||||
path = View;
|
||||
sourceTree = "<group>";
|
||||
@@ -6547,6 +6627,7 @@
|
||||
9B9EEF5427C8AFEA006B0EB3 /* XPSkillCardRecordPropModel.m in Sources */,
|
||||
E80B0737280D790400A79F63 /* GuildMessageModel.m in Sources */,
|
||||
E8B846D826FDE17300A777FE /* XPMineRechargeProtocol.h in Sources */,
|
||||
E88C72A6282921D60047FB2B /* XPRoomBackMusicPlayerView.m in Sources */,
|
||||
E82D5C7D276B343300858D6D /* YYAnimatedImageView+ImageShow.m in Sources */,
|
||||
E851E45F27FF0FEB002F3ACB /* XPGuildSearchNavView.m in Sources */,
|
||||
E8B846C726FDB45000A777FE /* XPMineUserInfoAlbumProtocol.h in Sources */,
|
||||
@@ -6554,6 +6635,7 @@
|
||||
E8DEC992276441AA0078CB70 /* XPCandyTreeAnimationModel.m in Sources */,
|
||||
9B1EF3D527E8294B00554295 /* XPMineDressEmptyCollectionViewCell.m in Sources */,
|
||||
E890BC07273CF1800007C46B /* XPGiftCountCollectionViewCell.m in Sources */,
|
||||
E88C72A02828FCD40047FB2B /* XPMusicLibraryPlayView.m in Sources */,
|
||||
E8C1670C28067DED00ECB15C /* XPMineGuildChooseManagerViewController.m in Sources */,
|
||||
E81EF6E8279AC21E00FF3EDE /* Api+LittleGame.m in Sources */,
|
||||
E8EEB91126FC6AE2007C6EBA /* XPMineUserInfoEditProtocol.h in Sources */,
|
||||
@@ -6704,6 +6786,7 @@
|
||||
E80DE40A277568D300BE5BCB /* ThemeColor+FirstRecharge.m in Sources */,
|
||||
9BC5C8ED277AFF63007C8719 /* XPNobleCenterViewController.m in Sources */,
|
||||
9B92A34A2797F35E00AD168F /* XPMatchManageTableViewCell.m in Sources */,
|
||||
E82E74FD2828B23D00C25EF7 /* xplan-ios.xcdatamodeld in Sources */,
|
||||
18EE3FE22750C29D00A452BF /* NIMBadgeView.m in Sources */,
|
||||
E82EE0F8272FDDFA00D15DC1 /* UserPrivacyView.m in Sources */,
|
||||
E8DEC9A42764A6600078CB70 /* XPMoreMenuPresenter.m in Sources */,
|
||||
@@ -6771,6 +6854,7 @@
|
||||
189DD74A26E21D8400AB55B1 /* SSKeychain.m in Sources */,
|
||||
E8DACCFE27673F870052092C /* GiftValueInfoModel.m in Sources */,
|
||||
E8412F9927799249006E1101 /* InviteFansModel.m in Sources */,
|
||||
E88C72912828EA4E0047FB2B /* Music+CoreDataProperties.m in Sources */,
|
||||
E84BF7CA277AF79D00EF8877 /* XPRoomSettingTagCell.m in Sources */,
|
||||
9BE9F0F927FED12D00667200 /* XPAnchorFansPrivilegeModel.m in Sources */,
|
||||
E8B846CF26FDD96100A777FE /* XPMineRechageHeadView.m in Sources */,
|
||||
@@ -7034,6 +7118,7 @@
|
||||
E824545126F5CE6E00BE8163 /* XPMineModifPayPwdPresenter.m in Sources */,
|
||||
E8A86DF727BA2F1C001C21F9 /* XPRoomLittleGameContainerView.m in Sources */,
|
||||
E880B3AF278BE1D800A83B0D /* Api+AcrossRoomPK.m in Sources */,
|
||||
E88C72992828F3620047FB2B /* XPRoomMusicLibraryTableViewCell.m in Sources */,
|
||||
E8D34D4728080295009C4835 /* XPMineUserDataViewController.m in Sources */,
|
||||
E8EEB90F26FC6AB8007C6EBA /* XPMineUserInfoEditPresenter.m in Sources */,
|
||||
E873EB09280960990071030D /* XPMineUserInfoVoiceCardView.m in Sources */,
|
||||
@@ -7064,6 +7149,7 @@
|
||||
E89DA67527009ACD008483C1 /* XPMineRechargeNavView.m in Sources */,
|
||||
E8C1672A2806B1E500ECB15C /* XPGuildSuperAdminSetTableViewCell.m in Sources */,
|
||||
E8834E4528003A8F0029CCC1 /* XPMineMangerListViewController.m in Sources */,
|
||||
E82E75062828E76400C25EF7 /* XPCoreDataManager.m in Sources */,
|
||||
1808072D2731598F001FD836 /* XPNetImageYYLabel.m in Sources */,
|
||||
E800806827FD3B520055A8AB /* XPClanMenuView.m in Sources */,
|
||||
E896EFAF2771AF0F00AD2CC1 /* XPMineFriendEmptyTableViewCell.m in Sources */,
|
||||
@@ -7080,6 +7166,7 @@
|
||||
E8E5E18E27C3331E00F457D8 /* XPHomeRecommendViewController.m in Sources */,
|
||||
9BE9F0FF27FED76500667200 /* XPAnchorFansTaskModel.m in Sources */,
|
||||
9B73CD05279A9A6A006AF255 /* XPSkillCardSaveModel.m in Sources */,
|
||||
E88C72922828EA4E0047FB2B /* Music+CoreDataClass.m in Sources */,
|
||||
E8E7DAE82744F5EF00C631CC /* XPGiftStorage.m in Sources */,
|
||||
E8AA6EEF27DF1E6B009B4C2B /* XPRoomTopicViewController.m in Sources */,
|
||||
E87AE7FC277AAC450037823A /* XPRoomTagPresenter.m in Sources */,
|
||||
@@ -7174,6 +7261,7 @@
|
||||
E82D5C76276AEB5100858D6D /* NameplateModel.m in Sources */,
|
||||
E800806227FD373D0055A8AB /* XPClanMemberTableViewCell.m in Sources */,
|
||||
E80016452804268E00D6D17A /* XPMineClanIncomeStatisViewController.m in Sources */,
|
||||
E88C72A3282917590047FB2B /* XPRoomMusicVoiceSettingView.m in Sources */,
|
||||
E84150BF27747BD300A7F548 /* Api+FirstRecharge.m in Sources */,
|
||||
E8E859CF28264C2300EE4857 /* DDNumber.m in Sources */,
|
||||
E84B0E422727EE0A008818C6 /* XPRoomMessageHeaderView.m in Sources */,
|
||||
@@ -7242,9 +7330,11 @@
|
||||
189DD58F26DF97E700AB55B1 /* LoginPresenter.m in Sources */,
|
||||
E8C167272806A68F00ECB15C /* GuildRoomInfoModel.m in Sources */,
|
||||
E88863C9278EBA43004BCFAB /* XPAcrossRoomPKForceEndResultView.m in Sources */,
|
||||
E88C72952828F1AD0047FB2B /* XPRoomMusicLibraryViewController.m in Sources */,
|
||||
E8E859D728264C2300EE4857 /* DDLog.m in Sources */,
|
||||
E896EFB22771C93B00AD2CC1 /* XPMineFriendNumberView.m in Sources */,
|
||||
9BB5495F2782E9DB0090CD26 /* NobleAuthInfo.m in Sources */,
|
||||
E88C729C2828F37D0047FB2B /* XPRoomMusicLibraryEmptyTableViewCell.m in Sources */,
|
||||
9B85F3562806DD8A006EDF51 /* XPAnchorPKFinishView.m in Sources */,
|
||||
E855516728059692005F293F /* GuildIncomeDetailModel.m in Sources */,
|
||||
E89DA67227008D59008483C1 /* WalletInfoModel.m in Sources */,
|
||||
@@ -7454,6 +7544,19 @@
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
/* End XCConfigurationList section */
|
||||
|
||||
/* Begin XCVersionGroup section */
|
||||
E82E74FB2828B23D00C25EF7 /* xplan-ios.xcdatamodeld */ = {
|
||||
isa = XCVersionGroup;
|
||||
children = (
|
||||
E82E74FC2828B23D00C25EF7 /* xplan-ios.xcdatamodel */,
|
||||
);
|
||||
currentVersion = E82E74FC2828B23D00C25EF7 /* xplan-ios.xcdatamodel */;
|
||||
path = "xplan-ios.xcdatamodeld";
|
||||
sourceTree = "<group>";
|
||||
versionGroupType = wrapper.xcdatamodel;
|
||||
};
|
||||
/* End XCVersionGroup section */
|
||||
};
|
||||
rootObject = 189DD52126DE255300AB55B1 /* Project object */;
|
||||
}
|
||||
|
@@ -6,10 +6,15 @@
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
#import <CoreData/CoreData.h>
|
||||
@interface AppDelegate : UIResponder <UIApplicationDelegate>
|
||||
|
||||
@property (strong, nonatomic) UIWindow *window;
|
||||
@property(nonatomic,strong,readonly)NSManagedObjectContext *managedObjectContext;
|
||||
@property(nonatomic,strong,readonly)NSManagedObjectModel *managedObjectModel;
|
||||
@property(nonatomic,strong,readonly)NSPersistentStoreCoordinator *persistentStoreCoordinator;
|
||||
|
||||
- (void)saveContext;
|
||||
- (NSURL *)applicationDocumentsDirectory;
|
||||
@end
|
||||
|
||||
|
@@ -67,4 +67,83 @@
|
||||
}
|
||||
|
||||
|
||||
#pragma mark - Core Data stack
|
||||
@synthesize managedObjectContext = _managedObjectContext;
|
||||
@synthesize managedObjectModel = _managedObjectModel;
|
||||
@synthesize persistentStoreCoordinator = _persistentStoreCoordinator;
|
||||
|
||||
-(NSURL *)applicationDocumentsDirectory{
|
||||
return [[[NSFileManager defaultManager] URLsForDirectory:NSDocumentDirectory inDomains:NSUserDomainMask] lastObject];
|
||||
}
|
||||
|
||||
- (NSManagedObjectModel *)managedObjectModel {
|
||||
// The managed object model for the application. It is a fatal error for the application not to be able to find and load its model.
|
||||
if (_managedObjectModel != nil) {
|
||||
return _managedObjectModel;
|
||||
}
|
||||
NSURL *modelURL = [[NSBundle mainBundle] URLForResource:@"_1_______" withExtension:@"momd"];
|
||||
_managedObjectModel = [[NSManagedObjectModel alloc] initWithContentsOfURL:modelURL];
|
||||
return _managedObjectModel;
|
||||
}
|
||||
|
||||
- (NSPersistentStoreCoordinator *)persistentStoreCoordinator {
|
||||
// The persistent store coordinator for the application. This implementation creates and returns a coordinator, having added the store for the application to it.
|
||||
if (_persistentStoreCoordinator != nil) {
|
||||
return _persistentStoreCoordinator;
|
||||
}
|
||||
|
||||
// Create the coordinator and store
|
||||
|
||||
_persistentStoreCoordinator = [[NSPersistentStoreCoordinator alloc] initWithManagedObjectModel:[self managedObjectModel]];
|
||||
NSURL *storeURL = [[self applicationDocumentsDirectory] URLByAppendingPathComponent:@"_1_______.sqlite"];
|
||||
NSError *error = nil;
|
||||
NSString *failureReason = @"There was an error creating or loading the application's saved data.";
|
||||
if (![_persistentStoreCoordinator addPersistentStoreWithType:NSSQLiteStoreType configuration:nil URL:storeURL options:nil error:&error]) {
|
||||
// Report any error we got.
|
||||
NSMutableDictionary *dict = [NSMutableDictionary dictionary];
|
||||
dict[NSLocalizedDescriptionKey] = @"Failed to initialize the application's saved data";
|
||||
dict[NSLocalizedFailureReasonErrorKey] = failureReason;
|
||||
dict[NSUnderlyingErrorKey] = error;
|
||||
error = [NSError errorWithDomain:@"YOUR_ERROR_DOMAIN" code:9999 userInfo:dict];
|
||||
// Replace this with code to handle the error appropriately.
|
||||
// abort() causes the application to generate a crash log and terminate. You should not use this function in a shipping application, although it may be useful during development.
|
||||
NSLog(@"Unresolved error %@, %@", error, [error userInfo]);
|
||||
abort();
|
||||
}
|
||||
|
||||
return _persistentStoreCoordinator;
|
||||
}
|
||||
|
||||
|
||||
- (NSManagedObjectContext *)managedObjectContext {
|
||||
// Returns the managed object context for the application (which is already bound to the persistent store coordinator for the application.)
|
||||
if (_managedObjectContext != nil) {
|
||||
return _managedObjectContext;
|
||||
}
|
||||
|
||||
NSPersistentStoreCoordinator *coordinator = [self persistentStoreCoordinator];
|
||||
if (!coordinator) {
|
||||
return nil;
|
||||
}
|
||||
_managedObjectContext = [[NSManagedObjectContext alloc] initWithConcurrencyType:NSMainQueueConcurrencyType];
|
||||
[_managedObjectContext setPersistentStoreCoordinator:coordinator];
|
||||
return _managedObjectContext;
|
||||
}
|
||||
|
||||
#pragma mark - Core Data Saving support
|
||||
|
||||
- (void)saveContext {
|
||||
NSManagedObjectContext *managedObjectContext = self.managedObjectContext;
|
||||
if (managedObjectContext != nil) {
|
||||
NSError *error = nil;
|
||||
if ([managedObjectContext hasChanges] && ![managedObjectContext save:&error]) {
|
||||
// Replace this implementation with code to handle the error appropriately.
|
||||
// abort() causes the application to generate a crash log and terminate. You should not use this function in a shipping application, although it may be useful during development.
|
||||
NSLog(@"Unresolved error %@, %@", error, [error userInfo]);
|
||||
abort();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@end
|
||||
|
22
xplan-ios/Assets.xcassets/Room/BackMusic/room_music_library_nav_add.imageset/Contents.json
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"filename" : "room_music_library_nav_add@2x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"filename" : "room_music_library_nav_add@3x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
After Width: | Height: | Size: 169 B |
After Width: | Height: | Size: 263 B |
22
xplan-ios/Assets.xcassets/Room/BackMusic/room_music_library_pause.imageset/Contents.json
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"filename" : "room_music_library_pause@2x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"filename" : "room_music_library_pause@3x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
After Width: | Height: | Size: 591 B |
After Width: | Height: | Size: 1.0 KiB |
22
xplan-ios/Assets.xcassets/Room/BackMusic/room_music_library_play.imageset/Contents.json
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"filename" : "room_music_library_play@2x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"filename" : "room_music_library_play@3x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
After Width: | Height: | Size: 825 B |
After Width: | Height: | Size: 1.5 KiB |
22
xplan-ios/Assets.xcassets/Room/BackMusic/room_music_library_volum_setting.imageset/Contents.json
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"filename" : "room_music_library_volum_setting@2x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"filename" : "room_music_library_volum_setting@3x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
After Width: | Height: | Size: 245 B |
After Width: | Height: | Size: 487 B |
22
xplan-ios/Assets.xcassets/Room/BackMusic/room_music_player_enter.imageset/Contents.json
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"filename" : "room_music_player_enter@2x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"filename" : "room_music_player_enter@3x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
After Width: | Height: | Size: 429 B |
After Width: | Height: | Size: 640 B |
21
xplan-ios/Assets.xcassets/Room/BackMusic/room_music_small_player_more.imageset/Contents.json
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"filename" : "room_music_small_player_more@3x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
After Width: | Height: | Size: 238 B |
22
xplan-ios/Assets.xcassets/Room/BackMusic/room_music_small_player_next.imageset/Contents.json
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"filename" : "room_music_small_player_next@2x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"filename" : "room_music_small_player_next@3x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
After Width: | Height: | Size: 436 B |
After Width: | Height: | Size: 643 B |
22
xplan-ios/Assets.xcassets/Room/BackMusic/room_music_small_player_pause.imageset/Contents.json
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"filename" : "room_music_small_player_pause@2x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"filename" : "room_music_small_player_pause@3x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
After Width: | Height: | Size: 146 B |
After Width: | Height: | Size: 257 B |
22
xplan-ios/Assets.xcassets/Room/BackMusic/room_music_small_player_play.imageset/Contents.json
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"filename" : "room_music_small_player_play@2x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"filename" : "room_music_small_player_play@3x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
After Width: | Height: | Size: 392 B |
After Width: | Height: | Size: 585 B |
22
xplan-ios/Assets.xcassets/Room/BackMusic/room_music_small_player_voice.imageset/Contents.json
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"filename" : "room_music_small_player_voice@2x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"filename" : "room_music_small_player_voice@3x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
After Width: | Height: | Size: 291 B |
After Width: | Height: | Size: 411 B |
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"filename" : "room_music_small_player_white_dot@2x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"filename" : "room_music_small_player_white_dot@3x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
After Width: | Height: | Size: 245 B |
After Width: | Height: | Size: 282 B |
22
xplan-ios/Assets.xcassets/Room/BackMusic/room_music_voice_setting_dot.imageset/Contents.json
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"filename" : "room_music_voice_setting_dot@2x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"filename" : "room_music_voice_setting_dot@3x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
After Width: | Height: | Size: 227 B |
After Width: | Height: | Size: 342 B |
@@ -73,6 +73,57 @@
|
||||
[AgoraRtcEngineKit destroy];
|
||||
}
|
||||
|
||||
/// 播放背景音乐
|
||||
/// @param filePath 音频文件的地址
|
||||
/// @param musicId TRTC自己要的
|
||||
- (BOOL)playBackMusic:(NSString *)filePath musicId:(int)musicId {
|
||||
|
||||
if (filePath) {
|
||||
[self changePlayState:BackMusicPlayState_Stop];//切换歌曲need stop
|
||||
BOOL state = [self.engine startAudioMixing:filePath loopback:NO replace:NO cycle:1];
|
||||
return state;
|
||||
} else {
|
||||
return NO;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// 改变播放器的状态
|
||||
/// @param state 播放状态
|
||||
- (BOOL)changePlayState:(BackMusicPlayState)state {
|
||||
BOOL isPlaying = NO;
|
||||
switch (state) {
|
||||
case BackMusicPlayState_Stop:
|
||||
{
|
||||
[self.engine stopAudioMixing];
|
||||
isPlaying = NO;
|
||||
}
|
||||
break;
|
||||
case BackMusicPlayState_Pause:
|
||||
{
|
||||
[self.engine pauseAudioMixing];
|
||||
isPlaying = NO;
|
||||
}
|
||||
break;
|
||||
case BackMusicPlayState_Resume:
|
||||
{
|
||||
[self.engine resumeAudioMixing];
|
||||
isPlaying = NO;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return isPlaying;
|
||||
}
|
||||
|
||||
- (void)updateUserSound:(int)soundVol {
|
||||
[self.engine adjustRecordingSignalVolume:soundVol];
|
||||
}
|
||||
|
||||
- (void)updateMusicSound:(int)soundVol {
|
||||
[self.engine adjustAudioMixingVolume:soundVol];
|
||||
}
|
||||
|
||||
#pragma mark - AgoraRtcEngineDelegate
|
||||
- (void)rtcEngine:(AgoraRtcEngineKit *)engine reportAudioVolumeIndicationOfSpeakers:(NSArray *)speakers totalVolume:(NSInteger)totalVolume {
|
||||
NSMutableArray *uids = [NSMutableArray array];
|
||||
|
@@ -16,6 +16,9 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
*/
|
||||
- (void)usersSpeaking:(NSMutableArray * _Nullable)uids;
|
||||
|
||||
///当前的背景音乐播放完毕 是否进行下一首
|
||||
- (void)currentBackMusicPlayFinish:(NSString *)filePath;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
@@ -6,7 +6,7 @@
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#import "RtcManager.h"
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@protocol RtcInterface <NSObject>
|
||||
@@ -49,6 +49,20 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
///退出跨房通话
|
||||
- (void)disconnectOtherRoom;
|
||||
|
||||
|
||||
/// @param filePath 音频文件的地址
|
||||
/// @param musicId TRTC自己要的
|
||||
- (BOOL)playBackMusic:(NSString *)filePath musicId:(int)musicId;
|
||||
|
||||
/// 改变播放器的状态
|
||||
/// @param state 播放状态
|
||||
- (BOOL)changePlayState:(BackMusicPlayState)state;
|
||||
|
||||
///背景音乐的音量大小
|
||||
- (void)updateMusicSound:(int)soundVol;
|
||||
|
||||
///背景人声的音量大小
|
||||
- (void)updateUserSound:(int)soundVol;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
@@ -12,6 +12,10 @@
|
||||
@interface TRTCRtcImpl()<TRTCCloudDelegate>
|
||||
|
||||
@property (strong, nonatomic) TRTCCloud *engine;
|
||||
///背景音乐管理
|
||||
@property (nonatomic, strong) TXAudioEffectManager *musicManager;
|
||||
///音乐的id
|
||||
@property (nonatomic,assign) int musicId;
|
||||
|
||||
@end
|
||||
|
||||
@@ -22,6 +26,7 @@
|
||||
if (self) {
|
||||
_engine = [TRTCCloud sharedInstance];
|
||||
[_engine enableAudioVolumeEvaluation:900];
|
||||
[TRTCCloud setConsoleEnabled:NO];
|
||||
_engine.delegate = self;
|
||||
}
|
||||
return self;
|
||||
@@ -120,6 +125,71 @@
|
||||
[TRTCCloud destroySharedIntance];
|
||||
}
|
||||
|
||||
/// 播放背景音乐
|
||||
/// @param filePath 音频文件的地址
|
||||
/// @param musicId TRTC自己要的
|
||||
- (BOOL)playBackMusic:(NSString *)filePath musicId:(int)musicId {
|
||||
|
||||
if (filePath) {
|
||||
[self changePlayState:BackMusicPlayState_Stop];//切换歌曲need stop
|
||||
self.musicId = musicId;
|
||||
if (self.musicManager == nil) {
|
||||
self.musicManager = [self.engine getAudioEffectManager];
|
||||
}
|
||||
|
||||
TXAudioMusicParam *param = [[TXAudioMusicParam alloc] init];
|
||||
param.ID = musicId;
|
||||
param.path = filePath;
|
||||
[self.musicManager startPlayMusic:param onStart:^(NSInteger errCode) {
|
||||
NSLog(@"aianan %ld",errCode);
|
||||
} onProgress:^(NSInteger progressMs, NSInteger durationMs) {
|
||||
|
||||
} onComplete:^(NSInteger errCode) {
|
||||
[self.delegate currentBackMusicPlayFinish:filePath];
|
||||
}];
|
||||
return YES;
|
||||
} else {
|
||||
return NO;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// 改变播放器的状态
|
||||
/// @param state 播放状态
|
||||
- (BOOL)changePlayState:(BackMusicPlayState)state {
|
||||
BOOL isPlaying = NO;
|
||||
switch (state) {
|
||||
case BackMusicPlayState_Stop:
|
||||
{
|
||||
[self.musicManager stopPlayMusic:self.musicId];
|
||||
isPlaying = NO;
|
||||
}
|
||||
break;
|
||||
case BackMusicPlayState_Pause:
|
||||
{
|
||||
[self.musicManager pausePlayMusic:self.musicId];
|
||||
isPlaying = NO;
|
||||
}
|
||||
break;
|
||||
case BackMusicPlayState_Resume:
|
||||
{
|
||||
[self.musicManager resumePlayMusic:self.musicId];
|
||||
isPlaying = NO;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return isPlaying;
|
||||
}
|
||||
|
||||
- (void)updateUserSound:(int)soundVol {
|
||||
[self.engine setAudioCaptureVolume:soundVol];
|
||||
}
|
||||
|
||||
- (void)updateMusicSound:(int)soundVol {
|
||||
[self.musicManager setMusicPublishVolume:self.musicId volume:soundVol];
|
||||
}
|
||||
|
||||
#pragma mark - TRTCCloudDelegate
|
||||
- (void)onUserVoiceVolume:(NSArray<TRTCVolumeInfo *> *)userVolumes totalVolume:(NSInteger)totalVolume {
|
||||
NSMutableArray *uids = [NSMutableArray array];
|
||||
|
@@ -8,10 +8,12 @@
|
||||
#import "ZegoRtcImpl.h"
|
||||
#import <ZegoAudioRoom/ZegoAudioRoom.h>
|
||||
|
||||
@interface ZegoRtcImpl()<ZegoAudioRoomDelegate, ZegoAudioLivePublisherDelegate, ZegoSoundLevelDelegate>
|
||||
@interface ZegoRtcImpl()<ZegoAudioRoomDelegate, ZegoAudioLivePublisherDelegate, ZegoSoundLevelDelegate, ZegoMediaPlayerEventDelegate>
|
||||
|
||||
@property (nonatomic, strong) ZegoAudioRoomApi *engine;
|
||||
|
||||
@property (nonatomic, strong) ZegoMediaPlayer *mediaPlayer;
|
||||
///当前播放的背景音乐路径
|
||||
@property (nonatomic,copy) NSString *filePath;
|
||||
@end
|
||||
|
||||
@implementation ZegoRtcImpl
|
||||
@@ -44,6 +46,9 @@
|
||||
|
||||
#pragma mark - RtcInterface impl
|
||||
- (BOOL)joinChannel:(nonnull NSString *)channelId completion:(void (^ _Nullable)(void))completion {
|
||||
//推流播放模式,会将音频混流推流中,调用端和拉流端都可以听到播放的声音。
|
||||
self.mediaPlayer = [[ZegoMediaPlayer alloc] initWithPlayerType:MediaPlayerTypeAux];
|
||||
[self.mediaPlayer setDelegate:self];
|
||||
//开始监听
|
||||
[[ZegoSoundLevel sharedInstance] setSoundLevelDelegate:self];
|
||||
[[ZegoSoundLevel sharedInstance] setSoundLevelMonitorCycle:1200]; //监控周期 [100, 3000]。默认 200 ms。
|
||||
@@ -97,6 +102,60 @@
|
||||
|
||||
}
|
||||
|
||||
/// 播放背景音乐
|
||||
/// @param filePath 音频文件的地址
|
||||
/// @param musicId TRTC自己要的
|
||||
- (BOOL)playBackMusic:(NSString *)filePath musicId:(int)musicId {
|
||||
[self.mediaPlayer stop];//切换歌曲need stop
|
||||
if (filePath) {
|
||||
self.filePath = filePath;
|
||||
[self.engine muteAux:true];
|
||||
[self.mediaPlayer start:filePath repeat:NO];
|
||||
}
|
||||
return YES;
|
||||
}
|
||||
|
||||
/// 改变播放器的状态
|
||||
/// @param state 播放状态
|
||||
- (BOOL)changePlayState:(BackMusicPlayState)state {
|
||||
BOOL isPlaying = NO;
|
||||
switch (state) {
|
||||
case BackMusicPlayState_Stop:
|
||||
{
|
||||
[self.mediaPlayer stop];
|
||||
[self.engine muteAux:false];
|
||||
isPlaying = NO;
|
||||
}
|
||||
break;
|
||||
case BackMusicPlayState_Pause:
|
||||
{
|
||||
[self.mediaPlayer pause];
|
||||
isPlaying = NO;
|
||||
}
|
||||
break;
|
||||
case BackMusicPlayState_Resume:
|
||||
{
|
||||
[self.mediaPlayer resume];
|
||||
isPlaying = NO;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return isPlaying;
|
||||
}
|
||||
|
||||
- (void)updateUserSound:(int)soundVol {
|
||||
if (soundVol) {
|
||||
[self.engine setCaptureVolume:soundVol];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)updateMusicSound:(int)soundVol {
|
||||
if (soundVol) {
|
||||
[self.mediaPlayer setVolume:soundVol];
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - ZegoAudioRoomDelegate
|
||||
- (void)onStreamUpdated:(ZegoAudioStreamType)type stream:(ZegoAudioStream *)stream {
|
||||
switch (type) {
|
||||
@@ -129,6 +188,12 @@
|
||||
[self.delegate usersSpeaking:[self formatSpeakingUids:@[captureSoundLevel]]];
|
||||
}
|
||||
|
||||
#pragma mark - ZegoMediaPlayerEventDelegate
|
||||
///播放结束
|
||||
- (void)onPlayEnd {
|
||||
[self.delegate currentBackMusicPlayFinish:self.filePath];
|
||||
}
|
||||
|
||||
#pragma mark - private method
|
||||
- (NSMutableArray *)formatSpeakingUids:(NSArray<ZegoSoundLevelInfo *> *)soundLevels {
|
||||
NSMutableArray *uids = [NSMutableArray array];
|
||||
@@ -154,4 +219,6 @@
|
||||
return [NSData dataWithBytes:signkey length:32];
|
||||
}
|
||||
|
||||
|
||||
|
||||
@end
|
||||
|
@@ -17,6 +17,15 @@ typedef enum : NSUInteger {
|
||||
RtcEngineType_TRTC, // 腾讯TRTC
|
||||
} RtcEngineType;
|
||||
|
||||
typedef NS_ENUM(NSInteger, BackMusicPlayState) {
|
||||
///停止
|
||||
BackMusicPlayState_Stop = 1,
|
||||
///暂停
|
||||
BackMusicPlayState_Pause,
|
||||
///重新播放
|
||||
BackMusicPlayState_Resume
|
||||
};
|
||||
|
||||
/** 音频服务管理单例,对所有音频服务 SDK 的封装。
|
||||
|
||||
**Note:**
|
||||
@@ -106,6 +115,20 @@ typedef enum : NSUInteger {
|
||||
///退出跨房通话
|
||||
- (void)disconnectOtherRoom;
|
||||
|
||||
/// 播放背景音乐
|
||||
/// @param filePath 音频文件的地址
|
||||
/// @param musicId TRTC自己要的
|
||||
- (BOOL)playBackMusic:(NSString *)filePath musicId:(int)musicId;
|
||||
|
||||
/// 改变播放器的状态
|
||||
/// @param state 播放状态
|
||||
- (BOOL)changePlayState:(BackMusicPlayState)state;
|
||||
|
||||
///背景音乐的音量大小
|
||||
- (void)updateMusicSound:(int)soundVol;
|
||||
|
||||
///背景人声的音量大小
|
||||
- (void)updateUserSound:(int)soundVol;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
@@ -111,6 +111,29 @@
|
||||
[self.engine destory];
|
||||
}
|
||||
|
||||
/// 播放背景音乐
|
||||
/// @param filePath 音频文件的地址
|
||||
/// @param musicId TRTC自己要的
|
||||
- (BOOL)playBackMusic:(NSString *)filePath musicId:(int)musicId {
|
||||
return [self.engine playBackMusic:filePath musicId:musicId];
|
||||
}
|
||||
|
||||
/// 改变播放器的状态
|
||||
/// @param state 播放状态
|
||||
- (BOOL)changePlayState:(BackMusicPlayState)state {
|
||||
return [self.engine changePlayState:state];
|
||||
}
|
||||
|
||||
///背景音乐的音量大小
|
||||
- (void)updateMusicSound:(int)soundVol {
|
||||
[self.engine updateMusicSound:soundVol];
|
||||
}
|
||||
|
||||
///背景人声的音量大小
|
||||
- (void)updateUserSound:(int)soundVol {
|
||||
[self.engine updateUserSound:soundVol];
|
||||
}
|
||||
|
||||
- (void)usersSpeaking:(NSMutableArray *)uids {
|
||||
if (self.engineDelegate) {
|
||||
[self.engineDelegate usersSpeaking:uids];
|
||||
|
@@ -0,0 +1,20 @@
|
||||
//
|
||||
// Music+CoreDataClass.h
|
||||
//
|
||||
//
|
||||
// Created by 冯硕 on 2022/5/9.
|
||||
//
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <CoreData/CoreData.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface Music : NSManagedObject
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
||||
#import "Music+CoreDataProperties.h"
|
@@ -0,0 +1,13 @@
|
||||
//
|
||||
// Music+CoreDataClass.m
|
||||
//
|
||||
//
|
||||
// Created by 冯硕 on 2022/5/9.
|
||||
//
|
||||
//
|
||||
|
||||
#import "Music+CoreDataClass.h"
|
||||
|
||||
@implementation Music
|
||||
|
||||
@end
|
@@ -0,0 +1,28 @@
|
||||
//
|
||||
// Music+CoreDataProperties.h
|
||||
//
|
||||
//
|
||||
// Created by 冯硕 on 2022/5/9.
|
||||
//
|
||||
//
|
||||
|
||||
#import "Music+CoreDataClass.h"
|
||||
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface Music (CoreDataProperties)
|
||||
|
||||
+ (NSFetchRequest<Music *> *)fetchRequest NS_SWIFT_NAME(fetchRequest());
|
||||
|
||||
@property (nullable, nonatomic, copy) NSString *author;
|
||||
@property (nullable, nonatomic, copy) NSString *filePath;
|
||||
@property (nullable, nonatomic, copy) NSString *musicArtists;
|
||||
@property (nullable, nonatomic, copy) NSString *musicId;
|
||||
@property (nullable, nonatomic, copy) NSString *musicName;
|
||||
@property (nullable, nonatomic, retain) NSData *songAlbum;
|
||||
@property (nullable, nonatomic, copy) NSString *songName;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
@@ -0,0 +1,25 @@
|
||||
//
|
||||
// Music+CoreDataProperties.m
|
||||
//
|
||||
//
|
||||
// Created by 冯硕 on 2022/5/9.
|
||||
//
|
||||
//
|
||||
|
||||
#import "Music+CoreDataProperties.h"
|
||||
|
||||
@implementation Music (CoreDataProperties)
|
||||
|
||||
+ (NSFetchRequest<Music *> *)fetchRequest {
|
||||
return [NSFetchRequest fetchRequestWithEntityName:@"Music"];
|
||||
}
|
||||
|
||||
@dynamic author;
|
||||
@dynamic filePath;
|
||||
@dynamic musicArtists;
|
||||
@dynamic musicId;
|
||||
@dynamic musicName;
|
||||
@dynamic songAlbum;
|
||||
@dynamic songName;
|
||||
|
||||
@end
|
@@ -0,0 +1,33 @@
|
||||
//
|
||||
// XPCoreDataManager.h
|
||||
// xplan-ios
|
||||
//
|
||||
// Created by 冯硕 on 2022/5/9.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <CoreData/CoreData.h>
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface XPCoreDataManager : NSObject
|
||||
+(XPCoreDataManager *)shareInstance;
|
||||
/**
|
||||
管理上下文
|
||||
*/
|
||||
@property(nonatomic,strong)NSManagedObjectContext *managedObjectContext;
|
||||
/**
|
||||
模型对象
|
||||
*/
|
||||
@property(nonatomic,strong)NSManagedObjectModel *managedObjectModel;
|
||||
/**
|
||||
存储调度器
|
||||
*/
|
||||
@property(nonatomic,strong)NSPersistentStoreCoordinator *persistentStoreCoordinator;
|
||||
|
||||
/**
|
||||
保存操作
|
||||
*/
|
||||
-(void)save;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
@@ -0,0 +1,78 @@
|
||||
//
|
||||
// XPCoreDataManager.m
|
||||
// xplan-ios
|
||||
//
|
||||
// Created by 冯硕 on 2022/5/9.
|
||||
//
|
||||
|
||||
#import "XPCoreDataManager.h"
|
||||
|
||||
@implementation XPCoreDataManager
|
||||
static XPCoreDataManager *manager = nil;
|
||||
+(XPCoreDataManager *)shareInstance{
|
||||
static dispatch_once_t onceToken;
|
||||
dispatch_once(&onceToken, ^{
|
||||
manager = [[XPCoreDataManager alloc]init];
|
||||
});
|
||||
return manager;
|
||||
}
|
||||
|
||||
//获取数据库的路径
|
||||
-(NSURL *)getDocumnetUrlpath{
|
||||
return [[[NSFileManager defaultManager] URLsForDirectory:NSDocumentDirectory inDomains:NSUserDomainMask] lastObject];
|
||||
}
|
||||
|
||||
-(NSManagedObjectContext *)managedObjectContext{
|
||||
if (!_managedObjectContext) {
|
||||
/**
|
||||
参数:CoreData环境线程
|
||||
NSMainQueueConcurrencyType:主线程 储存无延迟
|
||||
NSPrivateQueueConcurrencyType:分支线程 存储有延迟
|
||||
*/
|
||||
_managedObjectContext = [[NSManagedObjectContext alloc]initWithConcurrencyType:NSMainQueueConcurrencyType];
|
||||
//设置存储调度器
|
||||
_managedObjectContext.persistentStoreCoordinator = self.persistentStoreCoordinator;
|
||||
}
|
||||
return _managedObjectContext;
|
||||
}
|
||||
|
||||
-(NSManagedObjectModel *)managedObjectModel{
|
||||
if (!_managedObjectModel) {
|
||||
/**
|
||||
初始化NSManagedObjectModel
|
||||
参数是:模型文件的路径
|
||||
后缀不能是xcdatamodeld 只能是momd
|
||||
_managedObjectModel = [[NSManagedObjectModel alloc] initWithContentsOfURL:[[NSBundle mainBundle] URLForResource:@"Teacher" withExtension:@"momd"]];
|
||||
|
||||
参数是模型文件的bundle数组 如果是nil 自动获取所有bundle的模型文件
|
||||
*/
|
||||
_managedObjectModel = [NSManagedObjectModel mergedModelFromBundles:nil];
|
||||
}
|
||||
return _managedObjectModel;
|
||||
}
|
||||
|
||||
-(NSPersistentStoreCoordinator *)persistentStoreCoordinator{
|
||||
if (!_persistentStoreCoordinator) {
|
||||
/**
|
||||
参数:要存储的模型
|
||||
*/
|
||||
_persistentStoreCoordinator = [[NSPersistentStoreCoordinator alloc]initWithManagedObjectModel:self.managedObjectModel];
|
||||
|
||||
/**
|
||||
参数:
|
||||
* type:一般使用数据库存储方式NSSQLiteStoreType
|
||||
* configuration:配置信息 一般无需配置
|
||||
* URL:要保存的文件路径
|
||||
* options:参数信息 一般无需设置
|
||||
*/
|
||||
NSURL *url = [[self getDocumnetUrlpath] URLByAppendingPathComponent:@"sqlit.db" isDirectory:true];
|
||||
[_persistentStoreCoordinator addPersistentStoreWithType:NSSQLiteStoreType configuration:nil URL:url options:nil error:nil];
|
||||
}
|
||||
return _persistentStoreCoordinator;
|
||||
}
|
||||
|
||||
-(void)save{
|
||||
[self.managedObjectContext save:nil];
|
||||
}
|
||||
|
||||
@end
|
@@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<model type="com.apple.IDECoreDataModeler.DataModel" documentVersion="1.0" lastSavedToolsVersion="19206" systemVersion="20G95" minimumToolsVersion="Automatic" sourceLanguage="Objective-C" userDefinedModelVersionIdentifier="">
|
||||
<entity name="Music" representedClassName="Music" syncable="YES">
|
||||
<attribute name="author" optional="YES" attributeType="String"/>
|
||||
<attribute name="filePath" optional="YES" attributeType="String"/>
|
||||
<attribute name="musicArtists" optional="YES" attributeType="String"/>
|
||||
<attribute name="musicId" optional="YES" attributeType="String"/>
|
||||
<attribute name="musicName" optional="YES" attributeType="String"/>
|
||||
<attribute name="songAlbum" optional="YES" attributeType="Binary"/>
|
||||
<attribute name="songName" optional="YES" attributeType="String"/>
|
||||
</entity>
|
||||
<elements>
|
||||
<element name="Music" positionX="-63" positionY="-18" width="128" height="134"/>
|
||||
</elements>
|
||||
</model>
|
@@ -0,0 +1,22 @@
|
||||
//
|
||||
// XPRoomMusicLibraryEmptyTableViewCell.h
|
||||
// xplan-ios
|
||||
//
|
||||
// Created by 冯硕 on 2022/5/9.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
@class XPRoomMusicLibraryEmptyTableViewCell;
|
||||
@protocol XPRoomMusicLibraryEmptyTableViewCellDelegate <NSObject>
|
||||
|
||||
- (void)xPRoomMusicLibraryEmptyTableViewCell:(XPRoomMusicLibraryEmptyTableViewCell *)cell didClickAdd:(UIButton *)sender;
|
||||
|
||||
@end
|
||||
@interface XPRoomMusicLibraryEmptyTableViewCell : UITableViewCell
|
||||
///代理
|
||||
@property (nonatomic,weak) id<XPRoomMusicLibraryEmptyTableViewCellDelegate> delegate;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
@@ -0,0 +1,99 @@
|
||||
//
|
||||
// XPRoomMusicLibraryEmptyTableViewCell.m
|
||||
// xplan-ios
|
||||
//
|
||||
// Created by 冯硕 on 2022/5/9.
|
||||
//
|
||||
|
||||
#import "XPRoomMusicLibraryEmptyTableViewCell.h"
|
||||
///Third
|
||||
#import <Masonry/Masonry.h>
|
||||
///Tool
|
||||
#import "ThemeColor.h"
|
||||
#import "UIImageConstant.h"
|
||||
|
||||
@interface XPRoomMusicLibraryEmptyTableViewCell ()
|
||||
@property (nonatomic,strong) UIImageView *emptyImageView;
|
||||
@property (nonatomic,strong) UILabel *titleLabel;
|
||||
///更错
|
||||
@property (nonatomic,strong) UIButton *addButton;
|
||||
@end
|
||||
|
||||
@implementation XPRoomMusicLibraryEmptyTableViewCell
|
||||
|
||||
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
|
||||
if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
|
||||
[self initSubViews];
|
||||
[self initSubViewConstraints];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
#pragma mark - Private Method
|
||||
- (void)initSubViews {
|
||||
self.selectionStyle = UITableViewCellSelectionStyleNone;
|
||||
[self.contentView addSubview:self.emptyImageView];
|
||||
[self.contentView addSubview:self.titleLabel];
|
||||
[self.contentView addSubview:self.addButton];
|
||||
}
|
||||
|
||||
- (void)initSubViewConstraints {
|
||||
[self.emptyImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.mas_equalTo(self.contentView).offset(150);
|
||||
make.centerX.mas_equalTo(self.contentView);
|
||||
make.size.mas_equalTo(CGSizeMake(200, 200));
|
||||
}];
|
||||
|
||||
[self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.mas_equalTo(self.emptyImageView.mas_bottom).offset(20);
|
||||
make.left.right.mas_equalTo(self.contentView);
|
||||
}];
|
||||
|
||||
[self.addButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.size.mas_equalTo(CGSizeMake(100, 30));
|
||||
make.centerX.mas_equalTo(self.contentView);
|
||||
make.top.mas_equalTo(self.titleLabel.mas_bottom).offset(20);
|
||||
}];
|
||||
}
|
||||
#pragma mark - Event Response
|
||||
- (void)addButtonAction:(UIButton *)sender {
|
||||
if (self.delegate && [self.delegate respondsToSelector:@selector(xPRoomMusicLibraryEmptyTableViewCell:didClickAdd:)]) {
|
||||
[self.delegate xPRoomMusicLibraryEmptyTableViewCell:self didClickAdd:sender];
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - Getters And Setters
|
||||
- (UIImageView *)emptyImageView {
|
||||
if (!_emptyImageView) {
|
||||
_emptyImageView = [[UIImageView alloc] init];
|
||||
_emptyImageView.userInteractionEnabled = YES;
|
||||
_emptyImageView.image = [UIImageConstant defalutEmptyPlaceholder];
|
||||
_emptyImageView.layer.masksToBounds = YES;
|
||||
_emptyImageView.contentMode = UIViewContentModeScaleAspectFit;
|
||||
}
|
||||
return _emptyImageView;
|
||||
}
|
||||
|
||||
- (UILabel *)titleLabel {
|
||||
if (!_titleLabel) {
|
||||
_titleLabel = [[UILabel alloc] init];
|
||||
_titleLabel.text = @"暂无数据";
|
||||
_titleLabel.font = [UIFont systemFontOfSize:16];
|
||||
_titleLabel.textAlignment = NSTextAlignmentCenter;
|
||||
_titleLabel.textColor = [ThemeColor secondTextColor];
|
||||
}
|
||||
return _titleLabel;
|
||||
}
|
||||
|
||||
- (UIButton *)addButton {
|
||||
if (!_addButton) {
|
||||
_addButton = [UIButton buttonWithType:UIButtonTypeCustom];
|
||||
[_addButton setTitle:@"传输更多歌曲" forState:UIControlStateNormal];
|
||||
[_addButton setTitleColor:[ThemeColor mainTextColor] forState:UIControlStateNormal];
|
||||
_addButton.titleLabel.font = [UIFont systemFontOfSize:15];
|
||||
[_addButton addTarget:self action:@selector(addButtonAction:) forControlEvents:UIControlEventTouchUpInside];
|
||||
}
|
||||
return _addButton;
|
||||
}
|
||||
|
||||
|
||||
@end
|
@@ -0,0 +1,17 @@
|
||||
//
|
||||
// XPRoomMusicLibraryTableViewCell.h
|
||||
// xplan-ios
|
||||
//
|
||||
// Created by 冯硕 on 2022/5/9.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
@class Music;
|
||||
@interface XPRoomMusicLibraryTableViewCell : UITableViewCell
|
||||
///歌曲信息
|
||||
@property (nonatomic,strong) Music *musicInfo;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
@@ -0,0 +1,122 @@
|
||||
//
|
||||
// XPRoomMusicLibraryTableViewCell.m
|
||||
// xplan-ios
|
||||
//
|
||||
// Created by 冯硕 on 2022/5/9.
|
||||
//
|
||||
|
||||
#import "XPRoomMusicLibraryTableViewCell.h"
|
||||
///Third
|
||||
#import <Masonry/Masonry.h>
|
||||
///Tool
|
||||
#import "ThemeColor.h"
|
||||
#import "Music+CoreDataClass.h"
|
||||
@interface XPRoomMusicLibraryTableViewCell ()
|
||||
///背景
|
||||
@property (nonatomic,strong) UIView * backView;
|
||||
///歌曲的背景
|
||||
@property (nonatomic,strong) UIImageView *musicAlbumImageView;
|
||||
///歌曲的名称
|
||||
@property (nonatomic,strong) UILabel * songNameLabel;
|
||||
///歌曲的作者
|
||||
@property (nonatomic,strong) UILabel *authorLabel;
|
||||
///分割线
|
||||
@property (nonatomic,strong) UIView * lineView;
|
||||
@end
|
||||
|
||||
@implementation XPRoomMusicLibraryTableViewCell
|
||||
|
||||
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
|
||||
if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
|
||||
[self initSubViews];
|
||||
[self initSubViewConstraints];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
#pragma mark - Private Method
|
||||
- (void)initSubViews {
|
||||
self.backgroundColor = [UIColor clearColor];
|
||||
self.selectionStyle = UITableViewCellSelectionStyleNone;
|
||||
[self.contentView addSubview:self.backView];
|
||||
|
||||
[self.backView addSubview:self.musicAlbumImageView];
|
||||
[self.backView addSubview:self.songNameLabel];
|
||||
[self.backView addSubview:self.authorLabel];
|
||||
}
|
||||
|
||||
- (void)initSubViewConstraints {
|
||||
[self.backView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.edges.mas_equalTo(self.contentView);
|
||||
}];
|
||||
|
||||
[self.musicAlbumImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_equalTo(self.backView).offset(15);
|
||||
make.centerY.mas_equalTo(self.backView);
|
||||
make.size.mas_equalTo(CGSizeMake(45, 45));
|
||||
}];
|
||||
|
||||
[self.songNameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_equalTo(self.musicAlbumImageView.mas_right).offset(10);
|
||||
make.bottom.mas_equalTo(self.musicAlbumImageView.mas_centerY).offset(-3);
|
||||
}];
|
||||
|
||||
[self.authorLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_equalTo(self.songNameLabel);
|
||||
make.top.mas_equalTo(self.musicAlbumImageView.mas_centerY).offset(3);
|
||||
}];
|
||||
}
|
||||
#pragma mark - Getters And Setters
|
||||
- (void)setMusicInfo:(Music *)musicInfo {
|
||||
_musicInfo = musicInfo;
|
||||
if (_musicInfo) {
|
||||
self.musicAlbumImageView.image = [UIImage imageWithData:_musicInfo.songAlbum];
|
||||
self.songNameLabel.text = _musicInfo.songName;
|
||||
self.authorLabel.text = _musicInfo.author;
|
||||
}
|
||||
}
|
||||
|
||||
- (UIView *)backView {
|
||||
if (!_backView) {
|
||||
_backView = [[UIView alloc] init];
|
||||
_backView.backgroundColor = [UIColor clearColor];
|
||||
}
|
||||
return _backView;
|
||||
}
|
||||
|
||||
- (UIImageView *)musicAlbumImageView {
|
||||
if (!_musicAlbumImageView) {
|
||||
_musicAlbumImageView = [[UIImageView alloc] init];
|
||||
_musicAlbumImageView.userInteractionEnabled = YES;
|
||||
_musicAlbumImageView.layer.masksToBounds = YES;
|
||||
_musicAlbumImageView.layer.cornerRadius = 8;
|
||||
}
|
||||
return _musicAlbumImageView;
|
||||
}
|
||||
|
||||
- (UILabel *)songNameLabel {
|
||||
if (!_songNameLabel) {
|
||||
_songNameLabel = [[UILabel alloc] init];
|
||||
_songNameLabel.font = [UIFont systemFontOfSize:15];
|
||||
_songNameLabel.textColor = [ThemeColor mainTextColor];
|
||||
}
|
||||
return _songNameLabel;
|
||||
}
|
||||
|
||||
- (UILabel *)authorLabel {
|
||||
if (!_authorLabel) {
|
||||
_authorLabel = [[UILabel alloc] init];
|
||||
_authorLabel.font = [UIFont systemFontOfSize:12];
|
||||
_authorLabel.textColor = [ThemeColor secondTextColor];
|
||||
}
|
||||
return _authorLabel;
|
||||
}
|
||||
|
||||
- (UIView *)lineView {
|
||||
if (!_lineView) {
|
||||
_lineView = [[UIView alloc] init];
|
||||
_lineView.backgroundColor = [ThemeColor dividerColor];
|
||||
}
|
||||
return _lineView;
|
||||
}
|
||||
|
||||
@end
|
@@ -0,0 +1,25 @@
|
||||
//
|
||||
// XPMusicLibraryPlayView.h
|
||||
// xplan-ios
|
||||
//
|
||||
// Created by 冯硕 on 2022/5/9.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
@class Music;
|
||||
@class XPMusicLibraryPlayView;
|
||||
@protocol XPMusicLibraryPlayViewDelegate <NSObject>
|
||||
|
||||
- (void)xPMusicLibraryPlayView:(XPMusicLibraryPlayView *)view didClickVoiceSetting:(UIButton *)sender;
|
||||
|
||||
@end
|
||||
@interface XPMusicLibraryPlayView : UIView
|
||||
///歌曲
|
||||
@property (nonatomic,strong) Music *music;
|
||||
///代理
|
||||
@property (nonatomic,weak) id<XPMusicLibraryPlayViewDelegate> delegate;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
@@ -0,0 +1,109 @@
|
||||
//
|
||||
// XPMusicLibraryPlayView.m
|
||||
// xplan-ios
|
||||
//
|
||||
// Created by 冯硕 on 2022/5/9.
|
||||
//
|
||||
|
||||
#import "XPMusicLibraryPlayView.h"
|
||||
///Third
|
||||
#import <Masonry/Masonry.h>
|
||||
///Tool
|
||||
#import "ThemeColor.h"
|
||||
///Model
|
||||
#import "Music+CoreDataClass.h"
|
||||
|
||||
@interface XPMusicLibraryPlayView ()
|
||||
///显示播放按钮
|
||||
@property (nonatomic,strong) UIButton *playButton;
|
||||
///显示标题
|
||||
@property (nonatomic,strong) UILabel *titleLabel;
|
||||
///设置
|
||||
@property (nonatomic,strong) UIButton *settingButton;
|
||||
@end
|
||||
|
||||
@implementation XPMusicLibraryPlayView
|
||||
- (instancetype)initWithFrame:(CGRect)frame {
|
||||
self = [super initWithFrame:frame];
|
||||
if (self) {
|
||||
[self initSubViews];
|
||||
[self initSubViewConstraints];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
#pragma mark - Private Method
|
||||
- (void)initSubViews {
|
||||
self.backgroundColor = UIColorRGBAlpha(0x000000, 0.2);
|
||||
|
||||
[self addSubview:self.playButton];
|
||||
[self addSubview:self.titleLabel];
|
||||
[self addSubview:self.settingButton];
|
||||
}
|
||||
|
||||
- (void)initSubViewConstraints {
|
||||
[self.playButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.size.mas_equalTo(CGSizeMake(44, 44));
|
||||
make.centerY.mas_equalTo(self);
|
||||
make.left.mas_equalTo(self).offset(15);
|
||||
}];
|
||||
|
||||
[self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_equalTo(self.playButton.mas_right).offset(5);
|
||||
make.centerY.mas_equalTo(self.playButton);
|
||||
}];
|
||||
|
||||
[self.settingButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.size.mas_equalTo(CGSizeMake(22, 22));
|
||||
make.centerY.mas_equalTo(self);
|
||||
make.right.mas_equalTo(self).offset(-15);
|
||||
}];
|
||||
}
|
||||
#pragma mark - Event Response
|
||||
- (void)playButtonAction:(UIButton *)sender {
|
||||
|
||||
}
|
||||
|
||||
- (void)settingButtonAction:(UIButton *)sender {
|
||||
sender.selected = !sender.selected;
|
||||
if (self.delegate && [self.delegate respondsToSelector:@selector(xPMusicLibraryPlayView:didClickVoiceSetting:)]) {
|
||||
[self.delegate xPMusicLibraryPlayView:self didClickVoiceSetting:sender];
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - Getters And Setters
|
||||
- (void)setMusic:(Music *)music {
|
||||
|
||||
}
|
||||
|
||||
- (UIButton *)playButton {
|
||||
if (!_playButton) {
|
||||
_playButton = [UIButton buttonWithType:UIButtonTypeCustom];
|
||||
[_playButton setImage:[UIImage imageNamed:@"room_music_library_pause"] forState:UIControlStateNormal];
|
||||
[_playButton setImage:[UIImage imageNamed:@"room_music_library_play"] forState:UIControlStateSelected];
|
||||
[_playButton addTarget:self action:@selector(playButtonAction:) forControlEvents:UIControlEventTouchUpInside];
|
||||
}
|
||||
return _playButton;
|
||||
}
|
||||
|
||||
- (UILabel *)titleLabel {
|
||||
if (!_titleLabel) {
|
||||
_titleLabel = [[UILabel alloc] init];
|
||||
_titleLabel.font = [UIFont systemFontOfSize:14];
|
||||
_titleLabel.textColor = [ThemeColor mainTextColor];
|
||||
_titleLabel.text = @"暂无歌曲";
|
||||
}
|
||||
return _titleLabel;
|
||||
}
|
||||
|
||||
- (UIButton *)settingButton {
|
||||
if (!_settingButton) {
|
||||
_settingButton = [UIButton buttonWithType:UIButtonTypeCustom];
|
||||
[_settingButton setImage:[UIImage imageNamed:@"room_music_library_volum_setting"] forState:UIControlStateNormal];
|
||||
[_settingButton setImage:[UIImage imageNamed:@"room_music_library_volum_setting"] forState:UIControlStateSelected];
|
||||
[_settingButton addTarget:self action:@selector(settingButtonAction:) forControlEvents:UIControlEventTouchUpInside];
|
||||
}
|
||||
return _settingButton;
|
||||
}
|
||||
|
||||
@end
|
@@ -0,0 +1,16 @@
|
||||
//
|
||||
// XPRoomBackMusicPlayerView.h
|
||||
// xplan-ios
|
||||
//
|
||||
// Created by 冯硕 on 2022/5/9.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface XPRoomBackMusicPlayerView : UIView
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
@@ -0,0 +1,216 @@
|
||||
//
|
||||
// XPRoomBackMusicPlayerView.m
|
||||
// xplan-ios
|
||||
//
|
||||
// Created by 冯硕 on 2022/5/9.
|
||||
//
|
||||
|
||||
#import "XPRoomBackMusicPlayerView.h"
|
||||
///Third
|
||||
#import <Masonry/Masonry.h>
|
||||
///Tool
|
||||
#import "ThemeColor.h"
|
||||
#import "UIImage+Utils.h"
|
||||
#import "XCCurrentVCStackManager.h"
|
||||
#import "XPCoreDataManager.h"
|
||||
#import "RtcManager.h"
|
||||
///Model
|
||||
#import "Music+CoreDataClass.h"
|
||||
///View
|
||||
#import "XPRoomMusicLibraryViewController.h"
|
||||
@interface XPRoomBackMusicPlayerView ()<NSFetchedResultsControllerDelegate>
|
||||
|
||||
///显示歌曲的名字
|
||||
@property (nonatomic,strong) UILabel *titleLabel;
|
||||
///声音的logo
|
||||
@property (nonatomic,strong) UIImageView *voiceImageView;
|
||||
///调节声音
|
||||
@property (nonatomic,strong) UISlider *voiceSliderView;
|
||||
///播放暂停
|
||||
@property (nonatomic,strong) UIButton *playButton;
|
||||
///下一首
|
||||
@property (nonatomic,strong) UIButton *nextButton;
|
||||
///更多
|
||||
@property (nonatomic,strong) UIButton *moreButton;
|
||||
@property(nonatomic,strong)NSFetchedResultsController *fetchedResultController;
|
||||
@end
|
||||
|
||||
@implementation XPRoomBackMusicPlayerView
|
||||
|
||||
- (instancetype)initWithFrame:(CGRect)frame {
|
||||
self = [super initWithFrame:frame];
|
||||
if (self) {
|
||||
[self initSubViews];
|
||||
[self initSubViewConstraints];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
#pragma mark - Private Method
|
||||
- (void)initSubViews {
|
||||
self.backgroundColor = [UIColor colorWithWhite:0 alpha:0.8];
|
||||
self.layer.masksToBounds = YES;
|
||||
self.layer.cornerRadius = 40.f;
|
||||
[self addSubview:self.titleLabel];
|
||||
[self addSubview:self.voiceImageView];
|
||||
[self addSubview:self.voiceSliderView];
|
||||
[self addSubview:self.playButton];
|
||||
[self addSubview:self.nextButton];
|
||||
[self addSubview:self.moreButton];
|
||||
}
|
||||
|
||||
- (void)initSubViewConstraints {
|
||||
[self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.right.mas_equalTo(self).inset(30);
|
||||
make.top.mas_equalTo(self).offset(17);
|
||||
}];
|
||||
|
||||
[self.voiceImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.size.mas_equalTo(CGSizeMake(12, 15));
|
||||
make.left.mas_equalTo(self.titleLabel);
|
||||
make.top.mas_equalTo(self.titleLabel.mas_bottom).offset(18);
|
||||
}];
|
||||
|
||||
[self.voiceSliderView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_equalTo(self.voiceImageView.mas_right).offset(5);
|
||||
make.right.mas_equalTo(self.playButton.mas_left).offset(-10);
|
||||
make.centerY.mas_equalTo(self.voiceImageView);
|
||||
}];
|
||||
|
||||
[self.playButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.size.mas_equalTo(CGSizeMake(22, 22));
|
||||
make.centerY.mas_equalTo(self.voiceImageView);
|
||||
make.right.mas_equalTo(self.nextButton.mas_left).offset(-10);
|
||||
}];
|
||||
|
||||
[self.nextButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.size.mas_equalTo(CGSizeMake(22, 22));
|
||||
make.centerY.mas_equalTo(self.voiceImageView);
|
||||
make.right.mas_equalTo(self.moreButton.mas_left).offset(-10);
|
||||
}];
|
||||
|
||||
[self.moreButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.size.mas_equalTo(CGSizeMake(22, 22));
|
||||
make.centerY.mas_equalTo(self.voiceImageView);
|
||||
make.right.mas_equalTo(self).offset(-30);
|
||||
}];
|
||||
}
|
||||
#pragma mark - Event Response
|
||||
- (void)voiceSliderViewValueChange:(UISlider *)slider {
|
||||
|
||||
}
|
||||
|
||||
- (void)moreButtonAction:(UIButton *)sender {
|
||||
XPRoomMusicLibraryViewController * musicLibraryVC = [[XPRoomMusicLibraryViewController alloc] init];
|
||||
[[XCCurrentVCStackManager shareManager].getCurrentVC.navigationController pushViewController:musicLibraryVC animated:YES];
|
||||
}
|
||||
|
||||
- (void)playButtonAction:(UIButton *)sender {
|
||||
if (self.fetchedResultController.fetchedObjects.count <=0) {
|
||||
XPRoomMusicLibraryViewController * musicLibraryVC = [[XPRoomMusicLibraryViewController alloc] init];
|
||||
[[XCCurrentVCStackManager shareManager].getCurrentVC.navigationController pushViewController:musicLibraryVC animated:YES];
|
||||
} else {
|
||||
switch (sender.tag) {
|
||||
case 1000:
|
||||
{
|
||||
NSArray * array = self.fetchedResultController.fetchedObjects;
|
||||
Music * music = [array objectAtIndex:0];
|
||||
[[RtcManager instance] playBackMusic:music.filePath musicId:0];
|
||||
[[RtcManager instance] updateUserSound:50];
|
||||
[[RtcManager instance] updateMusicSound:50];
|
||||
}
|
||||
break;
|
||||
case 1001:
|
||||
|
||||
break;
|
||||
case 1002:
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - Getters And Setters
|
||||
- (UILabel *)titleLabel {
|
||||
if (!_titleLabel) {
|
||||
_titleLabel = [[UILabel alloc] init];
|
||||
_titleLabel.font = [UIFont systemFontOfSize:13];
|
||||
_titleLabel.textColor = UIColor.whiteColor;
|
||||
_titleLabel.text = @"暂无音乐播放";
|
||||
}
|
||||
return _titleLabel;
|
||||
}
|
||||
|
||||
- (UIImageView *)voiceImageView {
|
||||
if (!_voiceImageView) {
|
||||
_voiceImageView = [[UIImageView alloc] init];
|
||||
_voiceImageView.userInteractionEnabled = YES;
|
||||
_voiceImageView.image = [UIImage imageNamed:@"room_music_small_player_voice"];
|
||||
}
|
||||
return _voiceImageView;
|
||||
}
|
||||
|
||||
- (UISlider *)voiceSliderView {
|
||||
if (!_voiceSliderView) {
|
||||
_voiceSliderView = [[UISlider alloc]init];
|
||||
_voiceSliderView.minimumValue = 0;
|
||||
_voiceSliderView.maximumValue = 100;
|
||||
_voiceSliderView.value = 50;
|
||||
_voiceSliderView.minimumTrackTintColor = [UIColor whiteColor];
|
||||
_voiceSliderView.maximumTrackTintColor = UIColorFromRGB(0x999999);
|
||||
[_voiceSliderView setThumbImage:[UIImage imageNamed:@"room_music_small_player_white_dot"] forState:UIControlStateNormal];
|
||||
[_voiceSliderView addTarget:self action:@selector(voiceSliderViewValueChange:) forControlEvents:UIControlEventValueChanged];
|
||||
|
||||
}
|
||||
return _voiceSliderView;
|
||||
}
|
||||
|
||||
- (UIButton *)playButton {
|
||||
if (!_playButton) {
|
||||
_playButton = [UIButton buttonWithType:UIButtonTypeCustom];
|
||||
[_playButton setImage:[UIImage imageNamed:@"room_music_small_player_play"] forState:UIControlStateNormal];
|
||||
[_playButton setImage:[UIImage imageNamed:@"room_music_small_player_pause"] forState:UIControlStateSelected];
|
||||
_playButton.tag = 1000;
|
||||
[_playButton addTarget:self action:@selector(playButtonAction:) forControlEvents:UIControlEventTouchUpInside];
|
||||
}
|
||||
return _playButton;
|
||||
}
|
||||
|
||||
- (UIButton *)moreButton {
|
||||
if (!_moreButton) {
|
||||
_moreButton = [UIButton buttonWithType:UIButtonTypeCustom];
|
||||
[_moreButton setImage:[UIImage imageNamed:@"room_music_small_player_more"] forState:UIControlStateNormal];
|
||||
[_moreButton setImage:[UIImage imageNamed:@"room_music_small_player_more"] forState:UIControlStateSelected];
|
||||
_moreButton.tag = 1001;
|
||||
[_moreButton addTarget:self action:@selector(moreButtonAction:) forControlEvents:UIControlEventTouchUpInside];
|
||||
_moreButton.transform = CGAffineTransformMakeRotation(-M_PI /2);
|
||||
}
|
||||
return _moreButton;
|
||||
}
|
||||
|
||||
- (UIButton *)nextButton {
|
||||
if (!_nextButton) {
|
||||
_nextButton = [UIButton buttonWithType:UIButtonTypeCustom];
|
||||
[_nextButton setImage:[UIImage imageNamed:@"room_music_small_player_next"] forState:UIControlStateNormal];
|
||||
[_nextButton setImage:[UIImage imageNamed:@"room_music_small_player_next"] forState:UIControlStateSelected];
|
||||
_nextButton.tag = 1002;
|
||||
[_nextButton addTarget:self action:@selector(playButtonAction:) forControlEvents:UIControlEventTouchUpInside];
|
||||
}
|
||||
return _nextButton;
|
||||
}
|
||||
|
||||
-(NSFetchedResultsController *)fetchedResultController{
|
||||
if (!_fetchedResultController) {
|
||||
NSFetchRequest *request = [[NSFetchRequest alloc]initWithEntityName:@"Music"];
|
||||
NSSortDescriptor *sort = [NSSortDescriptor sortDescriptorWithKey:@"musicId" ascending:true];
|
||||
request.sortDescriptors = @[sort];
|
||||
_fetchedResultController = [[NSFetchedResultsController alloc]initWithFetchRequest:request managedObjectContext:[XPCoreDataManager shareInstance].managedObjectContext sectionNameKeyPath:nil cacheName:nil];
|
||||
_fetchedResultController.delegate = self;
|
||||
[_fetchedResultController performFetch:nil];
|
||||
}
|
||||
return _fetchedResultController;
|
||||
}
|
||||
|
||||
@end
|
@@ -0,0 +1,31 @@
|
||||
//
|
||||
// XPRoomMusicVoiceSettingView.h
|
||||
// xplan-ios
|
||||
//
|
||||
// Created by 冯硕 on 2022/5/9.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
typedef NS_ENUM(NSInteger, MusicVoiceSettingType) {
|
||||
///人声
|
||||
MusicVoiceSettingType_User,
|
||||
///背景音乐
|
||||
MusicVoiceSettingType_Music,
|
||||
};
|
||||
@class XPRoomMusicVoiceSettingView;
|
||||
@protocol XPRoomMusicVoiceSettingViewDelegate <NSObject>
|
||||
|
||||
- (void)xPRoomMusicVoiceSettingView:(XPRoomMusicVoiceSettingView *)view didSliderValueChange:(UISlider *)slider;
|
||||
|
||||
@end
|
||||
|
||||
@interface XPRoomMusicVoiceSettingView : UIView
|
||||
|
||||
///代理
|
||||
@property (nonatomic,weak) id<XPRoomMusicVoiceSettingViewDelegate> delegate;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
@@ -0,0 +1,214 @@
|
||||
//
|
||||
// XPRoomMusicVoiceSettingView.m
|
||||
// xplan-ios
|
||||
//
|
||||
// Created by 冯硕 on 2022/5/9.
|
||||
//
|
||||
|
||||
#import "XPRoomMusicVoiceSettingView.h"
|
||||
///Third
|
||||
#import <Masonry/Masonry.h>
|
||||
///Tool
|
||||
#import "ThemeColor.h"
|
||||
|
||||
@interface XPRoomMusicVoiceSettingView ()
|
||||
///最大的容器
|
||||
@property (nonatomic,strong) UIStackView *stackView;
|
||||
///人声
|
||||
@property (nonatomic,strong) UIStackView *userStackView;
|
||||
///人声
|
||||
@property (nonatomic,strong) UILabel *userTitleLabel;
|
||||
///人生音量调节滑块
|
||||
@property (strong, nonatomic) UISlider *userVolumeSlider;
|
||||
///%
|
||||
@property (nonatomic,strong) UILabel *userVoiceLabel;
|
||||
///音乐的
|
||||
@property (nonatomic,strong) UIStackView *musicStackView;
|
||||
///人声
|
||||
@property (nonatomic,strong) UILabel *musicTitleLabel;
|
||||
///人生音量调节滑块
|
||||
@property (strong, nonatomic) UISlider *musicVolumeSlider;
|
||||
///音乐的%
|
||||
@property (nonatomic,strong) UILabel *musicVoiceLabel;
|
||||
@end
|
||||
|
||||
|
||||
@implementation XPRoomMusicVoiceSettingView
|
||||
|
||||
- (instancetype)initWithFrame:(CGRect)frame {
|
||||
self = [super initWithFrame:frame];
|
||||
if (self) {
|
||||
[self initSubViews];
|
||||
[self initSubViewConstraints];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
#pragma mark - Private Method
|
||||
- (void)initSubViews {
|
||||
self.backgroundColor = UIColorRGBAlpha(0x000000, 0.2);
|
||||
[self addSubview:self.stackView];
|
||||
|
||||
[self.stackView addArrangedSubview:self.userStackView];
|
||||
[self.stackView addArrangedSubview:self.musicStackView];
|
||||
|
||||
[self.userStackView addArrangedSubview:self.userTitleLabel];
|
||||
[self.userStackView addArrangedSubview:self.userVolumeSlider];
|
||||
[self.userStackView addArrangedSubview:self.userVoiceLabel];
|
||||
|
||||
[self.musicStackView addArrangedSubview:self.musicTitleLabel];
|
||||
[self.musicStackView addArrangedSubview:self.musicVolumeSlider];
|
||||
[self.musicStackView addArrangedSubview:self.musicVoiceLabel];
|
||||
}
|
||||
|
||||
- (void)initSubViewConstraints {
|
||||
[self mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.height.mas_equalTo(60);
|
||||
}];
|
||||
|
||||
[self.stackView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.right.mas_equalTo(self).inset(15);
|
||||
make.top.bottom.mas_equalTo(self);
|
||||
|
||||
}];
|
||||
|
||||
[self.userStackView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.height.mas_equalTo(35);
|
||||
}];
|
||||
|
||||
[self.userTitleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.width.mas_equalTo(35);
|
||||
}];
|
||||
|
||||
[self.userVoiceLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.width.mas_equalTo(35);
|
||||
}];
|
||||
|
||||
[self.musicTitleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.width.mas_equalTo(35);
|
||||
}];
|
||||
|
||||
[self.musicVoiceLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.width.mas_equalTo(35);
|
||||
}];
|
||||
}
|
||||
#pragma mark - Event Response
|
||||
- (void)userVolumeSliderValueChange:(UISlider *)slider {
|
||||
if (slider == self.userVolumeSlider) {
|
||||
self.userVoiceLabel.text = [[NSString stringWithFormat:@"%ld",(NSInteger)slider.value] stringByAppendingString:@"%"];
|
||||
} else {
|
||||
self.musicVoiceLabel.text = [[NSString stringWithFormat:@"%ld",(NSInteger)slider.value] stringByAppendingString:@"%"];
|
||||
}
|
||||
|
||||
if (self.delegate && [self.delegate respondsToSelector:@selector(xPRoomMusicVoiceSettingView:didSliderValueChange:)]) {
|
||||
[self.delegate xPRoomMusicVoiceSettingView:self didSliderValueChange:slider];
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - Getters And Setters
|
||||
- (UIStackView *)stackView {
|
||||
if (!_stackView) {
|
||||
_stackView = [[UIStackView alloc] init];
|
||||
_stackView.axis = UILayoutConstraintAxisVertical;
|
||||
_stackView.distribution = UIStackViewDistributionFill;
|
||||
_stackView.alignment = UIStackViewAlignmentFill;
|
||||
_stackView.spacing = 5;
|
||||
}
|
||||
return _stackView;
|
||||
}
|
||||
|
||||
- (UIStackView *)userStackView {
|
||||
if (!_userStackView) {
|
||||
_userStackView = [[UIStackView alloc] init];
|
||||
_userStackView.axis = UILayoutConstraintAxisHorizontal;
|
||||
_userStackView.distribution = UIStackViewDistributionFill;
|
||||
_userStackView.alignment = UIStackViewAlignmentCenter;
|
||||
_userStackView.spacing = 5;
|
||||
}
|
||||
return _userStackView;
|
||||
}
|
||||
|
||||
- (UILabel *)userTitleLabel {
|
||||
if (!_userTitleLabel) {
|
||||
_userTitleLabel = [[UILabel alloc] init];
|
||||
_userTitleLabel.font = [UIFont systemFontOfSize:13];
|
||||
_userTitleLabel.textColor = UIColorFromRGB(0x999999);
|
||||
_userTitleLabel.text = @"人声";
|
||||
}
|
||||
return _userTitleLabel;
|
||||
}
|
||||
|
||||
- (UISlider *)userVolumeSlider {
|
||||
if (!_userVolumeSlider) {
|
||||
_userVolumeSlider = [[UISlider alloc]init];
|
||||
_userVolumeSlider.minimumValue = 0;
|
||||
_userVolumeSlider.maximumValue = 100;
|
||||
_userVolumeSlider.value = 50;
|
||||
_userVolumeSlider.minimumTrackTintColor = [ThemeColor appMainColor];
|
||||
_userVolumeSlider.maximumTrackTintColor = UIColor.whiteColor;
|
||||
_userVolumeSlider.tag = MusicVoiceSettingType_User;
|
||||
[_userVolumeSlider setThumbImage:[UIImage imageNamed:@"room_music_voice_setting_dot"] forState:UIControlStateNormal];
|
||||
[_userVolumeSlider addTarget:self action:@selector(userVolumeSliderValueChange:) forControlEvents:UIControlEventValueChanged];
|
||||
|
||||
}
|
||||
return _userVolumeSlider;
|
||||
}
|
||||
|
||||
- (UILabel *)userVoiceLabel {
|
||||
if (!_userVoiceLabel) {
|
||||
_userVoiceLabel = [[UILabel alloc] init];
|
||||
_userVoiceLabel.font = [UIFont systemFontOfSize:13];
|
||||
_userVoiceLabel.textColor = UIColorFromRGB(0x999999);
|
||||
_userVoiceLabel.text = @"50%";
|
||||
}
|
||||
return _userVoiceLabel;
|
||||
}
|
||||
|
||||
- (UIStackView *)musicStackView {
|
||||
if (!_musicStackView) {
|
||||
_musicStackView = [[UIStackView alloc] init];
|
||||
_musicStackView.axis = UILayoutConstraintAxisHorizontal;
|
||||
_musicStackView.distribution = UIStackViewDistributionFill;
|
||||
_musicStackView.alignment = UIStackViewAlignmentFill;
|
||||
_musicStackView.spacing = 5;
|
||||
}
|
||||
return _musicStackView;
|
||||
}
|
||||
|
||||
- (UILabel *)musicTitleLabel {
|
||||
if (!_musicTitleLabel) {
|
||||
_musicTitleLabel = [[UILabel alloc] init];
|
||||
_musicTitleLabel.font = [UIFont systemFontOfSize:13];
|
||||
_musicTitleLabel.textColor = UIColorFromRGB(0x999999);
|
||||
_musicTitleLabel.text = @"音乐";
|
||||
}
|
||||
return _musicTitleLabel;
|
||||
}
|
||||
|
||||
- (UISlider *)musicVolumeSlider {
|
||||
if (!_musicVolumeSlider) {
|
||||
_musicVolumeSlider = [[UISlider alloc]init];
|
||||
_musicVolumeSlider.minimumValue = 0;
|
||||
_musicVolumeSlider.maximumValue = 100;
|
||||
_musicVolumeSlider.value = 50;
|
||||
_musicVolumeSlider.minimumTrackTintColor = [ThemeColor appMainColor];
|
||||
_musicVolumeSlider.maximumTrackTintColor = UIColor.whiteColor;
|
||||
_musicVolumeSlider.tag = MusicVoiceSettingType_Music;
|
||||
[_musicVolumeSlider setThumbImage:[UIImage imageNamed:@"room_music_voice_setting_dot"] forState:UIControlStateNormal];
|
||||
[_musicVolumeSlider addTarget:self action:@selector(userVolumeSliderValueChange:) forControlEvents:UIControlEventValueChanged];
|
||||
|
||||
}
|
||||
return _musicVolumeSlider;
|
||||
}
|
||||
|
||||
- (UILabel *)musicVoiceLabel {
|
||||
if (!_musicVoiceLabel) {
|
||||
_musicVoiceLabel = [[UILabel alloc] init];
|
||||
_musicVoiceLabel.font = [UIFont systemFontOfSize:13];
|
||||
_musicVoiceLabel.textColor = UIColorFromRGB(0x999999);
|
||||
_musicVoiceLabel.text = @"50%";
|
||||
}
|
||||
return _musicVoiceLabel;
|
||||
}
|
||||
|
||||
@end
|
@@ -0,0 +1,16 @@
|
||||
//
|
||||
// XPRoomMusicLibraryViewController.h
|
||||
// xplan-ios
|
||||
//
|
||||
// Created by 冯硕 on 2022/5/9.
|
||||
//
|
||||
|
||||
#import "MvpViewController.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface XPRoomMusicLibraryViewController : MvpViewController
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
@@ -0,0 +1,158 @@
|
||||
//
|
||||
// XPRoomMusicLibraryViewController.m
|
||||
// xplan-ios
|
||||
//
|
||||
// Created by 冯硕 on 2022/5/9.
|
||||
//
|
||||
|
||||
#import "XPRoomMusicLibraryViewController.h"
|
||||
///Third
|
||||
#import <Masonry/Masonry.h>
|
||||
///Tool
|
||||
#import "XPCoreDataManager.h"
|
||||
///View
|
||||
#import "XPRoomMusicLibraryTableViewCell.h"
|
||||
#import "XPRoomMusicLibraryEmptyTableViewCell.h"
|
||||
#import "XPMusicLibraryPlayView.h"
|
||||
#import "XPRoomMusicVoiceSettingView.h"
|
||||
#import "XPRoomTransferMusicViewController.h"
|
||||
|
||||
@interface XPRoomMusicLibraryViewController ()<UITableViewDelegate, UITableViewDataSource, NSFetchedResultsControllerDelegate, XPRoomMusicLibraryEmptyTableViewCellDelegate, XPMusicLibraryPlayViewDelegate, XPRoomMusicVoiceSettingViewDelegate>
|
||||
///列表
|
||||
@property (nonatomic,strong) UITableView *tableView;
|
||||
///底部播放器
|
||||
@property (nonatomic,strong) XPMusicLibraryPlayView *playView;
|
||||
///设置声音
|
||||
@property (nonatomic,strong) XPRoomMusicVoiceSettingView *voiceSettingView;
|
||||
@property(nonatomic,strong)NSFetchedResultsController *fetchedResultController;
|
||||
///数据源
|
||||
@property (nonatomic,strong) NSArray *datasource;
|
||||
@end
|
||||
|
||||
@implementation XPRoomMusicLibraryViewController
|
||||
|
||||
-(NSFetchedResultsController *)fetchedResultController{
|
||||
if (!_fetchedResultController) {
|
||||
NSFetchRequest *request = [[NSFetchRequest alloc]initWithEntityName:@"Music"];
|
||||
NSSortDescriptor *sort = [NSSortDescriptor sortDescriptorWithKey:@"musicId" ascending:true];
|
||||
request.sortDescriptors = @[sort];
|
||||
_fetchedResultController = [[NSFetchedResultsController alloc]initWithFetchRequest:request managedObjectContext:[XPCoreDataManager shareInstance].managedObjectContext sectionNameKeyPath:nil cacheName:nil];
|
||||
_fetchedResultController.delegate = self;
|
||||
[_fetchedResultController performFetch:nil];
|
||||
}
|
||||
return _fetchedResultController;
|
||||
}
|
||||
|
||||
- (void)viewDidLoad {
|
||||
[super viewDidLoad];
|
||||
self.title = @"我的乐库";
|
||||
self.datasource = self.fetchedResultController.fetchedObjects;
|
||||
[self initSubViews];
|
||||
[self initSubViewConstraints];
|
||||
}
|
||||
|
||||
#pragma mark - Private Method
|
||||
- (void)initSubViews {
|
||||
[self addNavigationItemWithImageNames:@[@"room_music_library_nav_add"] isLeft:NO target:self action:@selector(addMusicAction:) tags:nil];
|
||||
[self.view addSubview:self.tableView];
|
||||
[self.view addSubview:self.playView];
|
||||
[self.view addSubview:self.voiceSettingView];
|
||||
}
|
||||
|
||||
- (void)initSubViewConstraints {
|
||||
[self.tableView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.top.right.mas_equalTo(self.view);
|
||||
make.bottom.mas_equalTo(self.playView.mas_top);
|
||||
}];
|
||||
|
||||
[self.playView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.height.mas_equalTo(55);
|
||||
make.bottom.left.right.mas_equalTo(self.view);
|
||||
}];
|
||||
|
||||
[self.voiceSettingView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.bottom.mas_equalTo(self.playView.mas_top);
|
||||
make.left.right.mas_equalTo(self.view);
|
||||
}];
|
||||
}
|
||||
#pragma mark - UITableViewDelegate And UITableViewDataSource
|
||||
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
|
||||
return 1;
|
||||
}
|
||||
|
||||
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
|
||||
return self.datasource.count > 0 ? self.datasource.count : 1;
|
||||
}
|
||||
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
|
||||
if (self.datasource.count > 0) {
|
||||
XPRoomMusicLibraryTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([XPRoomMusicLibraryTableViewCell class])];
|
||||
cell.musicInfo = [self.datasource objectAtIndex:indexPath.row];
|
||||
return cell;
|
||||
}
|
||||
|
||||
XPRoomMusicLibraryEmptyTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([XPRoomMusicLibraryEmptyTableViewCell class])];
|
||||
cell.delegate = self;
|
||||
return cell;
|
||||
}
|
||||
|
||||
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
|
||||
return self.datasource.count > 0 ? 60 : 500;
|
||||
}
|
||||
|
||||
#pragma mark - XPRoomMusicLibraryEmptyTableViewCellDelegate
|
||||
- (void)xPRoomMusicLibraryEmptyTableViewCell:(XPRoomMusicLibraryEmptyTableViewCell *)cell didClickAdd:(UIButton *)sender {
|
||||
XPRoomTransferMusicViewController * transferVC = [[XPRoomTransferMusicViewController alloc] init];
|
||||
[self.navigationController pushViewController:transferVC animated:YES];
|
||||
}
|
||||
#pragma mark - XPMusicLibraryPlayViewDelegate
|
||||
- (void)xPMusicLibraryPlayView:(XPMusicLibraryPlayView *)view didClickVoiceSetting:(UIButton *)sender {
|
||||
self.voiceSettingView.hidden = !sender.selected;
|
||||
}
|
||||
|
||||
#pragma mark - XPRoomMusicVoiceSettingViewDelegate
|
||||
- (void)xPRoomMusicVoiceSettingView:(XPRoomMusicVoiceSettingView *)view didSliderValueChange:(UISlider *)slider {
|
||||
|
||||
}
|
||||
|
||||
#pragma mark - Event Response
|
||||
- (void)addMusicAction:(UIButton *)sender {
|
||||
XPRoomTransferMusicViewController * transferVC = [[XPRoomTransferMusicViewController alloc] init];
|
||||
[self.navigationController pushViewController:transferVC animated:YES];
|
||||
}
|
||||
|
||||
#pragma mark - Getters And Setters
|
||||
- (UITableView *)tableView {
|
||||
if (!_tableView) {
|
||||
_tableView = [[UITableView alloc] initWithFrame:CGRectZero style:UITableViewStylePlain];
|
||||
_tableView.delegate = self;
|
||||
_tableView.dataSource = self;
|
||||
_tableView.tableFooterView = [UIView new];
|
||||
_tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
|
||||
_tableView.backgroundColor = [UIColor clearColor];
|
||||
if (@available(iOS 11.0, *)) {
|
||||
_tableView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
|
||||
}
|
||||
[_tableView registerClass:[XPRoomMusicLibraryTableViewCell class] forCellReuseIdentifier:NSStringFromClass([XPRoomMusicLibraryTableViewCell class])];
|
||||
[_tableView registerClass:[XPRoomMusicLibraryEmptyTableViewCell class] forCellReuseIdentifier:NSStringFromClass([XPRoomMusicLibraryEmptyTableViewCell class])];
|
||||
}
|
||||
return _tableView;
|
||||
}
|
||||
|
||||
- (XPMusicLibraryPlayView *)playView {
|
||||
if (!_playView) {
|
||||
_playView = [[XPMusicLibraryPlayView alloc] init];
|
||||
_playView.delegate = self;
|
||||
}
|
||||
return _playView;
|
||||
}
|
||||
|
||||
- (XPRoomMusicVoiceSettingView *)voiceSettingView {
|
||||
if (!_voiceSettingView) {
|
||||
_voiceSettingView = [[XPRoomMusicVoiceSettingView alloc] init];
|
||||
_voiceSettingView.delegate = self;
|
||||
_voiceSettingView.hidden = YES;
|
||||
}
|
||||
return _voiceSettingView;
|
||||
}
|
||||
|
||||
@end
|
@@ -17,7 +17,10 @@
|
||||
#import "HTTPServer.h"
|
||||
#import "MyHTTPConnection.h"
|
||||
#import "SJXCSMIPHelper.h"
|
||||
|
||||
#import "XPCoreDataManager.h"
|
||||
#import "GCDHelper.h"
|
||||
///Model
|
||||
#import "Music+CoreDataClass.h"
|
||||
@interface XPRoomTransferMusicViewController ()<MyHTTPConnectionDelegate>
|
||||
///容器
|
||||
@property (nonatomic,strong) UIStackView *stackView;
|
||||
@@ -41,13 +44,18 @@
|
||||
@property (nonatomic,strong) UIButton *saveButton;
|
||||
@property (nonatomic,strong) HTTPServer *httpServer;
|
||||
@property (strong, nonatomic) NSString *ipAddress;
|
||||
///歌曲的个数
|
||||
@property (nonatomic,assign) NSInteger numberSong;
|
||||
@end
|
||||
|
||||
@implementation XPRoomTransferMusicViewController
|
||||
|
||||
- (void)dealloc {
|
||||
NSLog(@"aaaa");
|
||||
}
|
||||
|
||||
- (void)viewDidLoad {
|
||||
[super viewDidLoad];
|
||||
[self getData];
|
||||
[self connectHttpServer];
|
||||
[self monitorNet];
|
||||
[self initSubViews];
|
||||
@@ -56,25 +64,9 @@
|
||||
|
||||
|
||||
#pragma mark - Private Method
|
||||
- (void)getData {
|
||||
NSString* uploadDirPath =[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) lastObject];
|
||||
uploadDirPath = [NSString stringWithFormat:@"%@/music",uploadDirPath];
|
||||
NSFileManager * fm = [NSFileManager defaultManager];
|
||||
NSArray *arr = [fm contentsOfDirectoryAtPath:uploadDirPath error:nil];
|
||||
for (int i = 0; i < arr.count; i++) {
|
||||
NSString * name = [arr objectAtIndex:i];
|
||||
NSString * filePath = [NSString stringWithFormat:@"%@/%@", uploadDirPath, name];
|
||||
AVURLAsset *mp3Asset = [AVURLAsset URLAssetWithURL:[NSURL fileURLWithPath:filePath] options:nil];
|
||||
NSArray<AVMetadataItem *> *titles = [AVMetadataItem metadataItemsFromArray:mp3Asset.commonMetadata withKey:AVMetadataCommonKeyTitle keySpace:AVMetadataKeySpaceCommon];
|
||||
NSMutableArray<AVMetadataItem *> *artists = [[AVMetadataItem metadataItemsFromArray:mp3Asset.commonMetadata withKey:AVMetadataCommonKeyArtist keySpace:AVMetadataKeySpaceCommon] mutableCopy];
|
||||
NSArray<AVMetadataItem *> *albumNames = [AVMetadataItem metadataItemsFromArray:mp3Asset.commonMetadata withKey:AVMetadataCommonKeyAlbumName keySpace:AVMetadataKeySpaceCommon];
|
||||
NSLog(@"标题%@ 内容%@ 相册%@", titles.firstObject.value, artists.firstObject.value, albumNames.firstObject.value);
|
||||
}
|
||||
NSLog(@"%@",arr);
|
||||
}
|
||||
|
||||
- (void)initSubViews {
|
||||
self.title = @"歌曲传输";
|
||||
self.numberSong = 0;
|
||||
[self.view addSubview:self.stackView];
|
||||
[self.stackView addArrangedSubview:self.wifiView];
|
||||
[self.stackView addArrangedSubview:self.ipLabel];
|
||||
@@ -152,8 +144,9 @@
|
||||
}
|
||||
self.ipLabel.text = self.ipAddress;
|
||||
}
|
||||
|
||||
@kWeakify(self);
|
||||
[[AFNetworkReachabilityManager sharedManager] setReachabilityStatusChangeBlock:^(AFNetworkReachabilityStatus status) {
|
||||
@kStrongify(self);
|
||||
switch (status) {
|
||||
case AFNetworkReachabilityStatusNotReachable:
|
||||
{
|
||||
@@ -204,14 +197,48 @@
|
||||
|
||||
- (void)onHttpFileTranSportServer:(MyHTTPConnection *)server successWithPath:(NSString *)filePath {
|
||||
AVURLAsset *mp3Asset = [AVURLAsset URLAssetWithURL:[NSURL fileURLWithPath:filePath] options:nil];
|
||||
NSString *singer;//歌手
|
||||
NSString *song;//歌曲名
|
||||
UIImage *image;//图片
|
||||
NSString *albumName;//专辑名
|
||||
NSArray *titles = [AVMetadataItem metadataItemsFromArray:mp3Asset.commonMetadata withKey:AVMetadataCommonKeyTitle keySpace:AVMetadataKeySpaceCommon];
|
||||
NSMutableArray *artists = [[AVMetadataItem metadataItemsFromArray:mp3Asset.commonMetadata withKey:AVMetadataCommonKeyArtist keySpace:AVMetadataKeySpaceCommon] mutableCopy];
|
||||
NSArray *albumNames = [AVMetadataItem metadataItemsFromArray:mp3Asset.commonMetadata withKey:AVMetadataCommonKeyAlbumName keySpace:AVMetadataKeySpaceCommon];
|
||||
NSLog(@"歌手:%@ 歌曲名:%@, 专辑图片%@, 专辑名称%@", singer, song, image,albumName);
|
||||
if (mp3Asset) {
|
||||
NSString * songName;///歌曲
|
||||
NSString *singer;//歌手
|
||||
UIImage *image;//图片
|
||||
NSMutableArray *artists = [[AVMetadataItem metadataItemsFromArray:mp3Asset.commonMetadata withKey:AVMetadataCommonKeyArtist keySpace:AVMetadataKeySpaceCommon] mutableCopy];
|
||||
NSArray *albumNames = [AVMetadataItem metadataItemsFromArray:mp3Asset.commonMetadata withKey:AVMetadataCommonKeyArtwork keySpace:AVMetadataKeySpaceCommon];
|
||||
NSArray *titles = [AVMetadataItem metadataItemsFromArray:mp3Asset.commonMetadata withKey:AVMetadataCommonKeyTitle keySpace:AVMetadataKeySpaceCommon];
|
||||
if (artists.count > 0) {
|
||||
AVMetadataItem *artist = [artists objectAtIndex:0];
|
||||
singer = [artist.value copyWithZone:nil];
|
||||
}else{
|
||||
singer = @"未知歌手";
|
||||
}
|
||||
|
||||
if (albumNames.count > 0) {
|
||||
AVMetadataItem *artist = [albumNames objectAtIndex:0];
|
||||
image = [UIImage imageWithData:[artist.value copyWithZone:nil]];
|
||||
}else{
|
||||
image = [UIImage imageNamed:@"common_avatar"];
|
||||
}
|
||||
|
||||
if (titles.count > 0) {
|
||||
AVMetadataItem *artist = [titles objectAtIndex:0];
|
||||
songName = [artist.value copyWithZone:nil];
|
||||
}else{
|
||||
songName = @"未知";
|
||||
}
|
||||
|
||||
NSUUID * uuid = [UIDevice currentDevice].identifierForVendor;
|
||||
NSString * musicId = [uuid.UUIDString stringByAppendingString:songName];
|
||||
Music * currentMusic = [NSEntityDescription insertNewObjectForEntityForName:@"Music" inManagedObjectContext:[XPCoreDataManager shareInstance].managedObjectContext];
|
||||
currentMusic.filePath = filePath;
|
||||
currentMusic.author = singer;
|
||||
currentMusic.musicId = musicId;
|
||||
currentMusic.songName = songName;
|
||||
currentMusic.songAlbum = UIImageJPEGRepresentation(image, 1);
|
||||
[[XPCoreDataManager shareInstance] save];
|
||||
dispatch_main_sync_safe(^{
|
||||
self.numberSong++;
|
||||
[self.musiceCountButton setTitle:[NSString stringWithFormat:@"已导入%ld首歌曲", self.numberSong] forState:UIControlStateNormal];
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
- (BOOL)onHttpFileDataEstimateDuplicateCanPassTranSportServer:(MyHTTPConnection *)server withPath:(NSString *)filePath andFileName:(NSString *)fileName {
|
||||
|
@@ -62,6 +62,7 @@
|
||||
#import "XPMineUserInfoViewController.h"
|
||||
#import "XPRoomRankEntranceView.h"
|
||||
#import "XPRoomAnchorRankEnterView.h"
|
||||
#import "XPRoomBackMusicPlayerView.h"
|
||||
///个播PK
|
||||
#import "XPAnchorFansTeamEntranceView.h"
|
||||
#import "XPAnchorFansTeamViewController.h"
|
||||
@@ -104,7 +105,10 @@
|
||||
@property (nonatomic, strong) NSMutableArray *trumpetQueue;
|
||||
///小喇叭动画定时器
|
||||
@property (nonatomic, strong) dispatch_source_t trumpetTimer;
|
||||
|
||||
///播放器的入口
|
||||
@property (nonatomic,strong) UIButton *musicEnterButton;
|
||||
///播放器
|
||||
@property (nonatomic,strong) XPRoomBackMusicPlayerView *musicPlayView;
|
||||
@end
|
||||
|
||||
@implementation XPRoomFunctionContainerView
|
||||
@@ -136,6 +140,26 @@
|
||||
return [subView hitTest:convertPoint withEvent:event];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
for (NSInteger i = (self.subviews.count - 1) ; i >= 0 ; i--) {
|
||||
UIView * subView = [self.subviews objectAtIndex:i];
|
||||
if (self.musicPlayView.superview && self.musicEnterButton.hidden == YES && ![subView isEqual:self.musicPlayView]) {
|
||||
[UIView animateWithDuration:0.2 animations:^{
|
||||
self.musicEnterButton.hidden = NO;
|
||||
} completion:nil];
|
||||
|
||||
POPBasicAnimation *moveAnimation = [POPBasicAnimation animationWithPropertyNamed:kPOPViewCenter];
|
||||
moveAnimation.fromValue = [NSValue valueWithCGPoint:self.musicPlayView.center];
|
||||
moveAnimation.toValue = [NSValue valueWithCGPoint:CGPointMake(-KScreenWidth, self.musicPlayView.center.y)];
|
||||
moveAnimation.beginTime = CACurrentMediaTime();
|
||||
moveAnimation.duration = 0.5;
|
||||
moveAnimation.repeatCount = 1;
|
||||
moveAnimation.removedOnCompletion = YES;
|
||||
[self.musicPlayView pop_addAnimation:moveAnimation forKey:@"moveOutAnimation"];
|
||||
break;
|
||||
}
|
||||
}
|
||||
return nil;
|
||||
}
|
||||
|
||||
@@ -648,6 +672,28 @@
|
||||
if (self.delegate.getRoomInfo.type == RoomType_MiniGame) {
|
||||
[self.littleGameMiniView needRefreshPosition:queue];
|
||||
}
|
||||
MicroQueueModel * currentUserModel;
|
||||
NSString * uid = [AccountInfoStorage instance].getUid;
|
||||
for (MicroQueueModel * microModel in queue.allValues) {
|
||||
if (microModel.userInfo && microModel.userInfo.uid == uid.integerValue) {
|
||||
currentUserModel = microModel;
|
||||
}
|
||||
}
|
||||
if (currentUserModel) {
|
||||
if (!self.musicEnterButton.superview) {
|
||||
[self addSubview:self.musicEnterButton];
|
||||
[self.musicEnterButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.right.mas_equalTo(0).offset(8);
|
||||
make.top.mas_equalTo(kNavigationHeight+4);
|
||||
make.width.mas_equalTo(79);
|
||||
make.height.mas_equalTo(22);
|
||||
}];
|
||||
}
|
||||
} else {
|
||||
if (self.musicEnterButton) {
|
||||
[self.musicEnterButton removeFromSuperview];
|
||||
}
|
||||
}
|
||||
}
|
||||
#pragma mark - XPAcrpssRoomPKPanelViewDelegate
|
||||
- (void)xPAcrpssRoomPKPanelView:(XPAcrpssRoomPKPanelView *)view onlookRoom:(NSString *)roomUid {
|
||||
@@ -837,6 +883,26 @@
|
||||
}
|
||||
}
|
||||
|
||||
- (void)musicEnterButtonAction:(UIButton *)sender {
|
||||
if (!self.musicPlayView.superview) {
|
||||
[self addSubview:self.musicPlayView];
|
||||
self.musicPlayView.frame = CGRectMake(-KScreenWidth, kNavigationHeight + 4, KScreenWidth - 85, 80);
|
||||
}
|
||||
|
||||
POPBasicAnimation *moveAnimation = [POPBasicAnimation animationWithPropertyNamed:kPOPViewCenter];
|
||||
moveAnimation.fromValue = [NSValue valueWithCGPoint:CGPointMake(-KScreenWidth, self.musicPlayView.center.y)];
|
||||
moveAnimation.toValue = [NSValue valueWithCGPoint:CGPointMake(KScreenWidth/ 2, self.musicPlayView.center.y)];
|
||||
moveAnimation.beginTime = CACurrentMediaTime();
|
||||
moveAnimation.duration = 0.5;
|
||||
moveAnimation.repeatCount = 1;
|
||||
moveAnimation.removedOnCompletion = YES;
|
||||
[self.musicPlayView pop_addAnimation:moveAnimation forKey:@"moveOutAnimation"];
|
||||
|
||||
[UIView animateWithDuration:0.2 animations:^{
|
||||
self.musicEnterButton.hidden = YES;
|
||||
} completion:nil];
|
||||
}
|
||||
|
||||
#pragma mark - 房间话题
|
||||
- (void)updateRoomTopicViewConstraint {
|
||||
RoomInfoModel * roomInfo = self.delegate.getRoomInfo;
|
||||
@@ -1306,4 +1372,27 @@
|
||||
return _trumpetQueue;
|
||||
}
|
||||
|
||||
- (UIButton *)musicEnterButton {
|
||||
if (!_musicEnterButton) {
|
||||
_musicEnterButton = [UIButton buttonWithType:UIButtonTypeCustom];
|
||||
[_musicEnterButton setTitle:@"播放音乐" forState:UIControlStateNormal];
|
||||
[_musicEnterButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
|
||||
_musicEnterButton.titleLabel.font = [UIFont systemFontOfSize:10];
|
||||
[_musicEnterButton setImage:[UIImage imageNamed:@"room_music_player_enter"] forState:UIControlStateNormal];
|
||||
_musicEnterButton.layer.masksToBounds = YES;
|
||||
_musicEnterButton.layer.cornerRadius = 11;
|
||||
_musicEnterButton.imageEdgeInsets = UIEdgeInsetsMake(0, -15, 0, 0);
|
||||
_musicEnterButton.backgroundColor = UIColorRGBAlpha(0xffffff, 0.2);
|
||||
[_musicEnterButton addTarget:self action:@selector(musicEnterButtonAction:) forControlEvents:UIControlEventTouchUpInside];
|
||||
}
|
||||
return _musicEnterButton;
|
||||
}
|
||||
|
||||
- (XPRoomBackMusicPlayerView *)musicPlayView {
|
||||
if (!_musicPlayView) {
|
||||
_musicPlayView = [[XPRoomBackMusicPlayerView alloc] init];
|
||||
}
|
||||
return _musicPlayView;
|
||||
}
|
||||
|
||||
@end
|
||||
|
@@ -42,7 +42,6 @@
|
||||
#import "XPTeenagerAlertView.h"
|
||||
#import "XPRoomViewController.h"
|
||||
#import "XPNobleUpgradeLevelView.h"
|
||||
#import "XPRoomTransferMusicViewController.h"
|
||||
///Present
|
||||
#import "MainPresenter.h"
|
||||
#import "MainProtocol.h"
|
||||
@@ -209,15 +208,14 @@
|
||||
|
||||
- (void)initTabs:(BOOL)logined {
|
||||
self.viewControllers = nil;
|
||||
NSArray *normalImageNames = @[@"tab_gameHome_normal",@"tab_game_normal",@"tab_message_normal", @"tab_mine_normal", @"tab_mine_normal"];
|
||||
NSArray *selectImageNames = @[@"tab_gameHome_selected",@"tab_game_selected",@"tab_message_selected", @"tab_mine_selected", @"tab_mine_selected"];
|
||||
NSArray *tabLabel = @[@"派对",@"赛事",@"消息", @"我的", @"歌曲"];
|
||||
NSArray *normalImageNames = @[@"tab_gameHome_normal",@"tab_game_normal",@"tab_message_normal", @"tab_mine_normal"];
|
||||
NSArray *selectImageNames = @[@"tab_gameHome_selected",@"tab_game_selected",@"tab_message_selected", @"tab_mine_selected"];
|
||||
NSArray *tabLabel = @[@"派对",@"赛事",@"消息", @"我的"];
|
||||
|
||||
UIViewController *game;
|
||||
UIViewController *msg;
|
||||
UIViewController *me;
|
||||
UIViewController * home;
|
||||
UIViewController * music;
|
||||
if (logined) {
|
||||
XplanFBFlutterViewContainer *fvcGame = XplanFBFlutterViewContainer.new;
|
||||
#ifdef DEBUG
|
||||
@@ -230,20 +228,17 @@
|
||||
me = [[XPMineViewController alloc] init];
|
||||
|
||||
home = [[XPHomeViewController alloc] init];
|
||||
music = [[XPRoomTransferMusicViewController alloc] init];
|
||||
} else {
|
||||
game = [[BaseViewController alloc]init];
|
||||
msg = [[SessionListViewController alloc]init];
|
||||
me = [[BaseViewController alloc]init];
|
||||
home = [[BaseViewController alloc] init];
|
||||
music = [[BaseViewController alloc] init];
|
||||
}
|
||||
[self createTabBarItem:home title:tabLabel[0] image:normalImageNames[0] selectedImage:selectImageNames[0]];
|
||||
[self createTabBarItem:game title:tabLabel[1] image:normalImageNames[1] selectedImage:selectImageNames[1]];
|
||||
[self createTabBarItem:msg title:tabLabel[2] image:normalImageNames[2] selectedImage:selectImageNames[2]];
|
||||
[self createTabBarItem:me title:tabLabel[3] image:normalImageNames[3] selectedImage:selectImageNames[3]];
|
||||
[self createTabBarItem:music title:tabLabel[4] image:normalImageNames[4] selectedImage:selectImageNames[4]];
|
||||
self.viewControllers = @[home,game,msg,me, music];
|
||||
self.viewControllers = @[home,game,msg,me];
|
||||
self.selectedIndex = 0;
|
||||
}
|
||||
|
||||
|