Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CTVideoManager中的downloadWithUrl方法并没能保存文件到本地 #4

Closed
jianzhi2010 opened this issue Jun 4, 2016 · 1 comment

Comments

@jianzhi2010
Copy link

在CTVideoManager.m文件中的downloadWithUrl:方法

- (void)downloadWithUrl:(NSURL *)url
{
    if (self.downloadStrategy == CTVideoViewDownloadStrategyNoDownload) {
        return;
    }

    NSURL *nativeUrl = [self.dataCenter nativeUrlWithRemoteUrl:url];
    if (nativeUrl == nil) {
        NSString *fileName = [NSString stringWithFormat:@"%@.mp4", [NSUUID UUID].UUIDString];
        //nativeUrl使用有误:
        nativeUrl = [NSURL URLWithString:[[NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES) firstObject] stringByAppendingPathComponent:fileName]];
    }
    [self.dataCenter updateWithRemoteUrl:url nativeUrl:nativeUrl status:CTVideoRecordStatusWaitingForDownload];
    NSURLRequest *request = [NSURLRequest requestWithURL:url];
    ........

这里的nativeUrl使用了[NSURL URLWithString:]方法获取,会导致下载的临时文件无法正确地移动到nativeUrl的对应地址,应使用[NSURL fileURLWithPath:]方法吧。。。

@casatwy
Copy link
Owner

casatwy commented Jun 4, 2016

改好了,已发布1.0.6。多谢提醒~

@casatwy casatwy closed this as completed Jun 4, 2016
@hoowang hoowang mentioned this issue Mar 10, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants