- Implemented. The main database-backed player now understands provider URLs from lone-embed.php style handling.
What changed: [includes/db.php (line 227)](/Users/tyemeclifford/Documents/GH/mediaplayer/includes/db.php:227) now classifies YouTube, Vimeo, Dailymotion, Twitch, Facebook, TikTok, Instagram, X/Twitter, SoundCloud, Spotify, Google Drive, Wistia, Streamable, Loom, plus direct Dropbox/GitHub media rewrites. [index.php (line 235)](/Users/tyemeclifford/Documents/GH/mediaplayer/index.php:235) renders provider URLs as iframe embeds, while uploaded/direct files still use Video.js. [embed.php (line 198)](/Users/tyemeclifford/Documents/GH/mediaplayer/embed.php:198) now supports those provider embeds too. [admin/add.php (line 260)](/Users/tyemeclifford/Documents/GH/mediaplayer/admin/add.php:260) and [admin/edit.php (line 383)](/Users/tyemeclifford/Documents/GH/mediaplayer/admin/edit.php:383) now describe external URLs as embed-capable and store recognized provider URLs as text/html. [README.md (line 63)](/Users/tyemeclifford/Documents/GH/mediaplayer/README.md:63) documents provider embed support.
This commit is contained in:
@@ -17,6 +17,19 @@ $per_page = (int)setting('catalogue_per_page', '10');
|
||||
$page = max(1, (int)($_GET['page'] ?? 1));
|
||||
$paged = get_videos_paginated($page, $per_page);
|
||||
|
||||
$player_sources = [];
|
||||
if ($video && !empty($video['sources'])) {
|
||||
foreach ($video['sources'] as $source) {
|
||||
$player_source = source_player_data($source);
|
||||
if ($player_source) $player_sources[] = $player_source;
|
||||
}
|
||||
}
|
||||
$primary_player_source = $player_sources[0] ?? null;
|
||||
$native_player_sources = [];
|
||||
foreach ($player_sources as $player_source) {
|
||||
if (($player_source['kind'] ?? '') !== 'iframe') $native_player_sources[] = $player_source;
|
||||
}
|
||||
|
||||
// Build absolute base URL used for embed snippet generation
|
||||
$_scheme = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') ? 'https' : 'http';
|
||||
$_host = $_SERVER['HTTP_HOST'] ?? 'localhost';
|
||||
@@ -117,6 +130,11 @@ render_head('Media — TyClifford.com', '
|
||||
.video-js .vjs-current-time,
|
||||
.video-js .vjs-duration,
|
||||
.video-js .vjs-time-divider { color:rgba(255,255,255,.8) !important; font-size:.7em !important; }
|
||||
.provider-embed-frame {
|
||||
position:absolute; inset:0;
|
||||
display:block; width:100%; height:100%;
|
||||
border:0; background:#000;
|
||||
}
|
||||
|
||||
/* ── Lower grid ── */
|
||||
.lower-grid { display:grid; grid-template-columns:1fr; gap:1rem; }
|
||||
@@ -214,7 +232,14 @@ render_head('Media — TyClifford.com', '
|
||||
<!-- ═══════════════════════════ PLAYER CARD ════════════════════════════════ -->
|
||||
<section class="stream-card" aria-label="Media player">
|
||||
<div class="stream-ratio">
|
||||
<?php if ($video && !empty($video['sources'])): ?>
|
||||
<?php if ($primary_player_source && ($primary_player_source['kind'] ?? '') === 'iframe'): ?>
|
||||
<iframe class="provider-embed-frame"
|
||||
src="<?= h($primary_player_source['embed']) ?>"
|
||||
title="<?= h($video['title']) ?>"
|
||||
allow="accelerometer; autoplay; clipboard-write; encrypted-media; fullscreen; gyroscope; picture-in-picture; web-share"
|
||||
allowfullscreen
|
||||
referrerpolicy="no-referrer-when-downgrade"></iframe>
|
||||
<?php elseif ($video && !empty($native_player_sources)): ?>
|
||||
<video id="main-player"
|
||||
class="video-js vjs-default-skin vjs-big-play-centered"
|
||||
controls preload="metadata"
|
||||
@@ -222,8 +247,8 @@ render_head('Media — TyClifford.com', '
|
||||
poster="<?= h(MEDIA_URL . $video['thumbnail']) ?>"
|
||||
<?php endif; ?>
|
||||
data-setup='{"fluid":false,"responsive":true,"playbackRates":[0.5,1,1.25,1.5,2]}'>
|
||||
<?php foreach ($video['sources'] as $src): ?>
|
||||
<source src="<?= h(source_public_url($src)) ?>" type="<?= h($src['mime_type']) ?>" label="<?= h($src['quality'] ?: $src['label']) ?>">
|
||||
<?php foreach ($native_player_sources as $src): ?>
|
||||
<source src="<?= h($src['url']) ?>" type="<?= h($src['mime']) ?>" label="<?= h($src['label']) ?>">
|
||||
<?php endforeach; ?>
|
||||
<p class="vjs-no-js">Your browser does not support HTML video.</p>
|
||||
</video>
|
||||
|
||||
Reference in New Issue
Block a user