void LoadMedia() { try { var assets = OoyalaMediaUtils.GetLiveAssets(SecretKey, APIKey); var players = OoyalaMediaUtils.GetAllPlayers(SecretKey, APIKey); if (assets == null) { ErrorMessage = "<font color=red>No Media Assets found!</font>"; return; } if (players == null) { ErrorMessage = "<font color=red>No Media players found!</font>"; return; } ddlMediaAssets.DataSource = assets; ddlMediaAssets.DataTextField = "name"; ddlMediaAssets.DataValueField = "embed_code"; ddlMediaAssets.DataBind(); var orderedPlayers = from p in players orderby p.name select p; ddlMediaPlayers.DataSource = orderedPlayers; ddlMediaPlayers.DataTextField = "name"; ddlMediaPlayers.DataValueField = "id"; ddlMediaPlayers.DataBind(); } catch (Exception e) { ErrorMessage = e.Message; } }
private void BindData() { try { List <OoyalaData.Players.Item> players = OoyalaMediaUtils.GetAllPlayers(SecretKey, APIKey); var playerlist = from itm in players orderby itm.is_default descending, itm.name ascending //orderby itm.name ascending select new { itm.id, itm.name, itm.is_default }; playerGrid.DataSource = playerlist; playerGrid.DataKeyNames = new string[] { "id" }; playerGrid.DataBind(); } catch (Exception e) { lblResults.Text = e.Message; } }
private void populateAssetSelection() { try { var assets = OoyalaMediaUtils.GetAllAssets(SecretKey, APIKey); var players = OoyalaMediaUtils.GetAllPlayers(SecretKey, APIKey); if (assets == null) { mAssetSelectionList.Enabled = false; errorMessage.Controls.Add(new Label() { Text = "No Assets returned. Is the plug-in installed with the correct API Key and Secret?" }); return; } if (players == null) { mPlayerList.Enabled = false; errorMessage.Controls.Add(new Label() { Text = "No Media Players returned. Is the plug-in installed with the correct API Key and Secret?" }); return; } mAssetSelectionList.DataSource = assets; mAssetSelectionList.DataTextField = "name"; mAssetSelectionList.DataValueField = "embed_code"; mAssetSelectionList.DataBind(); mPlayerList.DataSource = players; mPlayerList.DataTextField = "name"; mPlayerList.DataValueField = "id"; mPlayerList.DataBind(); } catch { errorMessage.Controls.Add(new Label() { Text = "Error has occured. Is the plug-in installed with the correct API Key and Secret?" }); } }