Firebase storage download file with progress does not fire “live” (Unity, C#)

巧了我就是萌 提交于 2019-12-24 20:08:33

问题


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);
        });
}

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

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!

Edit: 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.

Any help?


回答1:


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.



来源:https://stackoverflow.com/questions/49225307/firebase-storage-download-file-with-progress-does-not-fire-live-unity-c

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!