blob: 2ed4f9acdbce380e507cb83a5075d67066e8f442 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
import { timeToInt } from '@peertube/peertube-core-utils'
import videojs, { VideoJsPlayer } from 'video.js'
const TimeToolTip = videojs.getComponent('TimeTooltip') as any // FIXME: typings don't have write method
class TimeTooltip extends TimeToolTip {
write (timecode: string) {
const player: VideoJsPlayer = this.player()
if (player.usingPlugin('chapters')) {
const chapterTitle = player.chapters().getChapter(timeToInt(timecode))
if (chapterTitle) return super.write(chapterTitle + '\r\n' + timecode)
}
return super.write(timecode)
}
}
videojs.registerComponent('TimeTooltip', TimeTooltip)
|