mirror of
https://codeberg.org/PostERG/xamxam.git
synced 2026-06-25 16:19:19 +02:00
36 lines
1.1 KiB
PHP
36 lines
1.1 KiB
PHP
<?php
|
|
/**
|
|
* peertube-embed.php
|
|
*
|
|
* Renders a PeerTube video/audio embed iframe from a stored peertube_ids:{uuid} value.
|
|
*
|
|
* Expected variables:
|
|
* string $peertubeUuid — the PeerTube video shortUUID
|
|
* string $title — title attribute for the iframe
|
|
* string $instanceUrl — base URL of the PeerTube instance (e.g. https://videos.erg.be)
|
|
* int $width — iframe width (default 560)
|
|
* int $height — iframe height (default 315)
|
|
*/
|
|
|
|
$peertubeUuid = $peertubeUuid ?? '';
|
|
$title = $title ?? 'PeerTube video';
|
|
$instanceUrl = $instanceUrl ?? '';
|
|
$width = $width ?? 560;
|
|
$height = $height ?? 315;
|
|
|
|
if ($peertubeUuid === '' || $instanceUrl === '') {
|
|
return;
|
|
}
|
|
|
|
$embedUrl = rtrim($instanceUrl, '/') . '/videos/embed/' . $peertubeUuid;
|
|
?>
|
|
<iframe
|
|
title="<?= htmlspecialchars($title) ?>"
|
|
width="<?= (int)$width ?>"
|
|
height="<?= (int)$height ?>"
|
|
src="<?= htmlspecialchars($embedUrl) ?>"
|
|
style="border: 0px;"
|
|
allow="fullscreen"
|
|
sandbox="allow-same-origin allow-scripts allow-popups allow-forms"
|
|
></iframe>
|