修复了声音秀每次进入不同的人播放的是第一个人的声音秀
This commit is contained in:
@@ -17,7 +17,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
@property (nonatomic,copy) NSString *icon;
|
@property (nonatomic,copy) NSString *icon;
|
||||||
///技能
|
///技能
|
||||||
@property (nonatomic,copy) NSArray *propVals;
|
@property (nonatomic,copy) NSArray *propVals;
|
||||||
///
|
///名字
|
||||||
@property (nonatomic,copy) NSString *name;
|
@property (nonatomic,copy) NSString *name;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
@@ -56,6 +56,7 @@
|
|||||||
[self.player stop];
|
[self.player stop];
|
||||||
self.player = nil;
|
self.player = nil;
|
||||||
}
|
}
|
||||||
|
NSLog(@"播放动画的路径:%@", filePath);
|
||||||
if (![[NSFileManager defaultManager] fileExistsAtPath:filePath]) return;
|
if (![[NSFileManager defaultManager] fileExistsAtPath:filePath]) return;
|
||||||
NSURL *url = [NSURL fileURLWithPath:filePath];
|
NSURL *url = [NSURL fileURLWithPath:filePath];
|
||||||
NSError *AVerror = NULL;
|
NSError *AVerror = NULL;
|
||||||
|
@@ -116,6 +116,7 @@ XPSkillCardListCellDelegate
|
|||||||
- (void)onDeleteSkillCardSuccess {
|
- (void)onDeleteSkillCardSuccess {
|
||||||
[self showErrorToast:@"删除成功"];
|
[self showErrorToast:@"删除成功"];
|
||||||
[self.presenter getSkillCardInfoWithUid:[NSString stringWithFormat:@"%zd", self.uid]];
|
[self.presenter getSkillCardInfoWithUid:[NSString stringWithFormat:@"%zd", self.uid]];
|
||||||
|
[[XPSkillCardPlayerManager shareInstance] stopMusic];
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma mark - XPSkillCardTypeViewDelegate
|
#pragma mark - XPSkillCardTypeViewDelegate
|
||||||
@@ -282,7 +283,7 @@ XPSkillCardListCellDelegate
|
|||||||
return [NSURL fileURLWithPath:filePath];
|
return [NSURL fileURLWithPath:filePath];
|
||||||
} completionHandler:^(NSURLResponse * _Nonnull response, NSURL * _Nullable filePath, NSError * _Nullable error) {
|
} completionHandler:^(NSURLResponse * _Nonnull response, NSURL * _Nullable filePath, NSError * _Nullable error) {
|
||||||
if (!error) {
|
if (!error) {
|
||||||
completion(YES, filePath.absoluteString);
|
completion(YES, filePath.path);
|
||||||
} else {
|
} else {
|
||||||
completion(NO, nil);
|
completion(NO, nil);
|
||||||
}
|
}
|
||||||
|
@@ -74,10 +74,17 @@
|
|||||||
sender.selected = !sender.selected;
|
sender.selected = !sender.selected;
|
||||||
if (!self.isPlaying) {
|
if (!self.isPlaying) {
|
||||||
if(self.voiceInfo.propVals.count) {
|
if(self.voiceInfo.propVals.count) {
|
||||||
NSString *fileName = [[self.voiceInfo.name componentsSeparatedByString:@"/"] lastObject];
|
// NSString *fileName = [[self.voiceInfo.name componentsSeparatedByString:@"/"] lastObject];
|
||||||
NSString * url = [self.voiceInfo.propVals objectAtIndex:0];
|
NSString * url = [self.voiceInfo.propVals objectAtIndex:0];
|
||||||
|
NSArray * nameArray = [url componentsSeparatedByString:@"/"];
|
||||||
|
NSString * fileName = @"daeplay";
|
||||||
|
if (nameArray.count > 0) {
|
||||||
|
fileName = nameArray.lastObject;
|
||||||
|
}
|
||||||
|
|
||||||
NSString *filePath = [[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0] stringByAppendingPathComponent:@"mineSkillCardVoice"];
|
NSString *filePath = [[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0] stringByAppendingPathComponent:@"mineSkillCardVoice"];
|
||||||
NSString *fullPath = [filePath stringByAppendingPathComponent:fileName];
|
NSString *fullPath = [filePath stringByAppendingPathComponent:fileName];
|
||||||
|
NSLog(@"下载的路径:%@", fullPath);
|
||||||
if ([[NSFileManager defaultManager] fileExistsAtPath:fullPath]) {
|
if ([[NSFileManager defaultManager] fileExistsAtPath:fullPath]) {
|
||||||
self.isPlaying = YES;
|
self.isPlaying = YES;
|
||||||
sender.selected = YES;
|
sender.selected = YES;
|
||||||
@@ -90,9 +97,11 @@
|
|||||||
[[XPSkillCardPlayerManager shareInstance] stopMusic];
|
[[XPSkillCardPlayerManager shareInstance] stopMusic];
|
||||||
}];
|
}];
|
||||||
} else {
|
} else {
|
||||||
if (![[NSFileManager defaultManager] fileExistsAtPath:filePath]) {
|
if (![[NSFileManager defaultManager] fileExistsAtPath:fullPath]) {
|
||||||
NSFileManager *fileMgr = [[NSFileManager alloc] init];
|
NSFileManager *fileMgr = [[NSFileManager alloc] init];
|
||||||
[fileMgr createDirectoryAtPath:filePath withIntermediateDirectories:YES attributes:nil error:nil];
|
NSError * error;
|
||||||
|
[fileMgr createDirectoryAtPath:filePath withIntermediateDirectories:YES attributes:nil error:&error];
|
||||||
|
NSLog(@"%@", error.description);
|
||||||
}
|
}
|
||||||
[self downloadAudioWithFileName:fileName musicUrl:url completion:^(BOOL isSuccess, NSString *editAudioPath) {
|
[self downloadAudioWithFileName:fileName musicUrl:url completion:^(BOOL isSuccess, NSString *editAudioPath) {
|
||||||
self.isPlaying = YES;
|
self.isPlaying = YES;
|
||||||
@@ -126,7 +135,7 @@
|
|||||||
return [NSURL fileURLWithPath:filePath];
|
return [NSURL fileURLWithPath:filePath];
|
||||||
} completionHandler:^(NSURLResponse * _Nonnull response, NSURL * _Nullable filePath, NSError * _Nullable error) {
|
} completionHandler:^(NSURLResponse * _Nonnull response, NSURL * _Nullable filePath, NSError * _Nullable error) {
|
||||||
if (!error) {
|
if (!error) {
|
||||||
completion(YES, filePath.absoluteString);
|
completion(YES, filePath.path);
|
||||||
} else {
|
} else {
|
||||||
completion(NO, nil);
|
completion(NO, nil);
|
||||||
}
|
}
|
||||||
|
@@ -298,7 +298,7 @@
|
|||||||
return [NSURL fileURLWithPath:filePath];
|
return [NSURL fileURLWithPath:filePath];
|
||||||
} completionHandler:^(NSURLResponse * _Nonnull response, NSURL * _Nullable filePath, NSError * _Nullable error) {
|
} completionHandler:^(NSURLResponse * _Nonnull response, NSURL * _Nullable filePath, NSError * _Nullable error) {
|
||||||
if (!error) {
|
if (!error) {
|
||||||
completion(YES, filePath.absoluteString);
|
completion(YES, filePath.path);
|
||||||
} else {
|
} else {
|
||||||
completion(NO, nil);
|
completion(NO, nil);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user