aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/standalone/videos/test-embed.ts
diff options
context:
space:
mode:
Diffstat (limited to 'client/src/standalone/videos/test-embed.ts')
-rw-r--r--client/src/standalone/videos/test-embed.ts14
1 files changed, 11 insertions, 3 deletions
diff --git a/client/src/standalone/videos/test-embed.ts b/client/src/standalone/videos/test-embed.ts
index 24cb62230..5f8e97562 100644
--- a/client/src/standalone/videos/test-embed.ts
+++ b/client/src/standalone/videos/test-embed.ts
@@ -1,14 +1,19 @@
1import './test-embed.scss' 1import './test-embed.scss'
2import { PeerTubeResolution, PlayerEventType } from '../player/definitions'
2import { PeerTubePlayer } from '../player/player' 3import { PeerTubePlayer } from '../player/player'
3import { PeerTubeResolution, PlayerEventType, PeerTubeTextTrack } from '../player/definitions'
4 4
5window.addEventListener('load', async () => { 5window.addEventListener('load', async () => {
6 const urlParts = window.location.href.split('/') 6 const urlParts = window.location.href.split('/')
7 const lastPart = urlParts[ urlParts.length - 1 ] 7 const lastPart = urlParts[ urlParts.length - 1 ]
8 const videoId = lastPart.indexOf('?') === -1 ? lastPart : lastPart.split('?')[ 0 ] 8
9 const isPlaylist = window.location.pathname.startsWith('/video-playlists/')
10
11 const elementId = lastPart.indexOf('?') === -1 ? lastPart : lastPart.split('?')[ 0 ]
9 12
10 const iframe = document.createElement('iframe') 13 const iframe = document.createElement('iframe')
11 iframe.src = `/videos/embed/${videoId}?api=1` 14 iframe.src = isPlaylist
15 ? `/videos/embed/${elementId}?api=1`
16 : `/video-playlists/embed/${elementId}?api=1`
12 17
13 const mainElement = document.querySelector('#host') 18 const mainElement = document.querySelector('#host')
14 mainElement.appendChild(iframe) 19 mainElement.appendChild(iframe)
@@ -32,6 +37,9 @@ window.addEventListener('load', async () => {
32 monitoredEvents.forEach(e => { 37 monitoredEvents.forEach(e => {
33 player.addEventListener(e as PlayerEventType, (param) => console.log(`PLAYER: event '${e}' received`, param)) 38 player.addEventListener(e as PlayerEventType, (param) => console.log(`PLAYER: event '${e}' received`, param))
34 console.log(`PLAYER: now listening for event '${e}'`) 39 console.log(`PLAYER: now listening for event '${e}'`)
40
41 player.getCurrentPosition()
42 .then(position => document.getElementById('playlist-position').innerHTML = position + '')
35 }) 43 })
36 44
37 let playbackRates: number[] = [] 45 let playbackRates: number[] = []