diff --git a/app.vue b/app.vue index 4346316..856794d 100644 --- a/app.vue +++ b/app.vue @@ -1,5 +1,14 @@ + + diff --git a/components/EndModal.vue b/components/EndModal.vue index 7b75a00..ed814ec 100644 --- a/components/EndModal.vue +++ b/components/EndModal.vue @@ -21,8 +21,12 @@ watchEffect(() => {

{{ $t('examEnd') }}

{{ $t('doYouReallyWantToEndExam') }}
-
Tak
-
Nie
+
+ {{ $t('yes') }} +
+
+ {{ $t('no') }} +
diff --git a/components/MediaBox.vue b/components/MediaBox.vue index 452d52a..ba479b7 100644 --- a/components/MediaBox.vue +++ b/components/MediaBox.vue @@ -4,8 +4,6 @@ import { joinURL } from 'ufo'; const runtimeConfig = useRuntimeConfig(); const cdnUrl = runtimeConfig.public.cdn_url; -const route = useRoute(); - const emit = defineEmits(['mediaload']); const props = defineProps<{ @@ -25,18 +23,23 @@ const media = computed(() => { return { name: dotSplit?.join('.'), type }; }); -const video = ref(); +const video = useTemplateRef('video'); function onVideoLoad() { - if (route.path === '/exam') { - video.value.play(); - let duration = video.value.duration; - if (isNaN(duration) || duration == Infinity) { - duration = 0; - } - setTimeout(() => { - emit('mediaload'); - }, duration * 1000); + if (props.phase != 'result') { + const videoPlayInterval = setInterval(() => { + if (video.value) { + video.value.play(); + let duration = video.value.duration; + if (isNaN(duration) || duration == Infinity) { + duration = 0; + } + setTimeout(() => { + emit('mediaload'); + }, duration * 1000); + clearInterval(videoPlayInterval); + } + }, 1000); } } @@ -44,8 +47,11 @@ function onVideoLoad() {