1
0
Fork 0
mirror of https://github.com/Chocobozzz/PeerTube.git synced 2025-10-05 02:39:33 +02:00

Add video aspect ratio in server

This commit is contained in:
Chocobozzz 2024-02-27 11:18:56 +01:00
parent c75381208f
commit b6b1aaa56f
No known key found for this signature in database
GPG key ID: 583A612D890159BE
52 changed files with 345 additions and 237 deletions

View file

@ -55,7 +55,6 @@ function getFileAttributesFromUrl (
urls: (ActivityTagObject | ActivityUrlObject)[]
) {
const fileUrls = urls.filter(u => isAPVideoUrlObject(u)) as ActivityVideoUrlObject[]
if (fileUrls.length === 0) return []
const attributes: FilteredModelAttributes<VideoFileModel>[] = []
@ -96,6 +95,9 @@ function getFileAttributesFromUrl (
fps: fileUrl.fps || -1,
metadataUrl: metadata?.href,
width: fileUrl.width,
height: fileUrl.height,
// Use the name of the remote file because we don't proxify video file requests
filename: basename(fileUrl.href),
fileUrl: fileUrl.href,
@ -223,6 +225,7 @@ function getVideoAttributesFromObject (videoChannel: MChannelId, videoObject: Vi
waitTranscoding: videoObject.waitTranscoding,
isLive: videoObject.isLiveBroadcast,
state: videoObject.state,
aspectRatio: videoObject.aspectRatio,
channelId: videoChannel.id,
duration: getDurationFromActivityStream(videoObject.duration),
createdAt: new Date(videoObject.published),

View file

@ -143,6 +143,7 @@ export class APVideoUpdater extends APVideoAbstractBuilder {
this.video.channelId = videoData.channelId
this.video.views = videoData.views
this.video.isLive = videoData.isLive
this.video.aspectRatio = videoData.aspectRatio
// Ensures we update the updatedAt attribute, even if main attributes did not change
this.video.changed('updatedAt', true)