Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Added code to play embedded youtube and vimeo videos #318

Merged
merged 7 commits into from
Nov 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ public class VideoResource : IContent
public string Id { get; set; }
public Asset Video { get; set; }
public Document Transcript { get; set; }
public string EmbeddedSourceUrl { get; set; }
}
28 changes: 25 additions & 3 deletions Childrens-Social-Care-CPD/Views/Shared/_VideoResource.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,29 @@

<div class="govuk-grid-row">
<div class="govuk-grid-column-three-quarters">
<video id="videoPlayer" preload="none">
<source src="@Model.Video.File.Url">
</video>
@if(!string.IsNullOrEmpty(Model.EmbeddedSourceUrl))
{
if (@Model.EmbeddedSourceUrl.IndexOf("vimeo") > -1)
{
<iframe width="560" height="315"
title="Vimeo Video"
src="@Model.EmbeddedSourceUrl"
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
allowfullscreen>
</iframe>
}
else
{
<video name="media" src="@Model.EmbeddedSourceUrl" preload="none"></video>
}
MartinBelton-gov marked this conversation as resolved.
Show resolved Hide resolved
}
else
{
<video id="videoPlayer" name="media" preload="none">
<source src="@Model.Video.File.Url">
</video>
}

<details class="govuk-details govuk-!-margin-top-3" data-module="govuk-details">
<summary class="govuk-details__summary"> <span class="govuk-details__summary-text">View transcript </span></summary>
<div class="govuk-details__text">
Expand All @@ -19,5 +39,7 @@
}
</div>
</details>


</div>
</div>
Loading