aboutsummaryrefslogtreecommitdiffhomepage
path: root/client
diff options
context:
space:
mode:
Diffstat (limited to 'client')
-rw-r--r--client/src/standalone/videos/embed.ts27
1 files changed, 25 insertions, 2 deletions
diff --git a/client/src/standalone/videos/embed.ts b/client/src/standalone/videos/embed.ts
index a2902ce58..7372c80c6 100644
--- a/client/src/standalone/videos/embed.ts
+++ b/client/src/standalone/videos/embed.ts
@@ -179,6 +179,8 @@ export class PeerTubeEmbed {
179 179
180 const errorText = document.getElementById('error-content') 180 const errorText = document.getElementById('error-content')
181 errorText.innerHTML = translatedText 181 errorText.innerHTML = translatedText
182
183 this.wrapperElement.style.display = 'none'
182 } 184 }
183 185
184 videoNotFound (translations?: Translations) { 186 videoNotFound (translations?: Translations) {
@@ -395,7 +397,7 @@ export class PeerTubeEmbed {
395 } 397 }
396 398
397 private getPreviousPlaylistElement (position?: number): VideoPlaylistElement { 399 private getPreviousPlaylistElement (position?: number): VideoPlaylistElement {
398 if (!position) position = this.currentPlaylistElement.position -1 400 if (!position) position = this.currentPlaylistElement.position - 1
399 401
400 if (position < 1) { 402 if (position < 1) {
401 return undefined 403 return undefined
@@ -561,7 +563,28 @@ export class PeerTubeEmbed {
561 const playlistElementResult = await res.videosResponse.json() 563 const playlistElementResult = await res.videosResponse.json()
562 this.playlistElements = await this.loadAllPlaylistVideos(playlistId, playlistElementResult) 564 this.playlistElements = await this.loadAllPlaylistVideos(playlistId, playlistElementResult)
563 565
564 this.currentPlaylistElement = this.playlistElements[0] 566 const params = new URL(window.location.toString()).searchParams
567 const playlistPositionParam = this.getParamString(params, 'playlistPosition')
568
569 let position = 1
570
571 if (playlistPositionParam) {
572 position = parseInt(playlistPositionParam + '', 10)
573 }
574
575 this.currentPlaylistElement = this.playlistElements.find(e => e.position === position)
576 if (!this.currentPlaylistElement || !this.currentPlaylistElement.video) {
577 console.error('Current playlist element is not valid.', this.currentPlaylistElement)
578 this.currentPlaylistElement = this.getNextPlaylistElement()
579 }
580
581 if (!this.currentPlaylistElement) {
582 console.error('This playlist does not have any valid element.')
583 const serverTranslations = await this.translationsPromise
584 this.playlistFetchError(serverTranslations)
585 return
586 }
587
565 videoId = this.currentPlaylistElement.video.uuid 588 videoId = this.currentPlaylistElement.video.uuid
566 } else { 589 } else {
567 videoId = this.getResourceId() 590 videoId = this.getResourceId()