don't preload videos

This commit is contained in:
Ben Goldsworthy 2024-08-27 16:57:33 +02:00
parent 12bfb800ce
commit 5748f5c2f2
Signed by: Rumperuu
SSH key fingerprint: SHA256:e5XfzNOr9UvWpEzyLfw0GtTMZWIFh3NmxH+/qQIi3xE
3 changed files with 12 additions and 12 deletions

View file

@ -285,7 +285,7 @@ body {
max-height: 45vh;
margin-top: 1em;
display: block;
background-color: white;
background-color: black;
border: 2px solid var(--dark, #020202);
}

View file

@ -10,7 +10,7 @@
if (file_exists(public_path() . "/" . $trip_slug . "/" . $hasEmbed . "/" . $filepath[1])) {
$path = "/" . $trip_slug . "/" .$hasEmbed . "/" . $filepath[1];
$embed = '<video class="popup__video" controls>';
$embed = '<video class="popup__video" preload="none" controls>';
$embed .= '<source src="' . secure_url( $path ) . '" type="video/webm">';
$embed .= '<p>Your client doesn\'t support HTML video. Here is a <a href="' . secure_url( $path ) . '">link to the video</a> instead.</p>';
$embed .= '</video>';
@ -27,7 +27,7 @@
if (file_exists(public_path() . "/" . $trip_slug . "/" . $hasEmbed . "/" . $filepath[1])) {
$path = "/" . $trip_slug . "/" .$hasEmbed . "/" . $filepath[1];
$embed = '<audio class="popup__audio" controls>';
$embed = '<audio class="popup__audio" preload="none" controls>';
$embed .= '<source src="' . secure_url( $path ) . '" type="audio/ogg">';
$embed .= '<p>Download <a href="' . secure_url( $path ) . '">OGG</a> audio.</p>';
$embed .= '</audio>';

View file

@ -127,13 +127,13 @@
$embed = null;
if (preg_match("/\[\[([^\]]+)\]\]/", $checkin->note, $filepath)) {
if (preg_match("/\.webm/", $filepath[1])) {
$embed = '<video class="popup__video" controls>';
$embed = '<video class="popup__video" prefetch="none" controls>';
$embed .= '<source src="' . url("/videos/" . $filepath[1]) . '" type="video/webm">';
$embed .= '<p>Your browser doesn\'t support HTML video. Here is a <a href="';
$embed .= url("/videos/" . $filepath[1]) . '">link to the video</a> instead.</p>';
$embed .= '</video>';
} elseif (preg_match("/\.ogg/", $filepath[1])) {
$embed = '<audio class="popup__audio" controls>';
$embed = '<audio class="popup__audio" prefetch="none" controls>';
$embed .= '<source src="' . url("/audio/" . $filepath[1]) . '" type="audio/ogg">';
$embed .= '<p>Download <a href="' . url("/audio/" . $filepath[1]) . '">OGG</a> audio.</p>';
$embed .= '</audio>';