具有进度的Firebase存储下载文件不会触发“实时"更新. (Unity,C#) [英] Firebase storage download file with progress does not fire "live" (Unity, C#)

查看:159
本文介绍了具有进度的Firebase存储下载文件不会触发“实时"更新. (Unity,C#)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尝试从Firebase存储下载文件. 效果很好,但是我的进度没有实时"更新. 当我调试并记录进度时,所有调试消息将在下载完成时(而不是在下载进行时)打印在控制台中.
在工作中,我的互联网连接更好,看起来好像可以正常工作,但在家里却有这种奇怪的行为.

Trying to download a file from firebase storage. Works very good but my progress does not get updated "live". When I Debug.Log my progress, all the debug messages are printed in the console when the download is completed and not while the download is in progress.
At work, where my internet connection is way better, it looks as if it works as expected but at home I have this strange behaviour.

public void DownloadFile(string destination, string filename, StorageProgress<DownloadState> handleProgress, Action<Task> completionBlock)
{    
    CTRouter.MyContentReference(uid, cid)
        .Child(filename)
        .GetFileAsync(destination, handleProgress, CancellationToken.None)
        .ContinueWith(resultTask =>
        {
            completionBlock(resultTask);
        });
}

在我的handleProgress方法中,调试.记录进度并更新UI中的进度栏​​.

In my handleProgress method I Debug.Log the progress and update a progress bar in the UI.

是否存在线程问题?为什么只有良好的Internet连接才能更新进度条,而只有2 MBit Internet却不能更新进度条?它的下载,没有任何反应.下载完成后,我收到所有进度日志的垃圾邮件,并且进度条变为100%.

Is there a threading problem or something? Why the progress bar gets updated with good internet but not when there is only 2 MBit internet? its downloading and nothing happens. when download completes, I get spammed with all the progress logs and my progress bar goes to 100%.

任何帮助都会很棒. 谢谢!

Any help would be great. Thanks!

我尝试了 quickstart-unity存储库中的代码,并得到了同样的问题(DownloadFileAsync和DownloadStreamAsync),但是下载似乎冻结了UI和控制台,直到下载完成.完成后,我会收到所有进度更新消息的垃圾邮件. 因此,我认为统一Firebase SDK中存在错误吗? 我正在使用Unity 2017.3.1f1和最新的Firebase SDK. 还使用Unity 5.3.5进行了尝试,但无法正常工作.

I tried the code from the quickstart-unity repository and got the same problem (DownloadFileAsync and DownloadStreamAsync) but the download seems to freeze the UI and console until the download is completed. After it completes, I get spammed with all the progress update messages. So I think there is a bug in the unity firebase SDK? I'm using Unity 2017.3.1f1 and latest Firebase SDK. Also tried it with Unity 5.3.5 and it's not working.

有帮助吗?

推荐答案

我提交了一个错误报告,并要求支持人员提供帮助. 此行为确实是一个错误,并将在下一Firebase Unity SDK版本中修复.

I filed a bug report and asked the support for help. This behaviour is indeed a bug and will be fixed within the next Firebase Unity SDK release.

这篇关于具有进度的Firebase存储下载文件不会触发“实时"更新. (Unity,C#)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆