Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show message when the live chat is unavailable #3327

Merged
merged 2 commits into from
Mar 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
.card.hasError {
height: auto !important;
padding: 16px;
}

.relative {
position: relative;
}
Expand All @@ -12,6 +17,11 @@
text-align: center;
}

.messageContainer.hasError {
flex-direction: column;
row-gap: 16px;
}

.message {
font-size: 18px;
color: var(--tertiary-text-color);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,12 @@ export default defineComponent({
} else {
switch (this.backendPreference) {
case 'local':
this.liveChatInstance = this.liveChat
this.startLiveChatLocal()
if (this.liveChat) {
this.liveChatInstance = this.liveChat
this.startLiveChatLocal()
} else {
this.showLiveChatUnavailable()
}
break
case 'invidious':
if (this.backendFallback) {
Expand All @@ -114,9 +118,21 @@ export default defineComponent({

getLiveChatLocal: async function () {
const videoInfo = await getLocalVideoInfo(this.videoId)
this.liveChatInstance = videoInfo.getLiveChat()

this.startLiveChatLocal()
if (videoInfo.livechat) {
this.liveChatInstance = videoInfo.getLiveChat()

this.startLiveChatLocal()
} else {
this.showLiveChatUnavailable()
}
},

showLiveChatUnavailable: function () {
this.hasError = true
this.errorMessage = this.$t('Video["Live Chat is unavailable for this stream. It may have been disabled by the uploader."]')
this.isLoading = false
this.showEnableChat = false
},

startLiveChatLocal: function () {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
<template>
<ft-card
class="relative"
class="card relative"
:class="{ hasError }"
>
<ft-loader
v-if="isLoading"
/>
<div
v-else-if="hasError"
class="messageContainer"
:class="{ hasError }"
>
<p
class="message"
Expand Down
1 change: 1 addition & 0 deletions static/locales/en-US.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -601,6 +601,7 @@ Video:
'Live Chat is currently not supported with the Invidious API. A direct connection to YouTube is required.': Live
Chat is currently not supported with the Invidious API. A direct connection to
YouTube is required.
'Live Chat is unavailable for this stream. It may have been disabled by the uploader.': 'Live Chat is unavailable for this stream. It may have been disabled by the uploader.'
Show Super Chat Comment: Show Super Chat Comment
Scroll to Bottom: Scroll to Bottom
Download Video: Download Video
Expand Down