diff options
author | Chocobozzz <me@florianbigard.com> | 2023-06-01 14:51:16 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2023-06-29 10:16:55 +0200 |
commit | d8f39b126d9fe4bec1c12fb213548cc6edc87867 (patch) | |
tree | 7f0f1cb23165cf4dd789b2d78b1fef7ee116f647 /client/src/app/+videos | |
parent | 1fb7d094229acdc190c3f7551b43ac5445814dee (diff) | |
download | PeerTube-d8f39b126d9fe4bec1c12fb213548cc6edc87867.tar.gz PeerTube-d8f39b126d9fe4bec1c12fb213548cc6edc87867.tar.zst PeerTube-d8f39b126d9fe4bec1c12fb213548cc6edc87867.zip |
Add storyboard support
Diffstat (limited to 'client/src/app/+videos')
-rw-r--r-- | client/src/app/+videos/+video-watch/video-watch.component.ts | 45 |
1 files changed, 42 insertions, 3 deletions
diff --git a/client/src/app/+videos/+video-watch/video-watch.component.ts b/client/src/app/+videos/+video-watch/video-watch.component.ts index aba3ee086..43744789d 100644 --- a/client/src/app/+videos/+video-watch/video-watch.component.ts +++ b/client/src/app/+videos/+video-watch/video-watch.component.ts | |||
@@ -33,6 +33,7 @@ import { | |||
33 | LiveVideo, | 33 | LiveVideo, |
34 | PeerTubeProblemDocument, | 34 | PeerTubeProblemDocument, |
35 | ServerErrorCode, | 35 | ServerErrorCode, |
36 | Storyboard, | ||
36 | VideoCaption, | 37 | VideoCaption, |
37 | VideoPrivacy, | 38 | VideoPrivacy, |
38 | VideoState | 39 | VideoState |
@@ -69,6 +70,7 @@ export class VideoWatchComponent implements OnInit, OnDestroy { | |||
69 | videoCaptions: VideoCaption[] = [] | 70 | videoCaptions: VideoCaption[] = [] |
70 | liveVideo: LiveVideo | 71 | liveVideo: LiveVideo |
71 | videoPassword: string | 72 | videoPassword: string |
73 | storyboards: Storyboard[] = [] | ||
72 | 74 | ||
73 | playlistPosition: number | 75 | playlistPosition: number |
74 | playlist: VideoPlaylist = null | 76 | playlist: VideoPlaylist = null |
@@ -285,9 +287,10 @@ export class VideoWatchComponent implements OnInit, OnDestroy { | |||
285 | forkJoin([ | 287 | forkJoin([ |
286 | videoAndLiveObs, | 288 | videoAndLiveObs, |
287 | this.videoCaptionService.listCaptions(videoId, videoPassword), | 289 | this.videoCaptionService.listCaptions(videoId, videoPassword), |
290 | this.videoService.getStoryboards(videoId), | ||
288 | this.userService.getAnonymousOrLoggedUser() | 291 | this.userService.getAnonymousOrLoggedUser() |
289 | ]).subscribe({ | 292 | ]).subscribe({ |
290 | next: ([ { video, live, videoFileToken }, captionsResult, loggedInOrAnonymousUser ]) => { | 293 | next: ([ { video, live, videoFileToken }, captionsResult, storyboards, loggedInOrAnonymousUser ]) => { |
291 | const queryParams = this.route.snapshot.queryParams | 294 | const queryParams = this.route.snapshot.queryParams |
292 | 295 | ||
293 | const urlOptions = { | 296 | const urlOptions = { |
@@ -309,6 +312,7 @@ export class VideoWatchComponent implements OnInit, OnDestroy { | |||
309 | video, | 312 | video, |
310 | live, | 313 | live, |
311 | videoCaptions: captionsResult.data, | 314 | videoCaptions: captionsResult.data, |
315 | storyboards, | ||
312 | videoFileToken, | 316 | videoFileToken, |
313 | videoPassword, | 317 | videoPassword, |
314 | loggedInOrAnonymousUser, | 318 | loggedInOrAnonymousUser, |
@@ -414,6 +418,7 @@ export class VideoWatchComponent implements OnInit, OnDestroy { | |||
414 | video: VideoDetails | 418 | video: VideoDetails |
415 | live: LiveVideo | 419 | live: LiveVideo |
416 | videoCaptions: VideoCaption[] | 420 | videoCaptions: VideoCaption[] |
421 | storyboards: Storyboard[] | ||
417 | videoFileToken: string | 422 | videoFileToken: string |
418 | videoPassword: string | 423 | videoPassword: string |
419 | 424 | ||
@@ -421,7 +426,17 @@ export class VideoWatchComponent implements OnInit, OnDestroy { | |||
421 | loggedInOrAnonymousUser: User | 426 | loggedInOrAnonymousUser: User |
422 | forceAutoplay: boolean | 427 | forceAutoplay: boolean |
423 | }) { | 428 | }) { |
424 | const { video, live, videoCaptions, urlOptions, videoFileToken, videoPassword, loggedInOrAnonymousUser, forceAutoplay } = options | 429 | const { |
430 | video, | ||
431 | live, | ||
432 | videoCaptions, | ||
433 | storyboards, | ||
434 | urlOptions, | ||
435 | videoFileToken, | ||
436 | videoPassword, | ||
437 | loggedInOrAnonymousUser, | ||
438 | forceAutoplay | ||
439 | } = options | ||
425 | 440 | ||
426 | this.subscribeToLiveEventsIfNeeded(this.video, video) | 441 | this.subscribeToLiveEventsIfNeeded(this.video, video) |
427 | 442 | ||
@@ -430,6 +445,7 @@ export class VideoWatchComponent implements OnInit, OnDestroy { | |||
430 | this.liveVideo = live | 445 | this.liveVideo = live |
431 | this.videoFileToken = videoFileToken | 446 | this.videoFileToken = videoFileToken |
432 | this.videoPassword = videoPassword | 447 | this.videoPassword = videoPassword |
448 | this.storyboards = storyboards | ||
433 | 449 | ||
434 | // Re init attributes | 450 | // Re init attributes |
435 | this.playerPlaceholderImgSrc = undefined | 451 | this.playerPlaceholderImgSrc = undefined |
@@ -485,6 +501,7 @@ export class VideoWatchComponent implements OnInit, OnDestroy { | |||
485 | const params = { | 501 | const params = { |
486 | video: this.video, | 502 | video: this.video, |
487 | videoCaptions: this.videoCaptions, | 503 | videoCaptions: this.videoCaptions, |
504 | storyboards: this.storyboards, | ||
488 | liveVideo: this.liveVideo, | 505 | liveVideo: this.liveVideo, |
489 | videoFileToken: this.videoFileToken, | 506 | videoFileToken: this.videoFileToken, |
490 | videoPassword: this.videoPassword, | 507 | videoPassword: this.videoPassword, |
@@ -636,6 +653,7 @@ export class VideoWatchComponent implements OnInit, OnDestroy { | |||
636 | video: VideoDetails | 653 | video: VideoDetails |
637 | liveVideo: LiveVideo | 654 | liveVideo: LiveVideo |
638 | videoCaptions: VideoCaption[] | 655 | videoCaptions: VideoCaption[] |
656 | storyboards: Storyboard[] | ||
639 | 657 | ||
640 | videoFileToken: string | 658 | videoFileToken: string |
641 | videoPassword: string | 659 | videoPassword: string |
@@ -646,7 +664,17 @@ export class VideoWatchComponent implements OnInit, OnDestroy { | |||
646 | forceAutoplay: boolean | 664 | forceAutoplay: boolean |
647 | user?: AuthUser // Keep for plugins | 665 | user?: AuthUser // Keep for plugins |
648 | }) { | 666 | }) { |
649 | const { video, liveVideo, videoCaptions, videoFileToken, videoPassword, urlOptions, loggedInOrAnonymousUser, forceAutoplay } = params | 667 | const { |
668 | video, | ||
669 | liveVideo, | ||
670 | videoCaptions, | ||
671 | storyboards, | ||
672 | videoFileToken, | ||
673 | videoPassword, | ||
674 | urlOptions, | ||
675 | loggedInOrAnonymousUser, | ||
676 | forceAutoplay | ||
677 | } = params | ||
650 | 678 | ||
651 | const getStartTime = () => { | 679 | const getStartTime = () => { |
652 | const byUrl = urlOptions.startTime !== undefined | 680 | const byUrl = urlOptions.startTime !== undefined |
@@ -673,6 +701,15 @@ export class VideoWatchComponent implements OnInit, OnDestroy { | |||
673 | src: environment.apiUrl + c.captionPath | 701 | src: environment.apiUrl + c.captionPath |
674 | })) | 702 | })) |
675 | 703 | ||
704 | const storyboard = storyboards.length !== 0 | ||
705 | ? { | ||
706 | url: environment.apiUrl + storyboards[0].storyboardPath, | ||
707 | height: storyboards[0].spriteHeight, | ||
708 | width: storyboards[0].spriteWidth, | ||
709 | interval: storyboards[0].spriteDuration | ||
710 | } | ||
711 | : undefined | ||
712 | |||
676 | const liveOptions = video.isLive | 713 | const liveOptions = video.isLive |
677 | ? { latencyMode: liveVideo.latencyMode } | 714 | ? { latencyMode: liveVideo.latencyMode } |
678 | : undefined | 715 | : undefined |
@@ -734,6 +771,7 @@ export class VideoWatchComponent implements OnInit, OnDestroy { | |||
734 | videoPassword: () => videoPassword, | 771 | videoPassword: () => videoPassword, |
735 | 772 | ||
736 | videoCaptions: playerCaptions, | 773 | videoCaptions: playerCaptions, |
774 | storyboard, | ||
737 | 775 | ||
738 | videoShortUUID: video.shortUUID, | 776 | videoShortUUID: video.shortUUID, |
739 | videoUUID: video.uuid, | 777 | videoUUID: video.uuid, |
@@ -767,6 +805,7 @@ export class VideoWatchComponent implements OnInit, OnDestroy { | |||
767 | else mode = 'webtorrent' | 805 | else mode = 'webtorrent' |
768 | } | 806 | } |
769 | 807 | ||
808 | // FIXME: remove, we don't support these old web browsers anymore | ||
770 | // p2p-media-loader needs TextEncoder, fallback on WebTorrent if not available | 809 | // p2p-media-loader needs TextEncoder, fallback on WebTorrent if not available |
771 | if (typeof TextEncoder === 'undefined') { | 810 | if (typeof TextEncoder === 'undefined') { |
772 | mode = 'webtorrent' | 811 | mode = 'webtorrent' |