From 46ef6f9056f8bdce9b246cc4dedbd5091cd1317a Mon Sep 17 00:00:00 2001 From: MinamiFunakoshiTR Date: Wed, 26 Mar 2025 12:48:47 -0700 Subject: [PATCH] working on Controls --- src/components/Video/Video.svelte | 2 +- .../Video/components/Controls.svelte | 50 ++++++++++++++----- 2 files changed, 39 insertions(+), 13 deletions(-) diff --git a/src/components/Video/Video.svelte b/src/components/Video/Video.svelte index cbba6f7e..1bbed5e1 100644 --- a/src/components/Video/Video.svelte +++ b/src/components/Video/Video.svelte @@ -208,7 +208,7 @@ {#if possibleToPlayPause} {#if showControls} import Fa from 'svelte-fa'; import { faReply, faPlay, faPause } from '@fortawesome/free-solid-svg-icons'; - import { createEventDispatcher } from 'svelte'; - const dispatch = createEventDispatcher(); + interface Props { + /** Function that controls pause/play event */ + pausePlayEvent: (e: CustomEvent) => void; + /** Boolean, paused or playing */ + paused: boolean; + /** Boolean, clicked on pause button */ + clickedOnPauseBtn: boolean; + /** Change the opacity of the play/pause button */ + controlsOpacity?: number; + /** Have four options for controls position - top right, top left, bottom right, bottom left */ + controlsPosition?: + | 'top right' + | 'top left' + | 'bottom right' + | 'bottom left'; + /** Width of the video container */ + widthVideoContainer: number; + /** Height of the video container */ + heightVideoContainer: number; + /** Colour of the controls */ + controlsBorderOffset: number; + /** Whether to use a separate replay icon or use the play icon for replay as well */ + separateReplayIcon?: boolean; + /** Change the colour of the play/pause button */ + controlsColour?: string; + /** Whether to reset condition */ + resetCondition: boolean; + } let { + pausePlayEvent, paused = $bindable(), clickedOnPauseBtn = $bindable(), controlsOpacity, @@ -16,20 +43,19 @@ resetCondition, separateReplayIcon, controlsColour, - } = $props(); + }: Props = $props(); function forwardBtnClick() { paused = !paused; clickedOnPauseBtn = paused === true; // so video doesn't autoplay when coming into view again if paused previously - dispatch('pausePlayEvent', { - paused, - clickedOnPauseBtn, - }); }