LiveSDK for Universal Windows App background upload

317 views Asked by At

I'm developing Universal Windows App and use Live SDK 5.6 to upload files to OneDrive. I see examples of usage here and instructions about versions here. According to instructions I should use:

For Windows and WP81: CreateBackgroundUploadAsync method;

For WP8 Silverlight: BackgroundUploadAsync method

CreateBackgroundUploadAsync works like a charm on Windows and returns correct progress values by LiveOperationProgress but on a WP81 it shows 0% progress all the time and at last it becames 100%. So it actually does not track progress.

Then I tried to use BackgroundUploadAsync(it is for Silverlight apps) and it works on phone - uploads file and tracks progress right. But when I tried to upload big file(in my case > 150Mb) I noted that exactly after 120 seconds upload operation just resets to 0% and starts again without any exceptions.

Here is code for Windows & WP81 approach:

var progressHandler = new Progress<LiveOperationProgress>(
                    (progress) =>
                    {
                        var res = progress.ProgressPercentage;
                    });
LiveUploadOperation uploadOperation = await liveConnectClient.CreateBackgroundUploadAsync(uploadPath, "testfile.wav", file, OverwriteOption.Rename);
LiveOperationResult uploadResult = await uploadOperation.StartAsync(new CancellationToken(), progressHandler);

And for Silverlight:

var progressHandler = new Progress<LiveOperationProgress>(
                    (progress) =>
                    {
                        var res = progress.ProgressPercentage;
                    });
LiveOperationResult opResult = await connectClient.BackgroundUploadAsync(CurrentFolderId,
                                                                      file.Name,
                                                                      stream,
                                                                      OverwriteOption.Rename,
                                                                      record.GetCTS().Token,
                                                                      progressHandler);

So question - how to make it upload files of any size, redefine timeout(currently 120s) and track progress on both Windows and WP81?

UPD: I found the reason of 2 mins timeout here:

After the connection has been established, an HTTP request message that has not received a response within two minutes is aborted.

Is it normal for PUT request?

0

There are 0 answers