@inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.ParagraphViewModel>
@using System.IO
@using Dynamicweb.Frontend

@if(Model.Item.TryGetVideo("VideoSource", out VideoViewModel video)) {
	var videoParams = new Dictionary<string, object>();

	if (Model.Item.TryGetString("VideoName", out string videoName)) {
		videoParams.Add("VideoName", videoName);
	} 
	else 
	{
		videoParams.Add("VideoName", video.Name);
	}
	
	if (Model.Item.TryGetString("VideoDescription", out string videoDescription)) {
		videoParams.Add("VideoDescription", videoDescription);
	}

	@RenderPartial("Components/VideoPlayer.cshtml", video, videoParams)
}
