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.ts20
1 files changed, 11 insertions, 9 deletions
diff --git a/client/src/standalone/videos/test-embed.ts b/client/src/standalone/videos/test-embed.ts
index 6e035c0c9..066b3e024 100644
--- a/client/src/standalone/videos/test-embed.ts
+++ b/client/src/standalone/videos/test-embed.ts
@@ -4,11 +4,11 @@ import { PeerTubePlayer } from '../player/player'
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 8
9 const isPlaylist = window.location.pathname.startsWith('/video-playlists/') 9 const isPlaylist = window.location.pathname.startsWith('/video-playlists/')
10 10
11 const elementId = lastPart.indexOf('?') === -1 ? lastPart : lastPart.split('?')[ 0 ] 11 const elementId = lastPart.indexOf('?') === -1 ? lastPart : lastPart.split('?')[0]
12 12
13 const iframe = document.createElement('iframe') 13 const iframe = document.createElement('iframe')
14 iframe.src = isPlaylist 14 iframe.src = isPlaylist
@@ -18,14 +18,14 @@ window.addEventListener('load', async () => {
18 const mainElement = document.querySelector('#host') 18 const mainElement = document.querySelector('#host')
19 mainElement.appendChild(iframe) 19 mainElement.appendChild(iframe)
20 20
21 console.log(`Document finished loading.`) 21 console.log('Document finished loading.')
22 const player = new PeerTubePlayer(document.querySelector('iframe')) 22 const player = new PeerTubePlayer(document.querySelector('iframe'))
23 23
24 window[ 'player' ] = player 24 window['player'] = player
25 25
26 console.log(`Awaiting player ready...`) 26 console.log('Awaiting player ready...')
27 await player.ready 27 await player.ready
28 console.log(`Player is ready.`) 28 console.log('Player is ready.')
29 29
30 const monitoredEvents = [ 30 const monitoredEvents = [
31 'pause', 31 'pause',
@@ -39,7 +39,9 @@ window.addEventListener('load', async () => {
39 console.log(`PLAYER: now listening for event '${e}'`) 39 console.log(`PLAYER: now listening for event '${e}'`)
40 40
41 player.getCurrentPosition() 41 player.getCurrentPosition()
42 .then(position => document.getElementById('playlist-position').innerHTML = position + '') 42 .then(position => {
43 document.getElementById('playlist-position').innerHTML = position + ''
44 })
43 }) 45 })
44 46
45 let playbackRates: number[] = [] 47 let playbackRates: number[] = []
@@ -105,7 +107,7 @@ window.addEventListener('load', async () => {
105 107
106 updateCaptions() 108 updateCaptions()
107 109
108 const updateResolutions = ((resolutions: PeerTubeResolution[]) => { 110 const updateResolutions = (resolutions: PeerTubeResolution[]) => {
109 const resolutionListEl = document.querySelector('#resolution-list') 111 const resolutionListEl = document.querySelector('#resolution-list')
110 resolutionListEl.innerHTML = '' 112 resolutionListEl.innerHTML = ''
111 113
@@ -126,7 +128,7 @@ window.addEventListener('load', async () => {
126 resolutionListEl.appendChild(itemEl) 128 resolutionListEl.appendChild(itemEl)
127 } 129 }
128 }) 130 })
129 }) 131 }
130 132
131 player.getResolutions().then( 133 player.getResolutions().then(
132 resolutions => updateResolutions(resolutions)) 134 resolutions => updateResolutions(resolutions))