aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/standalone/videos/embed.ts
diff options
context:
space:
mode:
Diffstat (limited to 'client/src/standalone/videos/embed.ts')
-rw-r--r--client/src/standalone/videos/embed.ts24
1 files changed, 19 insertions, 5 deletions
diff --git a/client/src/standalone/videos/embed.ts b/client/src/standalone/videos/embed.ts
index cffda2cc7..6e37ce193 100644
--- a/client/src/standalone/videos/embed.ts
+++ b/client/src/standalone/videos/embed.ts
@@ -1,6 +1,7 @@
1import './embed.scss' 1import './embed.scss'
2import '../../assets/player/shared/dock/peertube-dock-component' 2import '../../assets/player/shared/dock/peertube-dock-component'
3import '../../assets/player/shared/dock/peertube-dock-plugin' 3import '../../assets/player/shared/dock/peertube-dock-plugin'
4import { PeerTubeServerError } from 'src/types'
4import videojs from 'video.js' 5import videojs from 'video.js'
5import { peertubeTranslate } from '../../../../shared/core-utils/i18n' 6import { peertubeTranslate } from '../../../../shared/core-utils/i18n'
6import { 7import {
@@ -27,7 +28,6 @@ import {
27 VideoFetcher 28 VideoFetcher
28} from './shared' 29} from './shared'
29import { PlayerHTML } from './shared/player-html' 30import { PlayerHTML } from './shared/player-html'
30import { PeerTubeServerError } from 'src/types'
31 31
32export class PeerTubeEmbed { 32export class PeerTubeEmbed {
33 player: videojs.Player 33 player: videojs.Player
@@ -188,9 +188,13 @@ export class PeerTubeEmbed {
188 const { uuid, autoplayFromPreviousVideo, forceAutoplay } = options 188 const { uuid, autoplayFromPreviousVideo, forceAutoplay } = options
189 189
190 try { 190 try {
191 const { videoResponse, captionsPromise } = await this.videoFetcher.loadVideo({ videoId: uuid, videoPassword: this.videoPassword }) 191 const {
192 videoResponse,
193 captionsPromise,
194 storyboardsPromise
195 } = await this.videoFetcher.loadVideo({ videoId: uuid, videoPassword: this.videoPassword })
192 196
193 return this.buildVideoPlayer({ videoResponse, captionsPromise, autoplayFromPreviousVideo, forceAutoplay }) 197 return this.buildVideoPlayer({ videoResponse, captionsPromise, storyboardsPromise, autoplayFromPreviousVideo, forceAutoplay })
194 } catch (err) { 198 } catch (err) {
195 199
196 if (await this.handlePasswordError(err)) this.loadVideoAndBuildPlayer({ ...options }) 200 if (await this.handlePasswordError(err)) this.loadVideoAndBuildPlayer({ ...options })
@@ -200,11 +204,12 @@ export class PeerTubeEmbed {
200 204
201 private async buildVideoPlayer (options: { 205 private async buildVideoPlayer (options: {
202 videoResponse: Response 206 videoResponse: Response
207 storyboardsPromise: Promise<Response>
203 captionsPromise: Promise<Response> 208 captionsPromise: Promise<Response>
204 autoplayFromPreviousVideo: boolean 209 autoplayFromPreviousVideo: boolean
205 forceAutoplay: boolean 210 forceAutoplay: boolean
206 }) { 211 }) {
207 const { videoResponse, captionsPromise, autoplayFromPreviousVideo, forceAutoplay } = options 212 const { videoResponse, captionsPromise, storyboardsPromise, autoplayFromPreviousVideo, forceAutoplay } = options
208 213
209 this.resetPlayerElement() 214 this.resetPlayerElement()
210 215
@@ -226,10 +231,17 @@ export class PeerTubeEmbed {
226 return { live, video: videoInfo, videoFileToken } 231 return { live, video: videoInfo, videoFileToken }
227 }) 232 })
228 233
229 const [ { video, live, videoFileToken }, translations, captionsResponse, PeertubePlayerManagerModule ] = await Promise.all([ 234 const [
235 { video, live, videoFileToken },
236 translations,
237 captionsResponse,
238 storyboardsResponse,
239 PeertubePlayerManagerModule
240 ] = await Promise.all([
230 videoInfoPromise, 241 videoInfoPromise,
231 this.translationsPromise, 242 this.translationsPromise,
232 captionsPromise, 243 captionsPromise,
244 storyboardsPromise,
233 this.PeertubePlayerManagerModulePromise 245 this.PeertubePlayerManagerModulePromise
234 ]) 246 ])
235 247
@@ -244,6 +256,8 @@ export class PeerTubeEmbed {
244 translations, 256 translations,
245 serverConfig: this.config, 257 serverConfig: this.config,
246 258
259 storyboardsResponse,
260
247 authorizationHeader: () => this.http.getHeaderTokenValue(), 261 authorizationHeader: () => this.http.getHeaderTokenValue(),
248 videoFileToken: () => videoFileToken, 262 videoFileToken: () => videoFileToken,
249 videoPassword: () => this.videoPassword, 263 videoPassword: () => this.videoPassword,