1
0
Fork 0
mirror of https://github.com/Chocobozzz/PeerTube.git synced 2025-10-03 01:39:37 +02:00

Add video chapters support

This commit is contained in:
Chocobozzz 2023-08-28 10:55:04 +02:00
parent 7113f32a87
commit 77b70702d2
No known key found for this signature in database
GPG key ID: 583A612D890159BE
101 changed files with 1957 additions and 158 deletions

View file

@ -195,10 +195,11 @@ export class PeerTubeEmbed {
const {
videoResponse,
captionsPromise,
chaptersPromise,
storyboardsPromise
} = await this.videoFetcher.loadVideo({ videoId: uuid, videoPassword: this.videoPassword })
return this.buildVideoPlayer({ videoResponse, captionsPromise, storyboardsPromise, forceAutoplay })
return this.buildVideoPlayer({ videoResponse, captionsPromise, chaptersPromise, storyboardsPromise, forceAutoplay })
} catch (err) {
if (await this.handlePasswordError(err)) this.loadVideoAndBuildPlayer({ ...options })
@ -210,9 +211,10 @@ export class PeerTubeEmbed {
videoResponse: Response
storyboardsPromise: Promise<Response>
captionsPromise: Promise<Response>
chaptersPromise: Promise<Response>
forceAutoplay: boolean
}) {
const { videoResponse, captionsPromise, storyboardsPromise, forceAutoplay } = options
const { videoResponse, captionsPromise, chaptersPromise, storyboardsPromise, forceAutoplay } = options
const videoInfoPromise = videoResponse.json()
.then(async (videoInfo: VideoDetails) => {
@ -233,11 +235,13 @@ export class PeerTubeEmbed {
{ video, live, videoFileToken },
translations,
captionsResponse,
chaptersResponse,
storyboardsResponse
] = await Promise.all([
videoInfoPromise,
this.translationsPromise,
captionsPromise,
chaptersPromise,
storyboardsPromise,
this.buildPlayerIfNeeded()
])
@ -260,6 +264,7 @@ export class PeerTubeEmbed {
const loadOptions = await this.playerOptionsBuilder.getPlayerLoadOptions({
video,
captionsResponse,
chaptersResponse,
translations,
storyboardsResponse,