fix: guard fullscreen on ios and space key in player
This commit is contained in:
@@ -645,11 +645,13 @@ const initPlayer = (): void => {
|
|||||||
|
|
||||||
const toggleFullscreen = (): void => {
|
const toggleFullscreen = (): void => {
|
||||||
if (document.fullscreenElement) {
|
if (document.fullscreenElement) {
|
||||||
document.exitFullscreen()
|
if (document.exitFullscreen) document.exitFullscreen()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
container.requestFullscreen()
|
if ('requestFullscreen' in container && typeof container.requestFullscreen === 'function') {
|
||||||
|
container.requestFullscreen()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Initialize
|
// Initialize
|
||||||
@@ -804,7 +806,10 @@ const initPlayer = (): void => {
|
|||||||
}).then(async (res) => {
|
}).then(async (res) => {
|
||||||
if (!res.ok) return
|
if (!res.ok) return
|
||||||
const html = await res.text()
|
const html = await res.text()
|
||||||
watchStatusDropdown.outerHTML = `<span id="watch-status-dropdown">${html}</span>`
|
const wrapper = document.createElement('span')
|
||||||
|
wrapper.id = 'watch-status-dropdown'
|
||||||
|
wrapper.innerHTML = html
|
||||||
|
watchStatusDropdown.replaceWith(wrapper)
|
||||||
}).catch(() => {})
|
}).catch(() => {})
|
||||||
}
|
}
|
||||||
} catch {
|
} catch {
|
||||||
@@ -955,6 +960,8 @@ const initPlayer = (): void => {
|
|||||||
container.addEventListener('mousemove', showControls)
|
container.addEventListener('mousemove', showControls)
|
||||||
|
|
||||||
document.addEventListener('keydown', (event) => {
|
document.addEventListener('keydown', (event) => {
|
||||||
|
const target = event.target as HTMLElement
|
||||||
|
if (target.tagName === 'INPUT' || target.tagName === 'TEXTAREA' || target.isContentEditable) return
|
||||||
if (event.code === 'Space') {
|
if (event.code === 'Space') {
|
||||||
event.preventDefault()
|
event.preventDefault()
|
||||||
togglePlayPause()
|
togglePlayPause()
|
||||||
|
|||||||
Reference in New Issue
Block a user