From 042e550d4df47504c8b0c7d344f8e0b716c5b27f Mon Sep 17 00:00:00 2001 From: Andre Torquato Date: Sat, 15 Nov 2025 13:18:52 -0300 Subject: [PATCH 1/2] chore(player): remove video details when video paused --- src/components/Player.vue | 86 +++++++++++++++++++-------------------- 1 file changed, 42 insertions(+), 44 deletions(-) diff --git a/src/components/Player.vue b/src/components/Player.vue index c01284a..5a35079 100644 --- a/src/components/Player.vue +++ b/src/components/Player.vue @@ -9,31 +9,29 @@ -
-
-
-

{{ title }}

-

{{ subtitle }}

-

{{ description }}

+
+
+
-
-
-
- -
+
+
+ +
-
- -
+
+ +
@@ -158,7 +156,7 @@ function resetPlayer() { for (const idx in prefetchedBlobUrls) { try { URL.revokeObjectURL(prefetchedBlobUrls[parseInt(idx)]); - } catch { + } catch { // TODO: } } @@ -174,7 +172,7 @@ function resetPlayer() { try { video.pause(); - } catch (e) { + } catch { // TODO: } @@ -233,7 +231,7 @@ async function loadManifest(url: string) { duration.value = totalDuration; loadChunk(0, 0); - } catch (e) { + } catch { isLoading.value = false; } } @@ -334,18 +332,18 @@ function seekGlobal(targetSeconds: number) { loadChunk(safeIndex, offsetInChunk); } - const handleBack = () => { - const video = videoRef.value; - if (video && !video.paused) { - video.pause(); - } - - if ((window as any)?.shellNavigate) { - (window as any).shellNavigate("/catalog"); - } else { - window.location.href = '/catalog'; - } - }; +const handleBack = () => { + const video = videoRef.value; + if (video && !video.paused) { + video.pause(); + } + + if ((window as any)?.shellNavigate) { + (window as any).shellNavigate("/catalog"); + } else { + window.location.href = '/catalog'; + } +}; const handleMouseMove = () => { showControls.value = true; @@ -469,14 +467,14 @@ const handleTimeUpdate = () => { // Usa tempo global quando há chunks const globalCurrent = getGlobalCurrentTime(); currentTime.value = globalCurrent; - + // Prefetch do próximo chunk quando está próximo do fim const video = videoRef.value; if (video && !isNaN(video.currentTime)) { const remainingInChunk = (video.duration && !isNaN(video.duration)) ? (video.duration - video.currentTime) : (segmentSeconds - (video.currentTime || 0)); - + if (remainingInChunk < PREFETCH_THRESHOLD) { const nextIndex = currentChunkIndex + 1; prefetchChunk(nextIndex); @@ -511,23 +509,23 @@ onMounted(() => { video.addEventListener('timeupdate', handleTimeUpdate); video.addEventListener('waiting', handleWaiting); video.addEventListener('canplay', handleCanPlay); - + const handleVideoPlay = () => { isPlaying.value = true; showDetails.value = false; }; - + const handleVideoPause = () => { isPlaying.value = false; showDetails.value = true; }; - + handleVideoPlayRef.value = handleVideoPlay; handleVideoPauseRef.value = handleVideoPause; - + video.addEventListener('play', handleVideoPlay); video.addEventListener('pause', handleVideoPause); - + // Quando um chunk termina, vai pro próximo automaticamente const handleChunkEnded = () => { const nextIndex = currentChunkIndex + 1; @@ -566,7 +564,7 @@ onUnmounted(() => { } document.removeEventListener('fullscreenchange', handleFullscreenChange); - + if (controlsTimeoutRef.value) { clearTimeout(controlsTimeoutRef.value); } From 5717cbcb8a90fcec954a9ad9432242c5da054e68 Mon Sep 17 00:00:00 2001 From: Andre Torquato Date: Sat, 15 Nov 2025 13:35:01 -0300 Subject: [PATCH 2/2] fix(player): render title and subtitle dynamic --- src/App.vue | 13 +++++-------- src/components/Player.vue | 9 ++++----- 2 files changed, 9 insertions(+), 13 deletions(-) diff --git a/src/App.vue b/src/App.vue index 6b6b624..0af61ea 100644 --- a/src/App.vue +++ b/src/App.vue @@ -4,9 +4,8 @@ import Player from './components/Player.vue'; import { getVideoDataByHash } from './services/videoLookup'; const manifestUrl = ref(null); -const title = ref('Microfrontends'); -const subtitle = ref('Arquitetura do Futuro'); -const description = ref('Aprenda como construir aplicações escaláveis e modulares usando a arquitetura de microfrontends.'); +const title = ref('Error carregar titulo'); +const subtitle = ref(''); onMounted(async () => { const videoShared = await import('catalog/VideoShared') as any; @@ -17,11 +16,9 @@ onMounted(async () => { if (videoData) { const { metadata } = videoData; - + if (metadata.title) title.value = metadata.title; - if (metadata.synopsis && metadata.synopsis.length > 0) { - description.value = metadata.synopsis.join(' '); - } + if (metadata.category) subtitle.value = metadata.category; if (metadata.manifestUrl) { @@ -43,7 +40,7 @@ onMounted(async () => {