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.ts24
1 files changed, 12 insertions, 12 deletions
diff --git a/client/src/standalone/videos/test-embed.ts b/client/src/standalone/videos/test-embed.ts
index 30a298573..8e83d92a9 100644
--- a/client/src/standalone/videos/test-embed.ts
+++ b/client/src/standalone/videos/test-embed.ts
@@ -7,13 +7,13 @@ window.addEventListener('load', async () => {
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 const videoId = lastPart.indexOf('?') === -1 ? lastPart : lastPart.split('?')[ 0 ]
9 9
10 let iframe = document.createElement('iframe') 10 const iframe = document.createElement('iframe')
11 iframe.src = `/videos/embed/${videoId}?autoplay=1&controls=0&api=1` 11 iframe.src = `/videos/embed/${videoId}?autoplay=1&controls=0&api=1`
12 let mainElement = document.querySelector('#host') 12 const mainElement = document.querySelector('#host')
13 mainElement.appendChild(iframe) 13 mainElement.appendChild(iframe)
14 14
15 console.log(`Document finished loading.`) 15 console.log(`Document finished loading.`)
16 let player = new PeerTubePlayer(document.querySelector('iframe')) 16 const player = new PeerTubePlayer(document.querySelector('iframe'))
17 17
18 window[ 'player' ] = player 18 window[ 'player' ] = player
19 19
@@ -21,7 +21,7 @@ window.addEventListener('load', async () => {
21 await player.ready 21 await player.ready
22 console.log(`Player is ready.`) 22 console.log(`Player is ready.`)
23 23
24 let monitoredEvents = [ 24 const monitoredEvents = [
25 'pause', 25 'pause',
26 'play', 26 'play',
27 'playbackStatusUpdate', 27 'playbackStatusUpdate',
@@ -36,18 +36,18 @@ window.addEventListener('load', async () => {
36 let playbackRates: number[] = [] 36 let playbackRates: number[] = []
37 let currentRate = await player.getPlaybackRate() 37 let currentRate = await player.getPlaybackRate()
38 38
39 let updateRates = async () => { 39 const updateRates = async () => {
40 let rateListEl = document.querySelector('#rate-list') 40 const rateListEl = document.querySelector('#rate-list')
41 rateListEl.innerHTML = '' 41 rateListEl.innerHTML = ''
42 42
43 playbackRates.forEach(rate => { 43 playbackRates.forEach(rate => {
44 if (currentRate === rate) { 44 if (currentRate === rate) {
45 let itemEl = document.createElement('strong') 45 const itemEl = document.createElement('strong')
46 itemEl.innerText = `${rate} (active)` 46 itemEl.innerText = `${rate} (active)`
47 itemEl.style.display = 'block' 47 itemEl.style.display = 'block'
48 rateListEl.appendChild(itemEl) 48 rateListEl.appendChild(itemEl)
49 } else { 49 } else {
50 let itemEl = document.createElement('a') 50 const itemEl = document.createElement('a')
51 itemEl.href = 'javascript:;' 51 itemEl.href = 'javascript:;'
52 itemEl.innerText = rate.toString() 52 itemEl.innerText = rate.toString()
53 itemEl.addEventListener('click', () => { 53 itemEl.addEventListener('click', () => {
@@ -66,18 +66,18 @@ window.addEventListener('load', async () => {
66 updateRates() 66 updateRates()
67 }) 67 })
68 68
69 let updateResolutions = ((resolutions: PeerTubeResolution[]) => { 69 const updateResolutions = ((resolutions: PeerTubeResolution[]) => {
70 let resolutionListEl = document.querySelector('#resolution-list') 70 const resolutionListEl = document.querySelector('#resolution-list')
71 resolutionListEl.innerHTML = '' 71 resolutionListEl.innerHTML = ''
72 72
73 resolutions.forEach(resolution => { 73 resolutions.forEach(resolution => {
74 if (resolution.active) { 74 if (resolution.active) {
75 let itemEl = document.createElement('strong') 75 const itemEl = document.createElement('strong')
76 itemEl.innerText = `${resolution.label} (active)` 76 itemEl.innerText = `${resolution.label} (active)`
77 itemEl.style.display = 'block' 77 itemEl.style.display = 'block'
78 resolutionListEl.appendChild(itemEl) 78 resolutionListEl.appendChild(itemEl)
79 } else { 79 } else {
80 let itemEl = document.createElement('a') 80 const itemEl = document.createElement('a')
81 itemEl.href = 'javascript:;' 81 itemEl.href = 'javascript:;'
82 itemEl.innerText = resolution.label 82 itemEl.innerText = resolution.label
83 itemEl.addEventListener('click', () => { 83 itemEl.addEventListener('click', () => {