aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/assets/player/shared/upnext/end-card.ts
diff options
context:
space:
mode:
Diffstat (limited to 'client/src/assets/player/shared/upnext/end-card.ts')
-rw-r--r--client/src/assets/player/shared/upnext/end-card.ts24
1 files changed, 15 insertions, 9 deletions
diff --git a/client/src/assets/player/shared/upnext/end-card.ts b/client/src/assets/player/shared/upnext/end-card.ts
index 3589e1fd8..16883603e 100644
--- a/client/src/assets/player/shared/upnext/end-card.ts
+++ b/client/src/assets/player/shared/upnext/end-card.ts
@@ -48,6 +48,8 @@ class EndCard extends Component {
48 suspendedMessage: HTMLElement 48 suspendedMessage: HTMLElement
49 nextButton: HTMLElement 49 nextButton: HTMLElement
50 50
51 private timeout: any
52
51 private onEndedHandler: () => void 53 private onEndedHandler: () => void
52 private onPlayingHandler: () => void 54 private onPlayingHandler: () => void
53 55
@@ -84,6 +86,8 @@ class EndCard extends Component {
84 if (this.onEndedHandler) this.player().off([ 'auto-stopped', 'ended' ], this.onEndedHandler) 86 if (this.onEndedHandler) this.player().off([ 'auto-stopped', 'ended' ], this.onEndedHandler)
85 if (this.onPlayingHandler) this.player().off('playing', this.onPlayingHandler) 87 if (this.onPlayingHandler) this.player().off('playing', this.onPlayingHandler)
86 88
89 if (this.timeout) clearTimeout(this.timeout)
90
87 super.dispose() 91 super.dispose()
88 } 92 }
89 93
@@ -114,8 +118,6 @@ class EndCard extends Component {
114 } 118 }
115 119
116 showCard (cb: (canceled: boolean) => void) { 120 showCard (cb: (canceled: boolean) => void) {
117 let timeout: any
118
119 this.autoplayRing.setAttribute('stroke-dasharray', `${this.dashOffsetStart}`) 121 this.autoplayRing.setAttribute('stroke-dasharray', `${this.dashOffsetStart}`)
120 this.autoplayRing.setAttribute('stroke-dashoffset', `${-this.dashOffsetStart}`) 122 this.autoplayRing.setAttribute('stroke-dashoffset', `${-this.dashOffsetStart}`)
121 123
@@ -126,17 +128,20 @@ class EndCard extends Component {
126 } 128 }
127 129
128 this.upNextEvents.one('cancel', () => { 130 this.upNextEvents.one('cancel', () => {
129 clearTimeout(timeout) 131 clearTimeout(this.timeout)
132 this.timeout = undefined
130 cb(true) 133 cb(true)
131 }) 134 })
132 135
133 this.upNextEvents.one('playing', () => { 136 this.upNextEvents.one('playing', () => {
134 clearTimeout(timeout) 137 clearTimeout(this.timeout)
138 this.timeout = undefined
135 cb(true) 139 cb(true)
136 }) 140 })
137 141
138 this.upNextEvents.one('next', () => { 142 this.upNextEvents.one('next', () => {
139 clearTimeout(timeout) 143 clearTimeout(this.timeout)
144 this.timeout = undefined
140 cb(false) 145 cb(false)
141 }) 146 })
142 147
@@ -154,19 +159,20 @@ class EndCard extends Component {
154 this.suspendedMessage.innerText = this.options_.suspendedText 159 this.suspendedMessage.innerText = this.options_.suspendedText
155 goToPercent(0) 160 goToPercent(0)
156 this.ticks = 0 161 this.ticks = 0
157 timeout = setTimeout(update.bind(this), 300) // checks once supsended can be a bit longer 162 this.timeout = setTimeout(update.bind(this), 300) // checks once supsended can be a bit longer
158 } else if (this.ticks >= this.totalTicks) { 163 } else if (this.ticks >= this.totalTicks) {
159 clearTimeout(timeout) 164 clearTimeout(this.timeout)
165 this.timeout = undefined
160 cb(false) 166 cb(false)
161 } else { 167 } else {
162 this.suspendedMessage.innerText = '' 168 this.suspendedMessage.innerText = ''
163 tick() 169 tick()
164 timeout = setTimeout(update.bind(this), this.interval) 170 this.timeout = setTimeout(update.bind(this), this.interval)
165 } 171 }
166 } 172 }
167 173
168 this.container.style.display = 'block' 174 this.container.style.display = 'block'
169 timeout = setTimeout(update.bind(this), this.interval) 175 this.timeout = setTimeout(update.bind(this), this.interval)
170 } 176 }
171} 177}
172 178