diff --git a/src/renderer/components/watch-video-info/watch-video-info.js b/src/renderer/components/watch-video-info/watch-video-info.js index 71cdf1346d26a..cf4488f9ba73a 100644 --- a/src/renderer/components/watch-video-info/watch-video-info.js +++ b/src/renderer/components/watch-video-info/watch-video-info.js @@ -45,7 +45,7 @@ export default defineComponent({ }, viewCount: { type: Number, - required: true + default: null }, subscriptionCountText: { type: String, @@ -197,7 +197,7 @@ export default defineComponent({ }, parsedViewCount: function () { - if (this.hideVideoViews) { + if (this.hideVideoViews || this.viewCount == null) { return null } diff --git a/src/renderer/views/Watch/Watch.js b/src/renderer/views/Watch/Watch.js index 6b6252c1eeb71..cf6fe45453b6d 100644 --- a/src/renderer/views/Watch/Watch.js +++ b/src/renderer/views/Watch/Watch.js @@ -376,7 +376,7 @@ export default defineComponent({ // extract localised title first and fall back to the not localised one this.videoTitle = result.primary_info?.title.text ?? result.basic_info.title - this.videoViewCount = result.basic_info.view_count ?? extractNumberFromString(result.primary_info.view_count.text) + this.videoViewCount = result.basic_info.view_count ?? (result.primary_info.view_count ? extractNumberFromString(result.primary_info.view_count.text) : null) this.channelId = result.basic_info.channel_id ?? result.secondary_info.owner?.author.id this.channelName = result.basic_info.author ?? result.secondary_info.owner?.author.name @@ -509,7 +509,9 @@ export default defineComponent({ // The apostrophe is intentionally that one (char code 8217), because that is the one YouTube uses const BOT_MESSAGE = 'Sign in to confirm you’re not a bot' - if (playabilityStatus.status === 'UNPLAYABLE' || playabilityStatus.status === 'LOGIN_REQUIRED') { + const isDrmProtected = result.streaming_data?.adaptive_formats.some(format => format.drm_families || format.drm_track_type) + + if (playabilityStatus.status === 'UNPLAYABLE' || playabilityStatus.status === 'LOGIN_REQUIRED' || isDrmProtected) { if (playabilityStatus.error_screen?.offer_id === 'sponsors_only_video') { // Members-only videos can only be watched while logged into a Google account that is a paid channel member // so there is no point trying any other backends as it will always fail @@ -525,6 +527,13 @@ export default defineComponent({ this.isLoading = false this.updateTitle() return + } else if (isDrmProtected) { + // DRM protected videos (e.g. movies) cannot be played in FreeTube, + // as they require the proprietary and closed source Wideview CDM which is understandably not included in standard Electron builds + this.errorMessage = this.$t('Video.DRMProtected') + this.isLoading = false + this.updateTitle() + return } let errorText diff --git a/static/locales/en-US.yaml b/static/locales/en-US.yaml index b3aaa45826c91..ce8a21da08f82 100644 --- a/static/locales/en-US.yaml +++ b/static/locales/en-US.yaml @@ -806,6 +806,7 @@ Video: IP block: 'YouTube has blocked your IP address from watching videos. Please try switching to a different VPN or proxy.' MembersOnly: Members-only videos cannot be watched with FreeTube as they require Google login and paid membership to the uploader's channel. AgeRestricted: Age-restricted videos cannot be watched with FreeTube as they require Google login and using an age-verified YouTube account. + DRMProtected: DRM protected videos cannot be played in FreeTube, as they require proprietary, closed source components. If you want to watch this video please watch it on the official YouTube website in a DRM enabled web browser. More Options: More Options Mark As Watched: Mark As Watched Remove From History: Remove From History