aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/assets
diff options
context:
space:
mode:
Diffstat (limited to 'client/src/assets')
-rw-r--r--client/src/assets/player/peertube-videojs-plugin.ts21
1 files changed, 11 insertions, 10 deletions
diff --git a/client/src/assets/player/peertube-videojs-plugin.ts b/client/src/assets/player/peertube-videojs-plugin.ts
index a96f6d1a1..c99363fb5 100644
--- a/client/src/assets/player/peertube-videojs-plugin.ts
+++ b/client/src/assets/player/peertube-videojs-plugin.ts
@@ -2,6 +2,7 @@
2 2
3import * as videojs from 'video.js' 3import * as videojs from 'video.js'
4import * as WebTorrent from 'webtorrent' 4import * as WebTorrent from 'webtorrent'
5import { VideoConstant, VideoResolution } from '../../../../shared/models/videos'
5import { VideoFile } from '../../../../shared/models/videos/video.model' 6import { VideoFile } from '../../../../shared/models/videos/video.model'
6import { renderVideo } from './video-renderer' 7import { renderVideo } from './video-renderer'
7 8
@@ -52,8 +53,8 @@ class ResolutionMenuItem extends MenuItem {
52 options.selectable = true 53 options.selectable = true
53 super(player, options) 54 super(player, options)
54 55
55 const currentResolution = this.player_.peertube().getCurrentResolution() 56 const currentResolutionId = this.player_.peertube().getCurrentResolutionId()
56 this.selected(this.options_.id === currentResolution) 57 this.selected(this.options_.id === currentResolutionId)
57 } 58 }
58 59
59 handleClick (event) { 60 handleClick (event) {
@@ -89,10 +90,10 @@ class ResolutionMenuButton extends MenuButton {
89 menuItems.push(new ResolutionMenuItem( 90 menuItems.push(new ResolutionMenuItem(
90 this.player_, 91 this.player_,
91 { 92 {
92 id: videoFile.resolution, 93 id: videoFile.resolution.id,
93 label: videoFile.resolutionLabel, 94 label: videoFile.resolution.label,
94 src: videoFile.magnetUri, 95 src: videoFile.magnetUri,
95 selected: videoFile.resolution === this.currentSelection 96 selected: videoFile.resolution.id === this.currentSelectionId
96 }) 97 })
97 ) 98 )
98 } 99 }
@@ -269,12 +270,12 @@ class PeerTubePlugin extends Plugin {
269 this.flushVideoFile(this.currentVideoFile, false) 270 this.flushVideoFile(this.currentVideoFile, false)
270 } 271 }
271 272
272 getCurrentResolution () { 273 getCurrentResolutionId () {
273 return this.currentVideoFile ? this.currentVideoFile.resolution : -1 274 return this.currentVideoFile ? this.currentVideoFile.resolution.id : -1
274 } 275 }
275 276
276 getCurrentResolutionLabel () { 277 getCurrentResolutionLabel () {
277 return this.currentVideoFile ? this.currentVideoFile.resolutionLabel : '' 278 return this.currentVideoFile ? this.currentVideoFile.resolution.label : ''
278 } 279 }
279 280
280 updateVideoFile (videoFile?: VideoFile, done?: () => void) { 281 updateVideoFile (videoFile?: VideoFile, done?: () => void) {
@@ -339,7 +340,7 @@ class PeerTubePlugin extends Plugin {
339 this.trigger('videoFileUpdate') 340 this.trigger('videoFileUpdate')
340 } 341 }
341 342
342 updateResolution (resolution) { 343 updateResolution (resolutionId: number) {
343 // Remember player state 344 // Remember player state
344 const currentTime = this.player.currentTime() 345 const currentTime = this.player.currentTime()
345 const isPaused = this.player.paused() 346 const isPaused = this.player.paused()
@@ -352,7 +353,7 @@ class PeerTubePlugin extends Plugin {
352 this.player.bigPlayButton.hide() 353 this.player.bigPlayButton.hide()
353 } 354 }
354 355
355 const newVideoFile = this.videoFiles.find(f => f.resolution === resolution) 356 const newVideoFile = this.videoFiles.find(f => f.resolution.id === resolutionId)
356 this.updateVideoFile(newVideoFile, () => { 357 this.updateVideoFile(newVideoFile, () => {
357 this.player.currentTime(currentTime) 358 this.player.currentTime(currentTime)
358 this.player.handleTechSeeked_() 359 this.player.handleTechSeeked_()