示例#1
0
 private static void PlayYouTube(string uri, int resolution, Action callback)
 {
     YouTubeExtractorAdapter.GetYouTubeVideoUri(uri, resolution, (Action <bool, Uri>)((success, resultUri) => Execute.ExecuteOnUIThread((Action)(() =>
     {
         if (!success)
         {
             Navigator.Current.NavigateToWebUri(uri, false, false);
             callback();
         }
         else
         {
             JsonWebRequest.GetHttpStatusCode(resultUri.ToString(), (Action <HttpStatusCode>)(statusCode =>
             {
                 if (statusCode == HttpStatusCode.OK)
                 {
                     VideoPlayerHelper.LaunchMediaPlayer(resultUri);
                 }
                 else
                 {
                     Navigator.Current.NavigateToWebUri(uri, false, false);
                 }
                 callback();
             }));
         }
     }))));
 }