I'm trying to render out the brightcove media player right now while passing a dynamic video id. The brightcoveData.Id is a valid guid but I can't seem to get the parameters passing properly so that the Rendering understands it. I get an error from this component saying "Media item are not selected."
var embedMedia = new System.Collections.Specialized.NameValueCollection();
embedMedia.Add("playerId", "E7766078969C3AB892DD158E0E7230B9");
embedMedia.Add("width", "400");
embedMedia.Add("height", "300");
@Html.Sitecore().Rendering("/sitecore/layout/Renderings/Media Framework/Embed Media", new
{
DataSource = brightcoveData.Id,
Parameters = embedMedia
})
Any help would be appreciated. Thanks.
Rendering parameter templates are managed in the same module as the code that uses them, either in the feature module where the rendering and controller logic resides or in a foundation level module.
To create a view rendering, right-click on the folder in your project where you wish to insert the . cshtml file and select Add > New Item…. Choose Sitecore in the left-hand menu, and select Sitecore View Rendering in the right-hand pane. Give the view rendering a name.
You create renderings in the same way: Choose Sitecore View Rendering to create a View Rendering, and put the definition item in Renderings. Choose Sitecore Controller Rendering to create a Controller Rendering, and put the definition item in Renderings.
Ok, after talking to Sitecore Support I got an answer:
@Html.Sitecore().Rendering("/sitecore/layout/Renderings/Media Framework/Embed Media", new
{
DataSource = brightcoveData.Id,
Parameters = "playerid=E7766078969C3AB892DD158E0E7230B9&height=300&width=400"
})
brightcoveData.Id is just a guid string = "{XXXX-...-etc}". playerid is the Sitecore item id for the player you're using.
That's what the final code looks like and it works great! Thanks everyone
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With