Videos in legacy courses generally have a URL to an archived version of the video on archive.org in the video_files.archive_url property in the video metadata. Videos in new courses synced from Google Drive in ocw-studio do not set this property and instead set the file property to a root-relative path indicating where to find the video file relative to the site root.
Expected Behavior
When building a site with Hugo using the course-offline theme, if a video has the file property and the video file is found to exist, the local video player should be used instead.
Current Behavior
The YouTube player is loaded even though the above conditions are met.
Steps to Reproduce
Create a new site in ocw-studio
Upload a video to the videos_final folder in Google Drive, then run a sync from the Resources page
Wait for the transcoding process to finish
Embed the video in a page
Publish your site
Go to the published site and click the buttons to download the ZIP archive
Extract the ZIP and open the index.html file in browser, then browse to the page where the video is embedded, as well as the video page itself
Possible Solution
In https://github.com/mitodl/ocw-hugo-themes/blob/main/base-offline/layouts/partials/video.html, only .Params.video_files.archive_url is checked and passed as the archiveUrl argument to video_player.html. Since this value is blank for videos uploaded with the process described above, the archive video is never found during the build and the YouTube player is rendered instead. The file property should also be checked, and the actual existence of the video file checked in the same manner as with archive_url.
Videos in legacy courses generally have a URL to an archived version of the video on archive.org in the
video_files.archive_url
property in the video metadata. Videos in new courses synced from Google Drive inocw-studio
do not set this property and instead set thefile
property to a root-relative path indicating where to find the video file relative to the site root.Expected Behavior
When building a site with Hugo using the
course-offline
theme, if a video has thefile
property and the video file is found to exist, the local video player should be used instead.Current Behavior
The YouTube player is loaded even though the above conditions are met.
Steps to Reproduce
ocw-studio
videos_final
folder in Google Drive, then run a sync from the Resources pageindex.html
file in browser, then browse to the page where the video is embedded, as well as the video page itselfPossible Solution
In https://github.com/mitodl/ocw-hugo-themes/blob/main/base-offline/layouts/partials/video.html, only
.Params.video_files.archive_url
is checked and passed as thearchiveUrl
argument tovideo_player.html
. Since this value is blank for videos uploaded with the process described above, the archive video is never found during the build and the YouTube player is rendered instead. Thefile
property should also be checked, and the actual existence of the video file checked in the same manner as witharchive_url
.