public override async Task OnNavigateTo(object parameter) { await base.OnNavigateTo(parameter); var playerParameters = parameter as PlayerParameters; if (playerParameters == null) { await this._dialogService.ShowMessageAsync("Error", "Incorrect navigation parameters"); this._navigationService.GoBack(); return; } this.PlayerParameters = playerParameters; var streamUri = this.PlayerParameters.Url; this.VideoUrl = streamUri.AbsoluteUri; }
private async Task PlayVideoAsync() { try { var parameters = new PlayerParameters { Title = Session.Title, }; // Play video if (HasDownload) { if (VideoDownload.Status == DownloadStatus.Completed) { parameters.Url = VideoDownload.LocalFileUrl; } } if (parameters.Url == null || string.IsNullOrWhiteSpace(parameters.Url.AbsoluteUri)) { if (!this._networkService.IsOnline) { await this._dialogService.ShowMessageAsync("No internet access", "When offline, you only can play downloaded videos"); return; } parameters.Url = await this._videoDownloaderService.GetDownloadVideoUrlAsync(this.Session.YoutubeID); } _navigationService.NavigateTo(PageKey.PlayerPage, parameters); } catch (Exception ex) { await this._dialogService.ShowMessageAsync("Error", "Is not possible to load the video URL"); await this._logService.LogExceptionAsync(ex); } }