void UploadCallback(Uptred.VerifyFeedback feedback)
        {
            this.RunOnUiThread(() =>
            {
                //Crashes if is not on main thread
                updatePercentage (feedback.LastByte, feedback.ContentSize);
                if (Settings.YouTubeInfo.LastByte >= feedback.LastByte)
                {
                    Console.WriteLine(string.Format("No bytes uploaded. Retries: {0}", _retries));
                    _retries++;
                    if (_retries > 3)
                    {
                        try
                        {
                            var url = Settings.YouTubeHook.GetUploadSessionUrl(Settings.YouTubeInfo.Path);
                            if (!Core.IsNullOrWhiteSpace(url))
                            {
                                Settings.YouTubeInfo.Url = url;
                                Settings.YouTubeInfo.LastByte = 0;
                                _retries = 0;
                                Settings.SaveInfos();
                            }
                        }
                        catch (Exception e)
                        {
                            Console.WriteLine("Terminating because of too many retries.");
                            Console.WriteLine(e.Message);
                            paused = true;
                            _retries = 0;
                            return;
                        }
                    }
                }
                Settings.YouTubeInfo.LastByte = feedback.LastByte;
                if (feedback.LastByte >= feedback.ContentSize)
                {
                    //Upload Completed.
                    Console.WriteLine(string.Format("Upload completed. Video ID: {0}. Applying Metadata...", videoId));
                    FindViewById<TextView>(Resource.Id.txtProgress).Text = "Applying Metadata...";
                }

                _fraction = 0;
                Settings.SaveInfos();
            });
        }
Example #2
0
        void UploadCallback(Uptred.VerifyFeedback feedback)
        {
            this.RunOnUiThread(() =>
            {
                updatePercentage(feedback.LastByte, feedback.ContentSize);
                if (Settings.VimeoInfo.LastByte >= feedback.LastByte)
                {
                    Console.WriteLine(string.Format("No bytes uploaded. Retries: {0}", _retries));
                    _retries++;
                    if (_retries > 3)
                    {
                        try
                        {
                            var ticket = Settings.VimeoHook.GetTicket();
                            if (ticket != null)
                            {
                                Settings.VimeoInfo.Ticket = ticket;
                                Settings.VimeoInfo.LastByte = 0;
                                _retries = 0;
                                Settings.SaveInfos();
                            }
                        }
                        catch (Exception e)
                        {
                            Console.WriteLine("Terminating because of too many retries.");
                            Console.WriteLine(e.Message);
                            paused = true;
                            _retries = 0;
                            return;
                        }
                    }
                }
                Settings.VimeoInfo.LastByte = feedback.LastByte;
                if (Settings.VimeoInfo.VideoId != null && Settings.VimeoInfo.VideoId != "")
                {
                    //Upload Completed.
                    Console.WriteLine(string.Format("Upload completed. Video ID: {0}. Applying Metadata...", Settings.VimeoInfo.VideoId));
                    FindViewById<TextView>(Resource.Id.txtProgress).Text = "Applying Metadata...";
                }

                //_fraction = 0;
                Settings.SaveInfos();
            });
        }