aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/assets
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2020-08-05 11:57:38 +0200
committerChocobozzz <chocobozzz@cpy.re>2020-08-07 08:58:29 +0200
commit1a8c2d74d1022cfddc4a12881a4c167ff3eedb3d (patch)
tree77e8c8a1d5c893ca566c88e92f8d7b519200e6e9 /client/src/assets
parent56674bb9f81775ff85115e7daa7d9be0db95c001 (diff)
downloadPeerTube-1a8c2d74d1022cfddc4a12881a4c167ff3eedb3d.tar.gz
PeerTube-1a8c2d74d1022cfddc4a12881a4c167ff3eedb3d.tar.zst
PeerTube-1a8c2d74d1022cfddc4a12881a4c167ff3eedb3d.zip
Handle start at/stop at in playlist embed
Diffstat (limited to 'client/src/assets')
-rw-r--r--client/src/assets/player/playlist/playlist-menu-item.ts23
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 @@
1import videojs from 'video.js' 1import videojs from 'video.js'
2import { VideoPlaylistElement } from '@shared/models' 2import { VideoPlaylistElement } from '@shared/models'
3import { PlaylistItemOptions } from '../peertube-videojs-typings' 3import { PlaylistItemOptions } from '../peertube-videojs-typings'
4import { secondsToTime } from '../utils'
4 5
5const Component = videojs.getComponent('Component') 6const 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 }