Skip to content

ActivityPub-federated video streaming platform using P2P directly in your web browser

Fix resolution label translation

Chocobozzz664e9f96d68c
diff --git a/client/src/app/shared/shared-main/video/video.model.ts b/client/src/app/shared/shared-main/video/video.model.ts
index f732cc049c..9ad798997a 100644
--- a/client/src/app/shared/shared-main/video/video.model.ts
+++ b/client/src/app/shared/shared-main/video/video.model.ts
@@ -207,6 +207,11 @@ export class Video implements VideoServerModel {
this.streamingPlaylists = hash.streamingPlaylists
this.files = hash.files
+
+ for (const file of this.getAllVideoFiles()) {
+ file.resolution.label = peertubeTranslate(file.resolution.label, translations)
+ }
+
this.videoSource = hash.videoSource
this.userHistory = hash.userHistory
@@ -334,6 +339,10 @@ export class Video implements VideoServerModel {
return this.files && this.files.length !== 0
}
+ getAllVideoFiles () {
+ return getAllFiles(this)
+ }
+
isLiveInfoAvailableBy (user: AuthUser) {
return this.isLive &&
user && this.isLocal === true && (this.account.name === user.username || user.hasRight(UserRight.GET_ANY_LIVE))
diff --git a/packages/core-utils/src/videos/common.ts b/packages/core-utils/src/videos/common.ts
index 60c1c1eac7..f2a1898adc 100644
--- a/packages/core-utils/src/videos/common.ts
+++ b/packages/core-utils/src/videos/common.ts
@@ -5,15 +5,17 @@ export function getAllPrivacies () {
}
export function getAllFiles (video: Partial<Pick<VideoDetails, 'files' | 'streamingPlaylists'>>) {
- const files = video.files
+ const files = video.files || []
const hls = getHLS(video)
- if (hls) return files.concat(hls.files)
+ if (hls && Array.isArray(hls.files)) return files.concat(hls.files)
return files
}
export function getHLS (video: Partial<Pick<VideoDetails, 'streamingPlaylists'>>) {
+ if (!Array.isArray(video.streamingPlaylists)) return null
+
return video.streamingPlaylists.find(p => p.type === VideoStreamingPlaylistType.HLS)
}