Beispiel #1
0
 private async void JavaCallBack_ValueReceived(object sender, string e)
 {
     // checking wheter we did receive a proper link from WebView
     if (Uri.IsWellFormedUriString(e, UriKind.Absolute))
     {
         bool streamableLinkFound = false;
         if (await WebData.GetStreamingUrlFromDecodedLink(e) is List<StreamingUri> links)
         {
             foreach (var uri in links)
             {
                 if (uri.StreamingUrl != null)
                 {
                     streamableLinkFound = true;
                 }
                 if (streamableLinkFound)
                 {
                     break;
                 }
             }
             if (streamableLinkFound)
             {
                 var intent = new Intent(this, typeof(PlayerActivity));
                 intent.PutExtra("mediaStreams", JsonConvert.SerializeObject(links));
                 StartActivity(intent);
             }
         }
         if (!streamableLinkFound)
         {
             Error.Instance.ShowErrorSnack("Error: Video not found on the given link. Please select another one.", appBarLayout);
         }
     }
     else
     {
         Error.Instance.ShowErrorSnack("Error: Deciphering the video link failed.", appBarLayout);
     }
     LoadingViewDialog.Instance.Hide();
 }