-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1089 from ecds/feature/homepage-video
Add featured video as wagtail fields, connect to homepage
- Loading branch information
Showing
7 changed files
with
122 additions
and
304 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# Generated by Django 3.2.25 on 2024-09-23 19:31 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
("cms", "0006_create_footermenu"), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name="homepage", | ||
name="featured_video_tagline", | ||
field=models.CharField( | ||
blank=True, | ||
help_text="A short description or tagline for the featured video", | ||
max_length=255, | ||
), | ||
), | ||
migrations.AddField( | ||
model_name="homepage", | ||
name="featured_video_title", | ||
field=models.CharField( | ||
blank=True, help_text="Title of the featured video", max_length=255 | ||
), | ||
), | ||
migrations.AddField( | ||
model_name="homepage", | ||
name="featured_video_url", | ||
field=models.URLField( | ||
blank=True, | ||
help_text="Vimeo link to the featured video (e.g. https://vimeo.com/76979871, only Vimeo supported)", | ||
), | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,60 +1,24 @@ | ||
{% load static readux_extras %} | ||
|
||
<div class="uk-section uk-section-default uk-padding-remove"> | ||
<div class="uk-container-expand"> | ||
<div class="video-section"> | ||
<div class="video-container" id="videoContainer"> | ||
<img src="https://i.vimeocdn.com/video/452001751_640.jpg" alt="Vimeo Video Thumbnail" class="video-thumbnail" id="videoThumbnail"> | ||
<img src="{% static 'images/video_thumbnail.jpg' %}" alt="Vimeo Video Thumbnail" class="video-thumbnail" id="videoThumbnail"> | ||
<div class="transparent-overlay" id="transparentOverlay"></div> | ||
<iframe src="https://player.vimeo.com/video/76979871" frameborder="0" allow="autoplay; fullscreen; picture-in-picture" allowfullscreen id="vimeoPlayer"></iframe> | ||
<iframe src="{{ page.featured_video_url|vimeo_embed_url }}" frameborder="0" allow="autoplay; fullscreen; picture-in-picture" allowfullscreen id="vimeoPlayer"></iframe> | ||
<div class="video-overlay" id="videoOverlay"> | ||
<h1 style="color:white; font-size: 3rem; font-weight: bold; margin-bottom: 2rem;">Watch the Video</h1> | ||
<h1 style="color:white; font-size: 3rem; font-weight: bold; margin-bottom: 2rem;"> | ||
{{ page.featured_video_title|default:"Watch the Video" }} | ||
</h1> | ||
<div class="play-icon" uk-icon="icon: play-circle; ratio: 6" style="margin-bottom: 2rem;"></div> | ||
<div style="color:white; font-size: 1.5rem;">Readux is an open-source platform and a web-based space to engage with digitized print materials.</div> | ||
{% if page.featured_video_tagline %} | ||
<div style="color:white; font-size: 1.5rem;"> | ||
{{ page.featured_video_tagline }} | ||
</div> | ||
{% endif %} | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
|
||
<script src="https://player.vimeo.com/api/player.js"></script> | ||
<script> | ||
var iframe = document.getElementById('vimeoPlayer'); | ||
var player = new Vimeo.Player(iframe); | ||
var thumbnail = document.getElementById('videoThumbnail'); | ||
var overlay = document.getElementById('videoOverlay'); | ||
|
||
document.getElementById('videoOverlay').addEventListener('click', function() { | ||
// Hide the overlay and thumbnail | ||
overlay.style.display = 'none'; | ||
thumbnail.style.display = 'none'; | ||
|
||
// Show the iframe and play the video in full screen | ||
iframe.style.display = 'block'; | ||
|
||
player.play().then(function() { | ||
return player.requestFullscreen(); | ||
}).catch(function(error) { | ||
console.error('Error playing the video:', error); | ||
}); | ||
}); | ||
|
||
player.on('ended', function() { | ||
// Hide the iframe and show the overlay and thumbnail again | ||
iframe.style.display = 'none'; | ||
overlay.style.display = 'block'; | ||
thumbnail.style.display = 'block'; | ||
}); | ||
|
||
player.on('fullscreenchange', function(data) { | ||
if (!data.fullscreen) { | ||
player.pause().then(function() { | ||
// Hide the iframe and show the overlay and thumbnail again | ||
iframe.style.display = 'none'; | ||
overlay.style.display = 'block'; | ||
thumbnail.style.display = 'block'; | ||
}).catch(function(error) { | ||
console.error('Error pausing the video:', error); | ||
}); | ||
} | ||
}); | ||
</script> |
Oops, something went wrong.