<?php
    $data = $topic['data'];
?>

<?php if($type == 'video'): ?>
    <?php if($data->video_src_type == 'youtube' || $data->video_src_type == 'vimeo'): ?>
        <div class="plyr__video-embed" id="player">
            <iframe src="<?php echo e($data->video_url); ?>" allowfullscreen allowtransparency allow="autoplay"></iframe>
        </div>
        <script>
            new Plyr("#player", {
                settings: ["speed"],
                seekTime: 0,
                ratio: "16:7",
                speed: {
                    selected: 1,
                    options: [0.5, 0.75, 1, 1.25, 1.5]
                },
            });
        </script>
    <?php elseif($data->video_src_type == 'local'): ?>
        <?php if(
            $data->system_video &&
                fileExists('lms/courses/topics/videos/', $data->system_video) == true &&
                $data->system_video != ''): ?>
            <video id="main-course-video" playsinline controls data-poster="assets/images/course/course-2.png">
                <source src="<?php echo e(asset('storage/lms/courses/topics/videos/' . $data->system_video)); ?>" type="video/mp4" />
            </video>
        <?php endif; ?>
        <script>
            const player = new Plyr("#player", {
                settings: ["speed"],
                seekTime: 0,
                ratio: "16:7",
                speed: {
                    selected: 1,
                    options: [0.5, 0.75, 1, 1.25, 1.5]
                },
            });
        </script>
    <?php endif; ?>
<?php elseif($type == 'reading'): ?>
    <div class="p-5 md:p-8 xl:p-10 relative overflow-hidden aspect-[16/7] bg-primary-50 rounded-xl">
        <div class="size-full overflow-x-hidden overflow-y-auto">
            <h5 class="area-title text-xl"><?php echo e($data->title); ?></h5>
            <div class="area-description mt-5">
                <?php echo clean($data->description); ?>

            </div>
        </div>
    </div>
<?php elseif($type == 'assignment'): ?>
    <div class="p-5 md:p-8 xl:p-10 relative overflow-hidden aspect-[16/7] bg-primary-50 rounded-xl">
        <div class="size-full flex-center">
            <a href="<?php echo e(route('exam.start', ['type' => $type, 'exam_type_id' => $data->id, 'course_id' => $data?->topic?->course_id])); ?>" aria-label="Go to Assignment"
                class="btn b-solid btn-primary-solid">
                <?php echo e(translate('Go to Assignment')); ?>

            </a>
        </div>
    </div>
<?php elseif($type == 'quiz'): ?>
    <div class="p-5 md:p-8 xl:p-10 relative overflow-hidden aspect-[16/7] bg-primary-50 rounded-xl">
        <div class="size-full flex-center">
            <a href="<?php echo e(route('exam.start', ['type' => $type, 'exam_type_id' => $data->id, 'course_id' => $topic['courseId'], 'topic_id' => $topic['topicId'], 'chapterId' => $topic['chapterId']])); ?>" aria-label="Go to Quiz"
                class="btn b-solid btn-primary-solid">
                <?php echo e(translate('Go to Quiz')); ?>

            </a>
        </div>
    </div>
<?php endif; ?>
<?php /**PATH D:\www\edulab\Modules\LMS\resources\views\theme\course\course-learn.blade.php ENDPATH**/ ?>