diff options
Diffstat (limited to 'client/src/assets/player')
-rw-r--r-- | client/src/assets/player/playlist/playlist-menu-item.ts | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/client/src/assets/player/playlist/playlist-menu-item.ts b/client/src/assets/player/playlist/playlist-menu-item.ts index 21a7f8046..87a72b6a3 100644 --- a/client/src/assets/player/playlist/playlist-menu-item.ts +++ b/client/src/assets/player/playlist/playlist-menu-item.ts | |||
@@ -1,6 +1,7 @@ | |||
1 | import videojs from 'video.js' | 1 | import videojs from 'video.js' |
2 | import { VideoPlaylistElement } from '@shared/models' | 2 | import { VideoPlaylistElement } from '@shared/models' |
3 | import { PlaylistItemOptions } from '../peertube-videojs-typings' | 3 | import { PlaylistItemOptions } from '../peertube-videojs-typings' |
4 | import { secondsToTime } from '../utils' | ||
4 | 5 | ||
5 | const Component = videojs.getComponent('Component') | 6 | const Component = videojs.getComponent('Component') |
6 | 7 | ||
@@ -61,6 +62,8 @@ class PlaylistMenuItem extends Component { | |||
61 | } | 62 | } |
62 | 63 | ||
63 | private buildAvailableVideo (li: HTMLElement, positionBlock: HTMLElement, options: PlaylistItemOptions) { | 64 | private buildAvailableVideo (li: HTMLElement, positionBlock: HTMLElement, options: PlaylistItemOptions) { |
65 | const videoElement = options.element | ||
66 | |||
64 | const player = super.createEl('div', { | 67 | const player = super.createEl('div', { |
65 | className: 'item-player' | 68 | className: 'item-player' |
66 | }) | 69 | }) |
@@ -68,7 +71,7 @@ class PlaylistMenuItem extends Component { | |||
68 | positionBlock.appendChild(player) | 71 | positionBlock.appendChild(player) |
69 | 72 | ||
70 | const thumbnail = super.createEl('img', { | 73 | const thumbnail = super.createEl('img', { |
71 | src: window.location.origin + options.element.video.thumbnailPath | 74 | src: window.location.origin + videoElement.video.thumbnailPath |
72 | }) | 75 | }) |
73 | 76 | ||
74 | const infoBlock = super.createEl('div', { | 77 | const infoBlock = super.createEl('div', { |
@@ -76,18 +79,32 @@ class PlaylistMenuItem extends Component { | |||
76 | }) | 79 | }) |
77 | 80 | ||
78 | const title = super.createEl('div', { | 81 | const title = super.createEl('div', { |
79 | innerHTML: options.element.video.name, | 82 | innerHTML: videoElement.video.name, |
80 | className: 'title' | 83 | className: 'title' |
81 | }) | 84 | }) |
82 | 85 | ||
83 | const channel = super.createEl('div', { | 86 | const channel = super.createEl('div', { |
84 | innerHTML: options.element.video.channel.displayName, | 87 | innerHTML: videoElement.video.channel.displayName, |
85 | className: 'channel' | 88 | className: 'channel' |
86 | }) | 89 | }) |
87 | 90 | ||
88 | infoBlock.appendChild(title) | 91 | infoBlock.appendChild(title) |
89 | infoBlock.appendChild(channel) | 92 | infoBlock.appendChild(channel) |
90 | 93 | ||
94 | if (videoElement.startTimestamp || videoElement.stopTimestamp) { | ||
95 | let html = '' | ||
96 | |||
97 | if (videoElement.startTimestamp) html += secondsToTime(videoElement.startTimestamp) | ||
98 | if (videoElement.stopTimestamp) html += ' - ' + secondsToTime(videoElement.stopTimestamp) | ||
99 | |||
100 | const timestamps = super.createEl('div', { | ||
101 | innerHTML: html, | ||
102 | className: 'timestamps' | ||
103 | }) | ||
104 | |||
105 | infoBlock.append(timestamps) | ||
106 | } | ||
107 | |||
91 | li.append(thumbnail) | 108 | li.append(thumbnail) |
92 | li.append(infoBlock) | 109 | li.append(infoBlock) |
93 | } | 110 | } |