aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/assets
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2022-01-12 09:42:54 +0100
committerChocobozzz <me@florianbigard.com>2022-01-12 09:42:54 +0100
commite98ef69d1c8d4e39e45a52b04b3abf5fd1af3b2c (patch)
tree5ccc3f7ca279a1112077a55fc95bc8155364f90c /client/src/assets
parentf1a0555a88db9ade2b073a2e4dc73c4a6176c8a0 (diff)
downloadPeerTube-e98ef69d1c8d4e39e45a52b04b3abf5fd1af3b2c.tar.gz
PeerTube-e98ef69d1c8d4e39e45a52b04b3abf5fd1af3b2c.tar.zst
PeerTube-e98ef69d1c8d4e39e45a52b04b3abf5fd1af3b2c.zip
Move to landscape on mobile fullscreen
Diffstat (limited to 'client/src/assets')
-rw-r--r--client/src/assets/player/mobile/peertube-mobile-plugin.ts19
1 files changed, 18 insertions, 1 deletions
diff --git a/client/src/assets/player/mobile/peertube-mobile-plugin.ts b/client/src/assets/player/mobile/peertube-mobile-plugin.ts
index b3834e20d..2ce6b4b33 100644
--- a/client/src/assets/player/mobile/peertube-mobile-plugin.ts
+++ b/client/src/assets/player/mobile/peertube-mobile-plugin.ts
@@ -1,5 +1,5 @@
1import videojs from 'video.js'
2import './peertube-mobile-buttons' 1import './peertube-mobile-buttons'
2import videojs from 'video.js'
3 3
4const Plugin = videojs.getPlugin('plugin') 4const Plugin = videojs.getPlugin('plugin')
5 5
@@ -9,6 +9,23 @@ class PeerTubeMobilePlugin extends Plugin {
9 super(player, options) 9 super(player, options)
10 10
11 player.addChild('PeerTubeMobileButtons') 11 player.addChild('PeerTubeMobileButtons')
12
13 if (videojs.browser.IS_ANDROID && screen.orientation) {
14 this.handleFullscreenRotation()
15 }
16 }
17
18 private handleFullscreenRotation () {
19 this.player.on('fullscreenchange', () => {
20 if (!this.player.isFullscreen() || this.isPortraitVideo()) return
21
22 screen.orientation.lock('landscape')
23 .catch(err => console.error('Cannot lock screen to landscape.', err))
24 })
25 }
26
27 private isPortraitVideo () {
28 return this.player.videoWidth() < this.player.videoHeight()
12 } 29 }
13} 30}
14 31