添加插件 cordova-plugin-screen-orientation
监听videojs全屏事件
const player = videoJs(key)
player.landscapeFullscreen()
player.on('fullscreenchange', (e) => {
if (player.isFullscreen()) {
// 锁定横屏
screen.orientation.lock('landscape')
screen.orientation.onchange = () => {
// 监听屏幕方向
if (screen.orientation === 'landscape') {
// 重置播放比率
// 通过调用重置所有控制栏组件的子方法来重置控制栏的 UI
player.resetControlBarUI_()
player.resetPlaybackRate_()
}
}
}
})