@extends('layouts.master_two') @section('content')
{{-- @dd($result->video_type) --}}
{{-- --}} @if ($result->video_type == 'normal') @php // Define the MIME types for video and image formats $allVideoFormat = [ 'mpd' => 'application/dash+xml', 'mp4' => 'video/mp4', 'webm' => 'video/webm', 'ogg' => 'video/ogg', 'm3u8' => 'application/x-mpegURL', 'mjpeg' => 'video/x-motion-jpeg', 'avi' => 'video/x-msvideo', 'mov' => 'video/quicktime', 'mkv' => 'video/x-matroska', '3gp' => 'video/3gpp', '3g2' => 'video/3gpp2', 'asf' => 'video/x-ms-asf', 'flv' => 'video/x-flv', 'f4v' => 'video/x-f4v', 'ts' => 'video/mp2t', 'mpeg' => 'video/mpeg', 'mpg' => 'video/mpeg', 'wmv' => 'video/x-ms-wmv', 'divx' => 'video/divx', 'xvid' => 'video/xvid', 'vob' => 'video/dvd', 'mts' => 'video/avchd', 'm2ts' => 'video/avchd', 'hevc' => 'video/hevc', 'h264' => 'video/h264', 'h265' => 'video/h265', 'dv' => 'video/x-dv', 'rm' => 'application/vnd.rn-realmedia', 'rv' => 'video/vnd.rn-realvideo', 'drc' => 'video/x-dirac', ]; $allImageFormat = [ 'jpg' => 'image/jpeg', 'jpeg' => 'image/jpeg', 'png' => 'image/png', 'gif' => 'image/gif', 'bmp' => 'image/bmp', 'webp' => 'image/webp', 'svg' => 'image/svg+xml', ]; // Get the file extension from the stream URL $fileExtension = pathinfo($result['stream_url'], PATHINFO_EXTENSION); $mimeType = null; // Check if the file is a video or image based on the extension if (array_key_exists($fileExtension, $allVideoFormat)) { $mimeType = $allVideoFormat[$fileExtension]; } elseif (array_key_exists($fileExtension, $allImageFormat)) { $mimeType = $allImageFormat[$fileExtension]; } @endphp @if ($mimeType && strpos($mimeType, 'video') !== false) {{-- --}} @elseif ($mimeType && strpos($mimeType, 'image') !== false) Image @else

Unsupported file type.

@endif @elseif ($result->video_type == 'youtube') @php $url = $result['stream_url']; // Full YouTube URL $videoId = null; // Parse the YouTube URL and extract video ID $parsedUrl = parse_url($url); parse_str($parsedUrl['query'] ?? '', $queryParams); // Extract the video ID from query parameters if (isset($queryParams['v'])) { $videoId = $queryParams['v']; } @endphp @endif
@csrf
@endsection