aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/standalone
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2019-04-02 18:30:26 +0200
committerChocobozzz <me@florianbigard.com>2019-04-02 18:30:26 +0200
commitc47106315ae3c403239cda29c49b4bba51ddccb2 (patch)
tree526d2f3ba284dde6bc8d83699c0a78e86d7860eb /client/src/standalone
parentf421fa06ada7bb01d91142cc8211a65e2b390d7b (diff)
downloadPeerTube-c47106315ae3c403239cda29c49b4bba51ddccb2.tar.gz
PeerTube-c47106315ae3c403239cda29c49b4bba51ddccb2.tar.zst
PeerTube-c47106315ae3c403239cda29c49b4bba51ddccb2.zip
tslint update
Diffstat (limited to 'client/src/standalone')
-rw-r--r--client/src/standalone/player/definitions.ts4
-rw-r--r--client/src/standalone/player/events.ts4
-rw-r--r--client/src/standalone/videos/embed.ts12
-rw-r--r--client/src/standalone/videos/test-embed.ts24
4 files changed, 21 insertions, 23 deletions
diff --git a/client/src/standalone/player/definitions.ts b/client/src/standalone/player/definitions.ts
index 7f9ef9b6f..afd10541b 100644
--- a/client/src/standalone/player/definitions.ts
+++ b/client/src/standalone/player/definitions.ts
@@ -1,6 +1,4 @@
1export interface EventHandler<T> { 1export type EventHandler<T> = (ev: T) => void
2 (ev: T): void
3}
4 2
5export type PlayerEventType = 3export type PlayerEventType =
6 'pause' | 'play' | 4 'pause' | 'play' |
diff --git a/client/src/standalone/player/events.ts b/client/src/standalone/player/events.ts
index f1639ef19..28a13c727 100644
--- a/client/src/standalone/player/events.ts
+++ b/client/src/standalone/player/events.ts
@@ -13,13 +13,13 @@ export class EventRegistrar {
13 private eventRegistrations: PlayerEventRegistrationMap = {} 13 private eventRegistrations: PlayerEventRegistrationMap = {}
14 14
15 public bindToChannel (channel: Channel.MessagingChannel) { 15 public bindToChannel (channel: Channel.MessagingChannel) {
16 for (let name of Object.keys(this.eventRegistrations)) { 16 for (const name of Object.keys(this.eventRegistrations)) {
17 channel.bind(name, (txn, params) => this.fire(name, params)) 17 channel.bind(name, (txn, params) => this.fire(name, params))
18 } 18 }
19 } 19 }
20 20
21 public registerTypes (names: string[]) { 21 public registerTypes (names: string[]) {
22 for (let name of names) { 22 for (const name of names) {
23 this.eventRegistrations[ name ] = { registrations: [] } 23 this.eventRegistrations[ name ] = { registrations: [] }
24 } 24 }
25 } 25 }
diff --git a/client/src/standalone/videos/embed.ts b/client/src/standalone/videos/embed.ts
index b55b4bace..626d55a7c 100644
--- a/client/src/standalone/videos/embed.ts
+++ b/client/src/standalone/videos/embed.ts
@@ -40,7 +40,7 @@ class PeerTubeEmbedApi {
40 } 40 }
41 41
42 private constructChannel () { 42 private constructChannel () {
43 let channel = Channel.build({ window: window.parent, origin: '*', scope: this.embed.scope }) 43 const channel = Channel.build({ window: window.parent, origin: '*', scope: this.embed.scope })
44 44
45 channel.bind('play', (txn, params) => this.embed.player.play()) 45 channel.bind('play', (txn, params) => this.embed.player.play())
46 channel.bind('pause', (txn, params) => this.embed.player.pause()) 46 channel.bind('pause', (txn, params) => this.embed.player.pause())
@@ -82,8 +82,8 @@ class PeerTubeEmbedApi {
82 let currentState: 'playing' | 'paused' | 'unstarted' = 'unstarted' 82 let currentState: 'playing' | 'paused' | 'unstarted' = 'unstarted'
83 83
84 setInterval(() => { 84 setInterval(() => {
85 let position = this.element.currentTime 85 const position = this.element.currentTime
86 let volume = this.element.volume 86 const volume = this.element.volume
87 87
88 this.channel.notify({ 88 this.channel.notify({
89 method: 'playbackStatusUpdate', 89 method: 'playbackStatusUpdate',
@@ -114,8 +114,8 @@ class PeerTubeEmbedApi {
114 } 114 }
115 115
116 private loadWebTorrentResolutions () { 116 private loadWebTorrentResolutions () {
117 let resolutions = [] 117 const resolutions = []
118 let currentResolutionId = this.embed.player.webtorrent().getCurrentResolutionId() 118 const currentResolutionId = this.embed.player.webtorrent().getCurrentResolutionId()
119 119
120 for (const videoFile of this.embed.player.webtorrent().videoFiles) { 120 for (const videoFile of this.embed.player.webtorrent().videoFiles) {
121 let label = videoFile.resolution.label 121 let label = videoFile.resolution.label
@@ -235,7 +235,7 @@ class PeerTubeEmbed {
235 235
236 private loadParams () { 236 private loadParams () {
237 try { 237 try {
238 let params = new URL(window.location.toString()).searchParams 238 const params = new URL(window.location.toString()).searchParams
239 239
240 this.autoplay = this.getParamToggle(params, 'autoplay') 240 this.autoplay = this.getParamToggle(params, 'autoplay')
241 this.controls = this.getParamToggle(params, 'controls') 241 this.controls = this.getParamToggle(params, 'controls')
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', () => {