Spiele Filme in allen Playern über die gespeicherte Qualitätsleiter.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
8e77defaca
commit
1fb48783bf
14 files changed
+202
-18
No files matched your search
+30
-2
@@ -1,12 +1,18 @@
|
||||
import Hls from 'hls.js';
|
||||
|
||||
document.querySelectorAll('video[data-hls]').forEach((video) => {
|
||||
function attachPlayback(video) {
|
||||
if (!(video instanceof HTMLVideoElement) || video.dataset.playbackReady === '1') {
|
||||
return;
|
||||
}
|
||||
|
||||
const source = video.dataset.hls;
|
||||
|
||||
if (!source) {
|
||||
return;
|
||||
}
|
||||
|
||||
video.dataset.playbackReady = '1';
|
||||
|
||||
if (Hls.isSupported()) {
|
||||
const playback = new Hls();
|
||||
playback.loadSource(source);
|
||||
@@ -18,7 +24,29 @@ document.querySelectorAll('video[data-hls]').forEach((video) => {
|
||||
if (video.canPlayType('application/vnd.apple.mpegurl')) {
|
||||
video.src = source;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function scanPlayback(root) {
|
||||
if (root instanceof HTMLVideoElement) {
|
||||
attachPlayback(root);
|
||||
}
|
||||
|
||||
if (root instanceof Element) {
|
||||
root.querySelectorAll('video[data-hls]').forEach(attachPlayback);
|
||||
}
|
||||
}
|
||||
|
||||
scanPlayback(document);
|
||||
|
||||
new MutationObserver((records) => {
|
||||
records.forEach((record) => {
|
||||
record.addedNodes.forEach((node) => {
|
||||
if (node instanceof Element) {
|
||||
scanPlayback(node);
|
||||
}
|
||||
});
|
||||
});
|
||||
}).observe(document.documentElement, { childList: true, subtree: true });
|
||||
|
||||
document.addEventListener('click', (event) => {
|
||||
const fullscreen = event.target.closest('[data-fullscreen]');
|
||||
|
||||
@@ -2,12 +2,16 @@
|
||||
$metadata = is_array($version->metadata) ? $version->metadata : [];
|
||||
$class = $version->element->output_class;
|
||||
$poster = \App\Domain\Media\ThumbnailRef::url('editorial.card', 'element', $version->element->id, $version->element->thumbnail_path);
|
||||
$playback = $class === 'film' ? app(\App\Http\Controllers\ContentPreviewController::class)->playback($version) : null;
|
||||
@endphp
|
||||
|
||||
@if ($fileUrl)
|
||||
@if ($class === 'film')
|
||||
<video controls preload="metadata" playsinline @if ($poster) poster="{{ $poster }}" @endif src="{{ $fileUrl }}" style="width: 100%; max-height: 70vh; background: #111;"></video>
|
||||
@elseif ($class === 'audio')
|
||||
@if ($class === 'film' && $playback)
|
||||
@include('content.video', ['playback' => $playback, 'poster' => $poster, 'style' => 'width: 100%; max-height: 70vh; background: #111;'])
|
||||
@if ($fileUrl)
|
||||
<p><a href="{{ $fileUrl }}">Datei öffnen</a></p>
|
||||
@endif
|
||||
@elseif ($fileUrl)
|
||||
@if ($class === 'audio')
|
||||
<audio controls preload="metadata" src="{{ $fileUrl }}" style="width: 100%;"></audio>
|
||||
@elseif ($class === 'bild')
|
||||
<img src="{{ $fileUrl }}" alt="{{ $version->element->working_title }}" style="max-width: 100%; height: auto;">
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
<video controls playsinline
|
||||
@if (($preload ?? 'metadata') !== '') preload="{{ $preload ?? 'metadata' }}" @endif
|
||||
@if (filled($poster ?? null)) poster="{{ $poster }}" @endif
|
||||
@if (filled($class ?? null)) class="{{ $class }}" @endif
|
||||
@if (filled($style ?? null)) style="{{ $style }}" @endif
|
||||
@if (($playback['mode'] ?? 'file') === 'hls') data-hls="{{ $playback['url'] }}" @else src="{{ $playback['url'] }}" @endif></video>
|
||||
@@ -470,8 +470,8 @@
|
||||
<p>{{ $detail['summary'] }}</p>
|
||||
@endif
|
||||
@if (($detail['tone'] ?? '') === 'film')
|
||||
@if (filled($detail['file_url'] ?? null))
|
||||
<video class="luf-video" controls preload="none" playsinline src="{{ $detail['file_url'] }}"></video>
|
||||
@if (filled($detail['playback']['url'] ?? null))
|
||||
@include('content.video', ['playback' => $detail['playback'], 'class' => 'luf-video', 'preload' => 'none'])
|
||||
@else
|
||||
<p class="luf-note">Für diese Fassung liegt noch keine abspielbare Datei vor. Ansehen öffnet die vorhandene Vorschau.</p>
|
||||
@endif
|
||||
|
||||
@@ -28,7 +28,10 @@
|
||||
@endif
|
||||
@if ($entry['playable'])
|
||||
<div class="player">
|
||||
<video controls preload="metadata" playsinline @if ($poster = \App\Domain\Media\ThumbnailRef::url('member.thumbnail', 'element', $entry['version']->element->id, $entry['version']->element->thumbnail_path)) poster="{{ $poster }}" @endif @if (($entry['playback'] ?? 'file') === 'hls') data-hls="{{ $entry['url'] }}" @else src="{{ $entry['url'] }}" @endif></video>
|
||||
@include('content.video', [
|
||||
'playback' => ['mode' => $entry['playback'] ?? 'file', 'url' => $entry['url']],
|
||||
'poster' => \App\Domain\Media\ThumbnailRef::url('member.thumbnail', 'element', $entry['version']->element->id, $entry['version']->element->thumbnail_path),
|
||||
])
|
||||
<button class="button button-quiet" type="button" data-fullscreen>Vollbild</button>
|
||||
</div>
|
||||
@elseif ($entry['allowed'] && $entry['url'])
|
||||
|
||||
@@ -20,7 +20,10 @@
|
||||
@if ($node['output_class'] === 'audio')
|
||||
<audio controls preload="metadata" src="{{ $node['view_url'] }}"></audio>
|
||||
@else
|
||||
<video controls preload="metadata" playsinline @if ($node['poster_url'] ?? null) poster="{{ $node['poster_url'] }}" @endif @if (($node['playback'] ?? 'file') === 'hls') data-hls="{{ $node['view_url'] }}" @else src="{{ $node['view_url'] }}" @endif></video>
|
||||
@include('content.video', [
|
||||
'playback' => ['mode' => $node['playback'] ?? 'file', 'url' => $node['view_url']],
|
||||
'poster' => $node['poster_url'] ?? null,
|
||||
])
|
||||
<button class="button button-quiet" type="button" data-fullscreen>Vollbild</button>
|
||||
@endif
|
||||
</div>
|
||||
|
||||
Reference in new issue
Block a user