private OoyalaData.Players.Item PlayerSettingsToHashTable(string playerId, int EditRowIndex) { try { CheckBox chkShowShareDigg = (CheckBox)playerGrid.Rows[EditRowIndex].FindControl("chkShowShareDigg"); CheckBox chkShowShareEmailToFriend = (CheckBox)playerGrid.Rows[EditRowIndex].FindControl("chkShowShareEmailToFriend"); CheckBox chkShowShareFacebook = (CheckBox)playerGrid.Rows[EditRowIndex].FindControl("chkShowShareFacebook"); CheckBox chkAdCountdown = (CheckBox)playerGrid.Rows[EditRowIndex].FindControl("chkAdCountdown"); CheckBox chkShowBitrateButton = (CheckBox)playerGrid.Rows[EditRowIndex].FindControl("chkShowBitrateButton"); CheckBox chkShowChannelButton = (CheckBox)playerGrid.Rows[EditRowIndex].FindControl("chkShowChannelButton"); CheckBox chkShowShareGrabEmbedCode = (CheckBox)playerGrid.Rows[EditRowIndex].FindControl("chkShowShareGrabEmbedCode"); CheckBox chkReplay = (CheckBox)playerGrid.Rows[EditRowIndex].FindControl("chkReplay"); CheckBox chkShowInfoButton = (CheckBox)playerGrid.Rows[EditRowIndex].FindControl("chkShowInfoButton"); CheckBox chkShowInfoExposeDescription = (CheckBox)playerGrid.Rows[EditRowIndex].FindControl("chkShowInfoExposeDescription"); CheckBox chkShowInfoExposeProvider = (CheckBox)playerGrid.Rows[EditRowIndex].FindControl("chkShowInfoExposeProvider"); CheckBox chkShowInfoExposeTitle = (CheckBox)playerGrid.Rows[EditRowIndex].FindControl("chkShowInfoExposeTitle"); CheckBox chkShowShareButton = (CheckBox)playerGrid.Rows[EditRowIndex].FindControl("chkShowShareButton"); CheckBox chkShowVolumeButton = (CheckBox)playerGrid.Rows[EditRowIndex].FindControl("chkShowVolumeButton"); CheckBox chkShowShareToTwitter = (CheckBox)playerGrid.Rows[EditRowIndex].FindControl("chkShowShareToTwitter"); CheckBox chkShowShareLinkURL = (CheckBox)playerGrid.Rows[EditRowIndex].FindControl("chkShowShareLinkURL"); CheckBox chkAlwaysShowScrubber = (CheckBox)playerGrid.Rows[EditRowIndex].FindControl("chkAlwaysShowScrubber"); CheckBox chkBufferOnPause = (CheckBox)playerGrid.Rows[EditRowIndex].FindControl("chkBufferOnPause"); TextBox txtplayerName = (TextBox)playerGrid.Rows[EditRowIndex].FindControl("txtplayerName"); OoyalaData.Players.Item player = OoyalaMediaUtils.GetPlayer(SecretKey, APIKey, playerId); player.name = txtplayerName.Text; player.ooyala_branding.digg_sharing = chkShowShareDigg.Checked; player.ooyala_branding.email_sharing = chkShowShareEmailToFriend.Checked; player.ooyala_branding.facebook_sharing = chkShowShareFacebook.Checked; player.ooyala_branding.show_ad_countdown = chkAdCountdown.Checked; player.ooyala_branding.show_bitrate_button = chkShowBitrateButton.Checked; player.ooyala_branding.show_channel_button = chkShowChannelButton.Checked; player.ooyala_branding.show_embed_button = chkShowShareGrabEmbedCode.Checked; player.ooyala_branding.show_end_screen_replay_button = chkReplay.Checked; player.ooyala_branding.show_info_button = chkShowInfoButton.Checked; player.ooyala_branding.show_info_screen_description = chkShowInfoExposeDescription.Checked; player.ooyala_branding.show_info_screen_homepage_link = chkShowInfoExposeProvider.Checked; player.ooyala_branding.show_info_screen_title = chkShowInfoExposeTitle.Checked; player.ooyala_branding.show_share_button = chkShowShareButton.Checked; player.ooyala_branding.show_volume_button = chkShowVolumeButton.Checked; player.ooyala_branding.twitter_sharing = chkShowShareToTwitter.Checked; player.ooyala_branding.url_sharing = chkShowShareLinkURL.Checked; player.scrubber.always_show = chkAlwaysShowScrubber.Checked; player.playback.buffer_on_pause = chkBufferOnPause.Checked; return(player); } catch (Exception e) { lblResults.Text = e.Message; return(null); } }
/// <summary> /// Update Player Settings in Ooyala using V2 API /// </summary> /// <param name="SecretKey">Backlot Secret Key</param> /// <param name="APIKey">Backlot API Key</param> /// <param name="player">Media Player Object</param> public static string EditPlayer(string SecretKey, string APIKey, OoyalaData.Players.Item player) { string jsonstr = JsonHelper.JsonSerializer <OoyalaData.Players.Item>(player); Hashtable hs = (Hashtable)JSON.JsonDecode(jsonstr); var res = OoyalaAPI.patch(SecretKey, APIKey, pathPlayer + "/" + player.id, hs); if (res != null) { return(res["name"].ToString()); } else { return(null); } }
private void EditMediaPlayer(int NewEditIndex) { try { string id = (string)playerGrid.DataKeys[NewEditIndex].Value; playerGrid.EditIndex = NewEditIndex; BindData(); OoyalaData.Players.Item itm = OoyalaMediaUtils.GetPlayer(SecretKey, APIKey, id); LoadSelectedPlayerSettings(itm, NewEditIndex); } catch (Exception e) { lblResults.Text = e.Message; } }
private void SaveMediaPlayerSettings(int EditRowIndex) { string id = (string)playerGrid.DataKeys[EditRowIndex].Value.ToString(); try { OoyalaData.Players.Item player = PlayerSettingsToHashTable(id, EditRowIndex); var res = OoyalaMediaUtils.EditPlayer(SecretKey, APIKey, player); if (string.IsNullOrEmpty(res)) { lblResults.Text = "<font color=red> " + WPHelper.permissionErrorMsg + " </font>"; WPHelper.permissionErrorMsg = string.Empty; return; } playerGrid.EditIndex = -1; BindData(); Response.Redirect(SPContext.Current.File.Name); } catch (Exception e) { lblResults.Text = e.Message; } }
/// <summary> /// Get Media Player based on Player ID /// </summary> /// <param name="SecretKey">Backlot Secret Key</param> /// <param name="APIKey">Backlot API Key</param> /// <param name="id">Player ID</param> /// <returns></returns> public static OoyalaData.Players.Item GetPlayer(string SecretKey, string APIKey, String id) { OoyalaData.Players.Item itm = new OoyalaData.Players.Item(); string json = OoyalaAPI.getJSON(SecretKey, APIKey, pathPlayer + "/" + id, null); itm = JsonHelper.JsonDeserialize<OoyalaData.Players.Item>(json); return itm; }
private void LoadSelectedPlayerSettings(OoyalaData.Players.Item player, int NewEditIndex) { CheckBox chkShowShareDigg = (CheckBox)playerGrid.Rows[NewEditIndex].FindControl("chkShowShareDigg"); CheckBox chkShowShareEmailToFriend = (CheckBox)playerGrid.Rows[NewEditIndex].FindControl("chkShowShareEmailToFriend"); CheckBox chkShowShareFacebook = (CheckBox)playerGrid.Rows[NewEditIndex].FindControl("chkShowShareFacebook"); CheckBox chkAdCountdown = (CheckBox)playerGrid.Rows[NewEditIndex].FindControl("chkAdCountdown"); CheckBox chkShowBitrateButton = (CheckBox)playerGrid.Rows[NewEditIndex].FindControl("chkShowBitrateButton"); CheckBox chkShowChannelButton = (CheckBox)playerGrid.Rows[NewEditIndex].FindControl("chkShowChannelButton"); CheckBox chkShowShareGrabEmbedCode = (CheckBox)playerGrid.Rows[NewEditIndex].FindControl("chkShowShareGrabEmbedCode"); CheckBox chkReplay = (CheckBox)playerGrid.Rows[NewEditIndex].FindControl("chkReplay"); CheckBox chkShowInfoButton = (CheckBox)playerGrid.Rows[NewEditIndex].FindControl("chkShowInfoButton"); CheckBox chkShowInfoExposeDescription = (CheckBox)playerGrid.Rows[NewEditIndex].FindControl("chkShowInfoExposeDescription"); CheckBox chkShowInfoExposeProvider = (CheckBox)playerGrid.Rows[NewEditIndex].FindControl("chkShowInfoExposeProvider"); CheckBox chkShowInfoExposeTitle = (CheckBox)playerGrid.Rows[NewEditIndex].FindControl("chkShowInfoExposeTitle"); CheckBox chkShowShareButton = (CheckBox)playerGrid.Rows[NewEditIndex].FindControl("chkShowShareButton"); CheckBox chkShowVolumeButton = (CheckBox)playerGrid.Rows[NewEditIndex].FindControl("chkShowVolumeButton"); CheckBox chkShowShareToTwitter = (CheckBox)playerGrid.Rows[NewEditIndex].FindControl("chkShowShareToTwitter"); CheckBox chkShowShareLinkURL = (CheckBox)playerGrid.Rows[NewEditIndex].FindControl("chkShowShareLinkURL"); CheckBox chkAlwaysShowScrubber = (CheckBox)playerGrid.Rows[NewEditIndex].FindControl("chkAlwaysShowScrubber"); CheckBox chkBufferOnPause = (CheckBox)playerGrid.Rows[NewEditIndex].FindControl("chkBufferOnPause"); TextBox txtplayerName = (TextBox)playerGrid.Rows[NewEditIndex].FindControl("txtplayerName"); CheckBox chkPlayerGrid = (CheckBox)playerGrid.Rows[NewEditIndex].FindControl("chkDefault"); if (chkPlayerGrid.Checked) { txtplayerName.Enabled = false; } txtplayerName.Text = player.name; if (player.ooyala_branding != null) { chkShowShareDigg.Checked = player.ooyala_branding.digg_sharing; chkShowShareEmailToFriend.Checked = player.ooyala_branding.email_sharing; chkShowShareFacebook.Checked = player.ooyala_branding.facebook_sharing; chkAdCountdown.Checked = player.ooyala_branding.show_ad_countdown; chkShowBitrateButton.Checked = player.ooyala_branding.show_bitrate_button; chkShowChannelButton.Checked = player.ooyala_branding.show_channel_button; chkShowShareGrabEmbedCode.Checked = player.ooyala_branding.show_embed_button; chkReplay.Checked = player.ooyala_branding.show_end_screen_replay_button; chkShowInfoButton.Checked = player.ooyala_branding.show_info_button; chkShowInfoExposeDescription.Checked = player.ooyala_branding.show_info_screen_description; chkShowInfoExposeProvider.Checked = player.ooyala_branding.show_info_screen_homepage_link; chkShowInfoExposeTitle.Checked = player.ooyala_branding.show_info_screen_title; chkShowShareButton.Checked = player.ooyala_branding.show_share_button; chkShowVolumeButton.Checked = player.ooyala_branding.show_volume_button; chkShowShareToTwitter.Checked = player.ooyala_branding.twitter_sharing; chkShowShareLinkURL.Checked = player.ooyala_branding.url_sharing; } if (player.scrubber != null) { chkAlwaysShowScrubber.Checked = player.scrubber.always_show; } if (player.playback != null) { chkBufferOnPause.Checked = player.playback.buffer_on_pause; } }