diff options
author | Chocobozzz <me@florianbigard.com> | 2020-08-03 16:03:52 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2020-08-03 16:03:52 +0200 |
commit | dca0fe12ec2e47be51884c4eb05ebe6f358cb9de (patch) | |
tree | 19a9b5d905a6eaccda680b14e1b86b43577ca29d /client/src/assets/player | |
parent | 2045b572233d1ee81fb1c14e33fc22b805cd7230 (diff) | |
download | PeerTube-dca0fe12ec2e47be51884c4eb05ebe6f358cb9de.tar.gz PeerTube-dca0fe12ec2e47be51884c4eb05ebe6f358cb9de.tar.zst PeerTube-dca0fe12ec2e47be51884c4eb05ebe6f358cb9de.zip |
Fix resolution for portrait videos
Diffstat (limited to 'client/src/assets/player')
-rw-r--r-- | client/src/assets/player/peertube-player-manager.ts | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/client/src/assets/player/peertube-player-manager.ts b/client/src/assets/player/peertube-player-manager.ts index 7fa84e195..f12fb09ae 100644 --- a/client/src/assets/player/peertube-player-manager.ts +++ b/client/src/assets/player/peertube-player-manager.ts | |||
@@ -19,6 +19,7 @@ import './videojs-components/settings-panel' | |||
19 | import './videojs-components/settings-panel-child' | 19 | import './videojs-components/settings-panel-child' |
20 | import './videojs-components/theater-button' | 20 | import './videojs-components/theater-button' |
21 | import videojs from 'video.js' | 21 | import videojs from 'video.js' |
22 | |||
22 | import { isDefaultLocale } from '../../../../shared/models/i18n/i18n' | 23 | import { isDefaultLocale } from '../../../../shared/models/i18n/i18n' |
23 | import { VideoFile } from '../../../../shared/models/videos' | 24 | import { VideoFile } from '../../../../shared/models/videos' |
24 | import { RedundancyUrlManager } from './p2p-media-loader/redundancy-url-manager' | 25 | import { RedundancyUrlManager } from './p2p-media-loader/redundancy-url-manager' |
@@ -300,7 +301,13 @@ export class PeertubePlayerManager { | |||
300 | } | 301 | } |
301 | const hlsjs = { | 302 | const hlsjs = { |
302 | levelLabelHandler: (level: { height: number, width: number }) => { | 303 | levelLabelHandler: (level: { height: number, width: number }) => { |
303 | const file = p2pMediaLoaderOptions.videoFiles.find(f => f.resolution.id === level.height) | 304 | const resolution = Math.min(level.height || 0, level.width || 0) |
305 | |||
306 | const file = p2pMediaLoaderOptions.videoFiles.find(f => f.resolution.id === resolution) | ||
307 | if (!file) { | ||
308 | console.error('Cannot find video file for level %d.', level.height) | ||
309 | return level.height | ||
310 | } | ||
304 | 311 | ||
305 | let label = file.resolution.label | 312 | let label = file.resolution.label |
306 | if (file.fps >= 50) label += file.fps | 313 | if (file.fps >= 50) label += file.fps |