This document discusses various techniques for optimizing video playback on websites. It covers topics like removing audio, improving loading speeds, detecting device/connection properties, and fallback options when autoplay is disabled. Code snippets demonstrate how to conditionally autoplay video based on factors like screen width, connection type, and browser capabilities. The goal is to provide the best video experience across different environments while being mindful of data usage and user preferences.
10. MOBIL (IN THEORIE)
<video autoplay loop muted playsinline>
<source src="vid.mp4" media="(min-width: 1366px)" type="video/mp4">
<img src="screenshot.jpg" alt="Video screenshot">
</video>
11. MOBIL
Problem: Video Media Query Support wurde aus
Chrome + Firefox entfernt
<video autoplay loop muted playsinline>
<source src="vid.mp4" media="(min-width: 1366px)" type="video/mp4">
<img src="screenshot.jpg" alt="Video screenshot">
</video>
18. CHROME DATA SAVER
<script>
var autoplay = true
if ("connection" in navigator && navigator.connection.saveData) {
autoplay = false
}
</script>
<?php
if (empty($_SERVER['HTTP_SAVE_DATA'])) {
// Load video
}
https://developer.chrome.com/multidevice/data-compression
19. DO NOT TRACK
Relevant für DSGVO
<script>
var autoplay = true
if ("doNotTrack" in navigator && navigator.doNotTrack === "1") {
autoplay = false
}
</script>
<?php
if (empty($_SERVER['HTTP_DNT']) ||
$_SERVER['HTTP_DNT'] === 'unspecified') {
// Video von Drittanbieter (YouTube, Vimeo, ...)
}
https://www.praetor.im/notizen/please-do-not-track/