diff options
author | Chocobozzz <me@florianbigard.com> | 2021-06-28 17:30:59 +0200 |
---|---|---|
committer | Chocobozzz <chocobozzz@cpy.re> | 2021-06-29 14:56:35 +0200 |
commit | d4a8e7a65f97bb3257facc13e1ae8ffdbad61ddb (patch) | |
tree | a4cb07318100031951c3dffc61f4f2cb95d2cbd0 /client/src/app/+videos/+video-watch/video-watch.component.ts | |
parent | 62ddc31a9e4b92d7d27898ccfc363f68ab044139 (diff) | |
download | PeerTube-d4a8e7a65f97bb3257facc13e1ae8ffdbad61ddb.tar.gz PeerTube-d4a8e7a65f97bb3257facc13e1ae8ffdbad61ddb.tar.zst PeerTube-d4a8e7a65f97bb3257facc13e1ae8ffdbad61ddb.zip |
Support short uuid for GET video/playlist
Diffstat (limited to 'client/src/app/+videos/+video-watch/video-watch.component.ts')
-rw-r--r-- | client/src/app/+videos/+video-watch/video-watch.component.ts | 26 |
1 files changed, 16 insertions, 10 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 a444dc51f..12b0baebe 100644 --- a/client/src/app/+videos/+video-watch/video-watch.component.ts +++ b/client/src/app/+videos/+video-watch/video-watch.component.ts | |||
@@ -312,7 +312,7 @@ export class VideoWatchComponent implements OnInit, OnDestroy { | |||
312 | 312 | ||
313 | getVideoUrl () { | 313 | getVideoUrl () { |
314 | if (!this.video.url) { | 314 | if (!this.video.url) { |
315 | return this.video.originInstanceUrl + VideoDetails.buildClientUrl(this.video.uuid) | 315 | return this.video.originInstanceUrl + VideoDetails.buildWatchUrl(this.video) |
316 | } | 316 | } |
317 | return this.video.url | 317 | return this.video.url |
318 | } | 318 | } |
@@ -415,7 +415,10 @@ export class VideoWatchComponent implements OnInit, OnDestroy { | |||
415 | 415 | ||
416 | private loadVideo (videoId: string) { | 416 | private loadVideo (videoId: string) { |
417 | // Video did not change | 417 | // Video did not change |
418 | if (this.video && this.video.uuid === videoId) return | 418 | if ( |
419 | this.video && | ||
420 | (this.video.uuid === videoId || this.video.shortUUID === videoId) | ||
421 | ) return | ||
419 | 422 | ||
420 | if (this.player) this.player.pause() | 423 | if (this.player) this.player.pause() |
421 | 424 | ||
@@ -489,7 +492,10 @@ export class VideoWatchComponent implements OnInit, OnDestroy { | |||
489 | 492 | ||
490 | private loadPlaylist (playlistId: string) { | 493 | private loadPlaylist (playlistId: string) { |
491 | // Playlist did not change | 494 | // Playlist did not change |
492 | if (this.playlist && this.playlist.uuid === playlistId) return | 495 | if ( |
496 | this.playlist && | ||
497 | (this.playlist.uuid === playlistId || this.playlist.shortUUID === playlistId) | ||
498 | ) return | ||
493 | 499 | ||
494 | this.playlistService.getVideoPlaylist(playlistId) | 500 | this.playlistService.getVideoPlaylist(playlistId) |
495 | .pipe( | 501 | .pipe( |
@@ -772,13 +778,13 @@ export class VideoWatchComponent implements OnInit, OnDestroy { | |||
772 | 778 | ||
773 | private flushPlayer () { | 779 | private flushPlayer () { |
774 | // Remove player if it exists | 780 | // Remove player if it exists |
775 | if (this.player) { | 781 | if (!this.player) return |
776 | try { | 782 | |
777 | this.player.dispose() | 783 | try { |
778 | this.player = undefined | 784 | this.player.dispose() |
779 | } catch (err) { | 785 | this.player = undefined |
780 | console.error('Cannot dispose player.', err) | 786 | } catch (err) { |
781 | } | 787 | console.error('Cannot dispose player.', err) |
782 | } | 788 | } |
783 | } | 789 | } |
784 | 790 | ||