diff options
author | Chocobozzz <me@florianbigard.com> | 2018-03-19 11:04:40 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-03-19 11:04:40 +0100 |
commit | 09700934b90e2ac7b1b9ed1694d9d4d52735e2e1 (patch) | |
tree | 29ea9512fa34676a7194e9cb37d912b38266c9cc /client/src/assets/player | |
parent | ae5a3dd6642c8d5abc87b874496026dc9ed37d2d (diff) | |
download | PeerTube-09700934b90e2ac7b1b9ed1694d9d4d52735e2e1.tar.gz PeerTube-09700934b90e2ac7b1b9ed1694d9d4d52735e2e1.tar.zst PeerTube-09700934b90e2ac7b1b9ed1694d9d4d52735e2e1.zip |
BEARKING CHANGE: Update videos API response
before beta
Diffstat (limited to 'client/src/assets/player')
-rw-r--r-- | client/src/assets/player/peertube-videojs-plugin.ts | 21 |
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 | ||
3 | import * as videojs from 'video.js' | 3 | import * as videojs from 'video.js' |
4 | import * as WebTorrent from 'webtorrent' | 4 | import * as WebTorrent from 'webtorrent' |
5 | import { VideoConstant, VideoResolution } from '../../../../shared/models/videos' | ||
5 | import { VideoFile } from '../../../../shared/models/videos/video.model' | 6 | import { VideoFile } from '../../../../shared/models/videos/video.model' |
6 | import { renderVideo } from './video-renderer' | 7 | import { 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_() |