This repository has been archived on 2026-09-27. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
tutoring/resources/views/components/video-player.blade.php
T
2026-01-14 00:54:08 +00:00

37 lines
1.2 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
@props([
'embedSrc' => null,
'provider' => null,
'title' => $title ?? 'Video',
'showTitle' => true,
'headingLevel' => 'h2', // h1–h6
])
@php
$Tag = in_array($headingLevel, ['h1','h2','h3','h4','h5','h6']) ? $headingLevel : 'h2';
@endphp
@if($showTitle)
<{{ $Tag }} class="mb-2 text-lg font-semibold text-gray-800 leading-snug line-clamp-2">
{{ $title }}
</{{ $Tag }}>
@endif
@if($embedSrc)
<div style="position:relative;width:100%;overflow:hidden;border-radius:0.75rem;box-shadow:0 1px 2px rgba(0,0,0,.1);">
<div style="padding-top:56.25%;"></div>
<iframe
src="{{ $embedSrc }}"
style="position:absolute;top:0;left:0;width:100%;height:100%;border:0;"
allow="autoplay; fullscreen; picture-in-picture; clipboard-write; encrypted-media; web-share"
referrerpolicy="strict-origin-when-cross-origin"
title="{{ $title }}"
></iframe>
</div>
@else
<div class="p-4 rounded-lg border border-amber-300 bg-amber-50 text-amber-900">
<p class="font-semibold">We couldn’t embed this video.</p>
<p class="text-sm mt-1">Paste a valid YouTube or Vimeo URL (or the iframe). Example:
<code class="bg-white px-1 py-0.5 rounded">https://vimeo.com/1126512997</code>
</p>
</div>
@endif