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

@if(!string.IsNullOrEmpty(Model.Path)) 
{		
	<swift-video-player itemscope itemtype="https://schema.org/VideoObject">
		<figure class="m-0 ratio ratio-16x9">
			<meta itemprop="name" content="@GetViewParameterString("VideoName")" />
			<meta itemprop="description" content="@GetViewParameterString("VideoDescription")" />
			<meta itemprop="contentUrl" content="@Model.Path" />
			
			@if (!string.IsNullOrEmpty(Model.Thumbnail))
			{
				<meta itemprop="thumbnailUrl" content="@Model.Thumbnail" />
			}

			@if (Model.IsExternalLink())
			{
				<iframe src="@Model.ToEmbedUrl()" title="@GetViewParameterString("VideoName")" frameborder="0" allow="fullscreen; picture-in-picture; autoplay; clipboard-write; encrypted-media; web-share"></iframe>
			}
			else
			{
				<video preload="auto" data-swift-video poster="@Model.Thumbnail">
					<source src="@Model.Path" type="@Model.GetVideoType()">
				</video>
				<button type="button" aria-label="@Translate("Play/Pause video")" data-swift-video-play-btn></button>
			}
		</figure>
	</swift-video-player>
}
