Verified Commit e98ef69d authored by Chocobozzz's avatar Chocobozzz
Browse files

Move to landscape on mobile fullscreen

parent f1a0555a
import videojs from 'video.js'
import './peertube-mobile-buttons'
import videojs from 'video.js'
const Plugin = videojs.getPlugin('plugin')
......@@ -9,6 +9,23 @@ class PeerTubeMobilePlugin extends Plugin {
super(player, options)
player.addChild('PeerTubeMobileButtons')
if (videojs.browser.IS_ANDROID && screen.orientation) {
this.handleFullscreenRotation()
}
}
private handleFullscreenRotation () {
this.player.on('fullscreenchange', () => {
if (!this.player.isFullscreen() || this.isPortraitVideo()) return
screen.orientation.lock('landscape')
.catch(err => console.error('Cannot lock screen to landscape.', err))
})
}
private isPortraitVideo () {
return this.player.videoWidth() < this.player.videoHeight()
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment