aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/assets/player
diff options
context:
space:
mode:
Diffstat (limited to 'client/src/assets/player')
-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