- 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:
+4
-4
@@ -83,7 +83,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
$db->prepare("
|
||||
INSERT INTO video_sources (video_id, label, source_type, file_path, source_url, mime_type, quality, sort_order)
|
||||
VALUES (?,?,?,?,?,?,?,?)
|
||||
")->execute([$video_id, $label, 'remote', '', $url, mime_from_ext($url), $quality, $sort]);
|
||||
")->execute([$video_id, $label, 'remote', '', $url, source_storage_mime_from_url($url), $quality, $sort]);
|
||||
$inserted_sources++;
|
||||
continue;
|
||||
}
|
||||
@@ -259,7 +259,7 @@ render_head('Add Video — Admin', '
|
||||
<div class="card">
|
||||
<p class="section-heading">Video Sources</p>
|
||||
<p class="hint" style="margin-bottom:1rem;">
|
||||
Upload a video file or link to an external video URL. The database stores where each source lives, and the player uses that location at playback time.
|
||||
Upload a video file, link a direct media file, or paste a provider page URL such as YouTube or Vimeo. The player will use a provider embed when the URL supports it.
|
||||
Uploaded files: <strong>MP4, WebM, OGV, MOV, MKV, AVI</strong>. Remote URLs must use <strong>http://</strong> or <strong>https://</strong>.
|
||||
</p>
|
||||
|
||||
@@ -270,7 +270,7 @@ render_head('Add Video — Admin', '
|
||||
<label class="form-label">Source</label>
|
||||
<select class="form-select source-type-select" name="source_type[]">
|
||||
<option value="local" selected>Upload</option>
|
||||
<option value="remote">External URL</option>
|
||||
<option value="remote">External URL / Embed</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group source-location-panel source-location-local">
|
||||
@@ -281,7 +281,7 @@ render_head('Add Video — Admin', '
|
||||
</div>
|
||||
<div class="form-group source-location-panel source-location-remote" hidden>
|
||||
<label class="form-label">External URL</label>
|
||||
<input class="form-input" type="url" name="source_url[]" placeholder="https://example.com/video.mp4">
|
||||
<input class="form-input" type="url" name="source_url[]" placeholder="https://www.youtube.com/watch?v=...">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="form-label">Quality Label</label>
|
||||
|
||||
+6
-6
@@ -103,7 +103,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
if ($source_type === 'remote') {
|
||||
$sql .= ", source_url=?, mime_type=?";
|
||||
$params[] = $source_url;
|
||||
$params[] = mime_from_ext($source_url);
|
||||
$params[] = source_storage_mime_from_url($source_url);
|
||||
}
|
||||
$sql .= " WHERE id=? AND video_id=?";
|
||||
$params[] = (int)$sid;
|
||||
@@ -149,7 +149,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
$db->prepare("
|
||||
INSERT INTO video_sources (video_id, label, source_type, file_path, source_url, mime_type, quality, sort_order)
|
||||
VALUES (?,?,?,?,?,?,?,?)
|
||||
")->execute([$id, $label, 'remote', '', $url, mime_from_ext($url), $quality, $sort]);
|
||||
")->execute([$id, $label, 'remote', '', $url, source_storage_mime_from_url($url), $quality, $sort]);
|
||||
$inserted_source_ids[] = (int)$db->lastInsertId();
|
||||
continue;
|
||||
}
|
||||
@@ -340,7 +340,7 @@ render_head('Edit Video — Admin', '
|
||||
<div class="source-item-header">
|
||||
<div>
|
||||
<span class="source-badge <?= source_is_remote($s) ? 'source-badge-remote' : 'source-badge-local' ?>">
|
||||
<?= source_is_remote($s) ? 'External URL' : 'Uploaded File' ?>
|
||||
<?= h(source_provider_label($s)) ?>
|
||||
</span>
|
||||
<div class="source-item-file"><?= h(source_location($s)) ?></div>
|
||||
<div class="source-item-mime"><?= h($s['mime_type']) ?></div>
|
||||
@@ -389,14 +389,14 @@ render_head('Edit Video — Admin', '
|
||||
<!-- ── Add new sources ── -->
|
||||
<div class="card" style="margin-bottom:1rem;">
|
||||
<p class="section-heading">Add New Sources</p>
|
||||
<p class="hint" style="margin-bottom:.85rem;">Upload another file or link an external URL. Remote URLs must use http:// or https://.</p>
|
||||
<p class="hint" style="margin-bottom:.85rem;">Upload another file, link a direct media file, or paste a provider page URL such as YouTube or Vimeo.</p>
|
||||
<div class="source-list" id="new-sources-container">
|
||||
<div class="add-source-row" data-new-row="0">
|
||||
<div class="form-group">
|
||||
<label class="form-label">Source</label>
|
||||
<select class="form-select source-type-select" name="new_source_type[]">
|
||||
<option value="local" selected>Upload</option>
|
||||
<option value="remote">External URL</option>
|
||||
<option value="remote">External URL / Embed</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group source-location-panel source-location-local">
|
||||
@@ -407,7 +407,7 @@ render_head('Edit Video — Admin', '
|
||||
</div>
|
||||
<div class="form-group source-location-panel source-location-remote" hidden>
|
||||
<label class="form-label">External URL</label>
|
||||
<input class="form-input" type="url" name="new_source_url[]" placeholder="https://example.com/video.mp4">
|
||||
<input class="form-input" type="url" name="new_source_url[]" placeholder="https://www.youtube.com/watch?v=...">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="form-label">Quality</label>
|
||||
|
||||
Reference in New Issue
Block a user