Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
shiyiya committed Mar 23, 2024
1 parent cc5bc5c commit f2bf8b0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
5 changes: 3 additions & 2 deletions packages/plugins/src/chromecast.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { PlayerPlugin, loadSDK, isIOS } from '@oplayer/core'

function noop() {}

const IS_CHROME = !!window.chrome
const IS_CHROME = !!globalThis.chrome

//TODO: sync event

Expand All @@ -12,7 +12,8 @@ export default <PlayerPlugin>{
apply(player) {
if (!IS_CHROME || isIOS) return

let currentSession: chrome.cast.Session | undefined, currentMedia: chrome.cast.media.Media | undefined
let currentSession: chrome.cast.Session | undefined
let currentMedia: chrome.cast.media.Media | undefined
const ui = player.context.ui

function onError(e: chrome.cast.Error | Error) {
Expand Down
6 changes: 3 additions & 3 deletions packages/ui/src/functions/rotation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ import type { UiConfig } from '../types'
export default function registerFullScreenRotation(player: Player, config: UiConfig) {
if (config.forceLandscapeOnFullscreen && !isIOS && isMobile) {
player.on('fullscreenchange', ({ payload }) => {
if (payload.isWeb) return
if (payload.isWeb || !player._requestFullscreen) return
if (player.isFullScreen) {
// https://github.com/microsoft/TypeScript-DOM-lib-generator/issues/1615
;(window.screen.orientation as any)?.lock?.('landscape')
;(globalThis.screen.orientation as any)?.lock?.('landscape')
} else {
window.screen.orientation?.unlock?.()
globalThis.screen.orientation?.unlock?.()
}
})
}
Expand Down

0 comments on commit f2bf8b0

Please sign in to comment.