fix: show alert instead of notification for missing video file.

This commit is contained in:
arabcoders 2026-02-05 16:18:32 +03:00
parent 435882e16b
commit c67c9912cc
4 changed files with 20 additions and 7 deletions

View file

@ -201,4 +201,5 @@ dev = [
"pytest>=8.4.2",
"pytest-asyncio>=1.1.0",
"ruff>=0.13.0",
"pip>=26.0.0",
]

View file

@ -474,7 +474,7 @@
<div class="modal-background" @click="closeVideo"></div>
<div class="modal-content is-unbounded-model">
<VideoPlayer type="default" :isMuted="false" autoplay="true" :isControls="true" :item="video_item"
class="is-fullwidth" @closeModel="closeVideo" />
class="is-fullwidth" @closeModel="closeVideo" @error="async (error: string) => await box.alert(error)" />
</div>
<button class="modal-close is-large" aria-label="close" @click="closeVideo"></button>
</div>

View file

@ -260,11 +260,12 @@ import type { StoreItem } from '~/types/store'
import type { file_info, video_source_element, video_track_element } from '~/types/video'
const config = useConfigStore()
const toast = useNotification()
const props = defineProps({ item: { type: Object as () => StoreItem, default: () => ({}) } })
const emitter = defineEmits(['closeModel'])
const props = defineProps<{ item: StoreItem }>()
const emitter = defineEmits<{
(e: 'closeModel'): void,
(e: 'error', message: string): void,
}>()
const video = useTemplateRef<HTMLVideoElement>('video')
const tracks = ref<Array<video_track_element>>([])
@ -486,7 +487,7 @@ onMounted(async () => {
const response: file_info = await req.json()
if (!req.ok) {
toast.error(`Failed to fetch video info. ${response?.error}`)
emitter('error', response?.error || 'Failed to fetch video info. Unknown error')
emitter('closeModel')
return
}
@ -746,7 +747,7 @@ const forceSwitchToHls = () => {
}
if (!hasVideoStream.value) {
toast.error('Cannot switch to HLS: stream has no video track.')
useNotification().error('Cannot switch to HLS: stream has no video track.')
return
}

11
uv.lock
View file

@ -928,6 +928,15 @@ wheels = [
{ url = "https://files.pythonhosted.org/packages/54/16/12b82f791c7f50ddec566873d5bdd245baa1491bac11d15ffb98aecc8f8b/pefile-2024.8.26-py3-none-any.whl", hash = "sha256:76f8b485dcd3b1bb8166f1128d395fa3d87af26360c2358fb75b80019b957c6f", size = 74766 },
]
[[package]]
name = "pip"
version = "26.0.1"
source = { registry = "https://pypi.org/simple" }
sdist = { url = "https://files.pythonhosted.org/packages/48/83/0d7d4e9efe3344b8e2fe25d93be44f64b65364d3c8d7bc6dc90198d5422e/pip-26.0.1.tar.gz", hash = "sha256:c4037d8a277c89b320abe636d59f91e6d0922d08a05b60e85e53b296613346d8", size = 1812747 }
wheels = [
{ url = "https://files.pythonhosted.org/packages/de/f0/c81e05b613866b76d2d1066490adf1a3dbc4ee9d9c839961c3fc8a6997af/pip-26.0.1-py3-none-any.whl", hash = "sha256:bdb1b08f4274833d62c1aa29e20907365a2ceb950410df15fc9521bad440122b", size = 1787723 },
]
[[package]]
name = "platformdirs"
version = "4.5.1"
@ -2069,6 +2078,7 @@ installer = [
[package.dev-dependencies]
dev = [
{ name = "debugpy" },
{ name = "pip" },
{ name = "pytest" },
{ name = "pytest-asyncio" },
{ name = "ruff" },
@ -2118,6 +2128,7 @@ provides-extras = ["installer"]
[package.metadata.requires-dev]
dev = [
{ name = "debugpy", specifier = ">=1.8.16" },
{ name = "pip", specifier = ">=26.0.0" },
{ name = "pytest", specifier = ">=8.4.2" },
{ name = "pytest-asyncio", specifier = ">=1.1.0" },
{ name = "ruff", specifier = ">=0.13.0" },