HTTP Permissions-Policy encrypted-media

Typ

Die encrypted-media-Direktive steuert den Zugriff auf die Encrypted Media Extensions (EME) API für DRM-geschützte Inhalte.

Syntax

Die Direktive definiert eine Allowlist für Ursprünge, die verschlüsselte Media-Inhalte abspielen dürfen.

http
Permissions-Policy: encrypted-media=(self)
Permissions-Policy: encrypted-media=(self "https://cdn.streaming.com")
Permissions-Policy: encrypted-media=()

Direktiven

Die Direktive unterstützt Standard-Allowlist-Werte für präzise Zugriffssteuerung.

self
Erlaubt EME-Zugriff nur für das Hauptdokument des gleichen Ursprungs. Eingebettete iFrames von anderen Ursprüngen werden blockiert.
origin-list
Liste von Ursprüngen in Anführungszeichen, z.B. "https://player.video-cdn.com", die zusätzlich zum Hauptdokument EME verwenden dürfen. Für DRM-Video-Player.

Beispiele

Die folgenden Beispiele zeigen typische Anwendungsfälle für Streaming-Plattformen und Video-on-Demand-Dienste.

Streaming-Plattform mit DRM-Schutz

Eine Video-Streaming-Plattform nutzt EME für Widevine/PlayReady-geschützte Premium-Inhalte.

http
HTTP/1.1 200 OK
Content-Type: text/html
Permissions-Policy: encrypted-media=(self)

<!DOCTYPE html>
<html>
<head><title>Premium Video</title></head>
<body>
  <video id="player" controls></video>
  <script>
    const video = document.getElementById('player');
    video.src = '/protected-content.mp4';

    navigator.requestMediaKeySystemAccess('com.widevine.alpha', [{
      initDataTypes: ['cenc'],
      videoCapabilities: [{contentType: 'video/mp4; codecs="avc1.42E01E"'}]
    }]).then(keySystemAccess => {
      return keySystemAccess.createMediaKeys();
    }).then(mediaKeys => {
      return video.setMediaKeys(mediaKeys);
    });
  </script>
</body>
</html>

VOD-Platform mit Embedded-Player

Eine VOD-Plattform erlaubt einem CDN-Video-Player EME-Zugriff für DRM-geschützte Filme.

http
HTTP/1.1 200 OK
Content-Type: text/html
Permissions-Policy: encrypted-media=(self "https://player.video-cdn.example.com")

<!DOCTYPE html>
<html>
<head><title>Movie Library</title></head>
<body>
  <iframe src="https://player.video-cdn.example.com/embed/movie123"
          allow="encrypted-media"></iframe>
</body>
</html>

Public Content API ohne DRM

Ein API-Endpunkt für öffentliche Inhalte deaktiviert EME komplett.

http
HTTP/1.1 200 OK
Content-Type: application/json
Permissions-Policy: encrypted-media=()

{
  "status": "success",
  "video_url": "https://cdn.example.com/public-video.mp4"
}

Vorteile für die Systemarchitektur

  • Ermöglicht DRM-Schutz für Premium-Video- und Audio-Inhalte
  • Verhindert unautorisierten EME-Zugriff durch eingebettete Drittanbieter
  • Unterstützt Content-Protection-Strategien für kostenpflichtige Inhalte
  • Schützt vor unerwünschtem CDM-Zugriff in iFrames

Spezifikation

Definiert in der W3C Encrypted Media Extensions Spezifikation. Browser-Support für Widevine, PlayReady und FairPlay variiert. Erfordert HTTPS.

Weitere Spezifikationen

Permissions-Policy Header, Content-Security-Policy Header