private void OnClick(object sender, EventArgs e) { int startIndex = ParseInt(startIndexEditText.Text, 0); int startTimeMillis = ParseInt(startTimeEditText.Text, 0) * 1000; bool autoplay = autoplayCheckBox.Checked; bool lightboxMode = lightboxModeCheckBox.Checked; Intent intent = null; if (sender == playVideoButton) { intent = YouTubeStandalonePlayer.CreateVideoIntent(this, DeveloperKey.Key, VideoId, startTimeMillis, autoplay, lightboxMode); } else if (sender == playPlaylistButton) { intent = YouTubeStandalonePlayer.CreatePlaylistIntent(this, DeveloperKey.Key, PlaylistId, startIndex, startTimeMillis, autoplay, lightboxMode); } else if (sender == playVideoListButton) { intent = YouTubeStandalonePlayer.CreateVideosIntent(this, DeveloperKey.Key, VideoIds, startIndex, startTimeMillis, autoplay, lightboxMode); } if (intent != null) { if (CanResolveIntent(intent)) { StartActivityForResult(intent, StartStandalonePlayerRequest); } else { // Could not resolve the intent - must need to install or update the YouTube API service. YouTubeInitializationResult.ServiceMissing.GetErrorDialog(this, ResolveServiceMissingRequest).Show(); } } }
void Play(string id) { int startIndex; int startTimeMillis; bool autoplay; bool lightboxMode; int.TryParse(startIndexEditText.Text, out startIndex); int.TryParse(startTimeEditText.Text, out startTimeMillis); startTimeMillis *= 1000; autoplay = autoplayCheckBox.Checked; lightboxMode = lightboxModeCheckBox.Checked; var intent = YouTubeStandalonePlayer.CreateVideoIntent(this, DeveloperKey.Key, id, startTimeMillis, autoplay, lightboxMode); StartActivityForResult(intent, RegStartStandalonePlayer); }
public void OnClick(View v) { int startIndex = 0; Int32.TryParse(startIndexEditText.Text.ToString(), out startIndex); int startTimeMillis = 0; Int32.TryParse(startTimeEditText.Text.ToString(), out startTimeMillis); startTimeMillis *= 1000; bool autoplay = autoplayCheckBox.Checked; bool lightboxMode = lightboxModeCheckBox.Checked; Intent intent = null; if (v == playVideoButton) { intent = YouTubeStandalonePlayer.CreateVideoIntent( this, DeveloperKey.DEVELOPER_KEY, VIDEO_ID, startTimeMillis, autoplay, lightboxMode); } else if (v == playPlaylistButton) { intent = YouTubeStandalonePlayer.CreatePlaylistIntent(this, DeveloperKey.DEVELOPER_KEY, PLAYLIST_ID, startIndex, startTimeMillis, autoplay, lightboxMode); } else if (v == playVideoListButton) { intent = YouTubeStandalonePlayer.CreateVideosIntent(this, DeveloperKey.DEVELOPER_KEY, VIDEO_IDS, startIndex, startTimeMillis, autoplay, lightboxMode); } if (intent != null) { if (CanResolveIntent(intent)) { StartActivityForResult(intent, REQ_START_STANDALONE_PLAYER); } else { // Could not resolve the intent - must need to install or update the YouTube API service. YouTubeInitializationResult.ServiceMissing .GetErrorDialog(this, REQ_RESOLVE_SERVICE_MISSING).Show(); } } }
public void OnPlayYoutubeButtonClicked(YoutubeVideoClickEventArgs e) { try { if (AppSettings.StartYoutubeAsIntent) { Intent intent = YouTubeStandalonePlayer.CreateVideoIntent((Activity)MainContext, AppSettings.YoutubeKey, e.NewsFeedClass.Youtube); ((Activity)MainContext).StartActivity(intent); } else { ((HomeActivity)MainContext).OpenNewsFeedItem(e.NewsFeedClass); } } catch (Exception exception) { Console.WriteLine(exception); } }
private void OnClick(object sender, EventArgs e) { Intent intent = null; if (sender == playVideoButton) { intent = YouTubeStandalonePlayer.CreateVideoIntent(this, DeveloperKey.Key, VideoId, 0, false, false);// startTimeMillis, autoplay, lightboxMode); } if (intent != null) { if (CanResolveIntent(intent)) { // StartActivityForResult(intent, StartStandalonePlayerRequest); } else { // Could not resolve the intent - must need to install or update the YouTube API service. YouTubeInitializationResult.ServiceMissing.GetErrorDialog(this, ResolveServiceMissingRequest).Show(); } } }