INTEGRITY Dokumentace

Shaka Player

Nejprve vytvořte prvek video a pomocí atributu poster nastavte náhledový obrázek. Více informací najdete v Zobrazení náhledových obrázků s pokyny, jak vygenerovat náhledový obrázek pomocí Cloudflare Stream.

<video
	id="video"
	width="640"
	poster="https://customer-f33zs165nr7gyfy4.cloudflarestream.com/6b9e68b07dfee8cc2d116e4c51d6a957/thumbnails/thumbnail.jpg"
	controls
	autoplay
></video>

Poté naslouchejte DOMContentLoaded událost, vytvořte novou instanci Shaka Player a načtěte manifest URI.

// Replace the manifest URI with an HLS or DASH manifest from Cloudflare Stream
const manifestUri =
	'https://customer-f33zs165nr7gyfy4.cloudflarestream.com/6b9e68b07dfee8cc2d116e4c51d6a957/manifest/video.mpd';

document.addEventListener('DOMContentLoaded', () => {
	const video = document.getElementById('video');
  const player = new shaka.Player(video);
	await player.load(manifestUri);
});

Viz Dokumentace Shaka Player ↗ s dalšími informacemi.