aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models/video/formatter
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2022-03-04 13:40:02 +0100
committerChocobozzz <chocobozzz@cpy.re>2022-03-09 09:23:10 +0100
commitf443a74649174b2f9347c158e30f8ac7aa3e958a (patch)
treee423bc4e2307477bda4341037b7fa04ad10adae6 /server/models/video/formatter
parent01dd04cd5ab7b55d2a9af7d0ebf405bee9579b09 (diff)
downloadPeerTube-f443a74649174b2f9347c158e30f8ac7aa3e958a.tar.gz
PeerTube-f443a74649174b2f9347c158e30f8ac7aa3e958a.tar.zst
PeerTube-f443a74649174b2f9347c158e30f8ac7aa3e958a.zip
Add latency setting support
Diffstat (limited to 'server/models/video/formatter')
-rw-r--r--server/models/video/formatter/video-format-utils.ts39
1 files changed, 29 insertions, 10 deletions
diff --git a/server/models/video/formatter/video-format-utils.ts b/server/models/video/formatter/video-format-utils.ts
index 7456f37c5..611edf0b9 100644
--- a/server/models/video/formatter/video-format-utils.ts
+++ b/server/models/video/formatter/video-format-utils.ts
@@ -411,15 +411,6 @@ function videoModelToActivityPubObject (video: MVideoAP): VideoObject {
411 views: video.views, 411 views: video.views,
412 sensitive: video.nsfw, 412 sensitive: video.nsfw,
413 waitTranscoding: video.waitTranscoding, 413 waitTranscoding: video.waitTranscoding,
414 isLiveBroadcast: video.isLive,
415
416 liveSaveReplay: video.isLive
417 ? video.VideoLive.saveReplay
418 : null,
419
420 permanentLive: video.isLive
421 ? video.VideoLive.permanentLive
422 : null,
423 414
424 state: video.state, 415 state: video.state,
425 commentsEnabled: video.commentsEnabled, 416 commentsEnabled: video.commentsEnabled,
@@ -431,10 +422,13 @@ function videoModelToActivityPubObject (video: MVideoAP): VideoObject {
431 : null, 422 : null,
432 423
433 updated: video.updatedAt.toISOString(), 424 updated: video.updatedAt.toISOString(),
425
434 mediaType: 'text/markdown', 426 mediaType: 'text/markdown',
435 content: video.description, 427 content: video.description,
436 support: video.support, 428 support: video.support,
429
437 subtitleLanguage, 430 subtitleLanguage,
431
438 icon: icons.map(i => ({ 432 icon: icons.map(i => ({
439 type: 'Image', 433 type: 'Image',
440 url: i.getFileUrl(video), 434 url: i.getFileUrl(video),
@@ -442,11 +436,14 @@ function videoModelToActivityPubObject (video: MVideoAP): VideoObject {
442 width: i.width, 436 width: i.width,
443 height: i.height 437 height: i.height
444 })), 438 })),
439
445 url, 440 url,
441
446 likes: getLocalVideoLikesActivityPubUrl(video), 442 likes: getLocalVideoLikesActivityPubUrl(video),
447 dislikes: getLocalVideoDislikesActivityPubUrl(video), 443 dislikes: getLocalVideoDislikesActivityPubUrl(video),
448 shares: getLocalVideoSharesActivityPubUrl(video), 444 shares: getLocalVideoSharesActivityPubUrl(video),
449 comments: getLocalVideoCommentsActivityPubUrl(video), 445 comments: getLocalVideoCommentsActivityPubUrl(video),
446
450 attributedTo: [ 447 attributedTo: [
451 { 448 {
452 type: 'Person', 449 type: 'Person',
@@ -456,7 +453,9 @@ function videoModelToActivityPubObject (video: MVideoAP): VideoObject {
456 type: 'Group', 453 type: 'Group',
457 id: video.VideoChannel.Actor.url 454 id: video.VideoChannel.Actor.url
458 } 455 }
459 ] 456 ],
457
458 ...buildLiveAPAttributes(video)
460 } 459 }
461} 460}
462 461
@@ -500,3 +499,23 @@ export {
500 getPrivacyLabel, 499 getPrivacyLabel,
501 getStateLabel 500 getStateLabel
502} 501}
502
503// ---------------------------------------------------------------------------
504
505function buildLiveAPAttributes (video: MVideoAP) {
506 if (!video.isLive) {
507 return {
508 isLiveBroadcast: false,
509 liveSaveReplay: null,
510 permanentLive: null,
511 latencyMode: null
512 }
513 }
514
515 return {
516 isLiveBroadcast: true,
517 liveSaveReplay: video.VideoLive.saveReplay,
518 permanentLive: video.VideoLive.permanentLive,
519 latencyMode: video.VideoLive.latencyMode
520 }
521}