Added video title to window title if it was present.

This commit is contained in:
ArabCoders 2024-11-03 18:40:48 +03:00
parent a672d273d7
commit 8b85a39180
2 changed files with 19 additions and 2 deletions

View file

@ -16,7 +16,7 @@
<div class="modal-background"></div> <div class="modal-background"></div>
<div class="modal-content"> <div class="modal-content">
<VideoPlayer type="default" :link="video_link" :isMuted="false" autoplay="true" :isControls="true" <VideoPlayer type="default" :link="video_link" :isMuted="false" autoplay="true" :isControls="true"
class="is-fullwidth" @closeModel="video_link = ''" /> :title="video_title" class="is-fullwidth" @closeModel="video_link = ''; video_title = ''" />
</div> </div>
<button class="modal-close is-large" aria-label="close" @click="video_link = ''"></button> <button class="modal-close is-large" aria-label="close" @click="video_link = ''"></button>
</div> </div>
@ -53,6 +53,7 @@ const socket = ref()
const downloading = reactive({}) const downloading = reactive({})
const completed = reactive({}) const completed = reactive({})
const video_link = ref('') const video_link = ref('')
const video_title = ref('')
const addForm = useStorage('addForm', true) const addForm = useStorage('addForm', true)
const showTasks = useStorage('showTasks', false) const showTasks = useStorage('showTasks', false)
const cli_output = ref([]) const cli_output = ref([])
@ -231,7 +232,10 @@ const addItem = (item) => {
}); });
}; };
const playItem = item => video_link.value = makeDownload(config, item, 'm3u8'); const playItem = item => {
video_link.value = makeDownload(config, item, 'm3u8');
video_title.value = item.title;
}
const reloadWindow = () => window.location.reload(); const reloadWindow = () => window.location.reload();

View file

@ -77,7 +77,13 @@ onUnmounted(() => {
if (hls) { if (hls) {
hls.destroy() hls.destroy()
} }
window.removeEventListener('keydown', eventFunc) window.removeEventListener('keydown', eventFunc)
if (props.title) {
window.document.title = 'YTPTube'
}
}) })
const prepareVideoPlayer = () => { const prepareVideoPlayer = () => {
@ -97,6 +103,7 @@ const prepareVideoPlayer = () => {
enabled: true, enabled: true,
key: 'plyr' key: 'plyr'
}, },
title: props.title,
mediaMetadata: { mediaMetadata: {
title: props.title title: props.title
}, },
@ -118,5 +125,11 @@ const prepareVideoPlayer = () => {
if (video.value) { if (video.value) {
hls.attachMedia(video.value) hls.attachMedia(video.value)
} }
if (props.title) {
window.document.title = `YTPTube - Playing: ${props.title}`
}
} }
</script> </script>