How to register CDN in Laravel-Filament?
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/video.min.js"></script>
<script src="https://cdn.tailwindcss.com"></script>
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/video-js.min.css" rel="stylesheet" />
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/videojs-contrib-eme.min.js"></script>
I tried to include it in app.blade.php but when I check it in dev tools elements it's not there
6 Replies
I already run php artisan filament:assets, what to do next?
where to locate this?
use Filament\Support\Assets\Js;
FilamentAsset::register([
Js::make('example-external-script', 'https://example.com/external.js'),
Js::make('example-local-script', asset('js/local.js')),
]);
You can add to the Appserviceprovider
can I revert the php artisan filament:assets ? since I only need to register it in the appService Provider
I think you could run
php artisan filament:upgrade
to replace these filesCan I include script in blade? this is not a filament page but only on a blade for video.. because when I do like this, the scipt I included is not found when I inspect
video.blade
@if($getRecord())
<div class="h-screen flex justify-center gap-3 w-full">
<div class="h-screen aspect-video ">
<video id="video-player" class="h-screen video-js vjs-default-skin vjs-16-9" controls data-setup="{}" controlsList="nodownload" @if($getRecord()->subtitles->count() > 0) crossorigin="anonymous" @endif>
<source
src="{{ $getRecord()->video?->full_url }}"
type="{{ $getRecord()->video?->type ?? 'video/mp4' }}"
>
Your browser does not support the video tag.
@foreach($getRecord()->subtitles as $subtitle)
<track
src="{{ $subtitle->file?->full_url }}"
srclang="{{ $subtitle->language?->iso_639 }}"
lang="{{ $subtitle->language?->bcp_47 }}"
label="{{ $subtitle->language?->name }}"
kind="subtitles"
@if(($getRecord()->defaultSubtitle[0]?->id ?? null) === $subtitle->id) default @endif"
/>
@endforeach
</video>
<video id="video-player" class="video-js vjs-default-skin vjs-16-9" controls data-setup="{}" />
</div>
</div>
@push('scripts')
<script>
var drmData = {!! json_encode($drmData, JSON_HEX_TAG) !!};
</script>
<script type="text/javascript" src="{{ asset('js/pallycon-helper.js') }}"></script>
<script type="text/javascript" src="{{ asset('js/video-player.js') }}"></script>
@endpush
@endif