tutoring/resources/views/components/video-player.blade.php

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', // h1h6
])
@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 couldnt 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