mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-26 08:51:20 -08:00
refactor(core): CORE-16 type display modes and own fullscreen lifetimes
This commit is contained in:
1 parent
1b83081e8f
commit
88aef830df
81 files changed
+33897
-1503
No files matched your search
@@ -0,0 +1,25 @@
|
||||
import type { PipHost, PipProperty } from '../display/types'
|
||||
import { nativePip } from '../display/native-pip'
|
||||
import { webkitPip } from '../display/webkit-pip'
|
||||
import { isClosing } from '../lifecycle/instance'
|
||||
import { def } from '../utils'
|
||||
|
||||
export default function pipMix(art: PipHost): asserts art is PipHost & PipProperty {
|
||||
const { i18n, notice, template: { $video } } = art
|
||||
const document = $video.ownerDocument
|
||||
if (document.pictureInPictureEnabled && typeof $video.requestPictureInPicture === 'function' && typeof document.exitPictureInPicture === 'function') {
|
||||
def(art, 'pip', nativePip(art))
|
||||
}
|
||||
else if (typeof $video.webkitSupportsPresentationMode === 'function' && typeof $video.webkitSetPresentationMode === 'function') {
|
||||
def(art, 'pip', webkitPip(art))
|
||||
}
|
||||
else {
|
||||
def(art, 'pip', {
|
||||
get: () => false,
|
||||
set() {
|
||||
if (!isClosing(art))
|
||||
notice.show = i18n.get('PIP Not Supported')
|
||||
},
|
||||
})
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user