解决了语音上传到问题,接下来要解决下载播放问题

This commit is contained in:
joywayer
2025-06-15 12:36:47 +08:00
parent bba3ed1cb4
commit c11fc62bf1
513 changed files with 31197 additions and 2969 deletions

115
Pods/Qiniu/QiniuSDK/Storage/QNUploadInfo.m generated Normal file
View File

@@ -0,0 +1,115 @@
//
// QNUploadInfo.m
// QiniuSDK
//
// Created by yangsen on 2021/5/10.
// Copyright © 2021 Qiniu. All rights reserved.
//
#import "QNErrorCode.h"
#import "QNUploadInfo.h"
@interface QNUploadInfo()
@property(nonatomic, copy)NSString *sourceId;
@property(nonatomic, assign)long long sourceSize;
@property(nonatomic, copy)NSString *fileName;
@property(nonatomic, strong)id <QNUploadSource> source;
@end
@implementation QNUploadInfo
+ (instancetype)info:(id <QNUploadSource>)source {
QNUploadInfo *info = [[self alloc] init];
info.source = source;
info.sourceSize = [source getSize];
info.fileName = [source getFileName];
return info;
}
- (void)setInfoFromDictionary:(NSDictionary *)dictionary {
self.sourceSize = [dictionary[@"sourceSize"] longValue];
self.sourceId = dictionary[@"sourceId"];
}
- (NSDictionary *)toDictionary {
return @{@"sourceSize" : @([self getSourceSize]),
@"sourceId" : self.sourceId ?: @""};
}
- (BOOL)hasValidResource {
return self.source != nil;
}
- (BOOL)isValid {
return [self hasValidResource];
}
- (BOOL)couldReloadSource {
return [self.source couldReloadSource];
}
- (BOOL)reloadSource {
return [self.source reloadSource];
}
- (NSString *)getSourceId {
return [self.source getId];
}
- (long long)getSourceSize {
return [self.source getSize];
}
- (BOOL)isSameUploadInfo:(QNUploadInfo *)info {
if (info == nil || ((self.sourceId.length > 0 || info.sourceId.length > 0) && ![self.sourceId isEqualToString:info.sourceId])) {
return false;
}
//
if (info.sourceSize > kQNUnknownSourceSize &&
self.sourceSize > kQNUnknownSourceSize &&
info.sourceSize != self.sourceSize) {
return false;
}
return true;
}
- (long long)uploadSize {
return 0;
}
- (BOOL)isAllUploaded {
return true;
}
- (void)clearUploadState {
}
- (void)checkInfoStateAndUpdate {
}
- (NSData *)readData:(NSInteger)dataSize dataOffset:(long long)dataOffset error:(NSError **)error {
if (!self.source) {
*error = [NSError errorWithDomain:NSStreamSOCKSErrorDomain code:kQNLocalIOError userInfo:@{NSLocalizedDescriptionKey : @"file is not exist"}];
return nil;
}
NSData *data = nil;
@synchronized (self.source) {
data = [self.source readData:dataSize dataOffset:dataOffset error:error];
}
if (*error == nil && data != nil && (data.length == 0 || data.length != dataSize)) {
self.sourceSize = data.length + dataOffset;
}
return data;
}
- (void)close {
[self.source close];
}
@end