mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-23 05:41:20 -08:00
优化pip
This commit is contained in:
1 parent
fcd7fbecfc
commit
022f36624a
2 files changed
+13
-4
No files matched your search
@@ -2,9 +2,10 @@ import { debounce } from '../utils';
|
||||
|
||||
export default function autoPip(art) {
|
||||
const { events, player, template } = art;
|
||||
|
||||
const scrollDebounce = debounce(() => {
|
||||
const { top, height } = template.$player.getBoundingClientRect();
|
||||
if (top + height <= 0 && !player.pip && player.playing) {
|
||||
if (top + height <= 0 && !player.pip) {
|
||||
player.pip = true;
|
||||
art.emit('artplayerPluginAutoPip', true);
|
||||
} else if (player.pip) {
|
||||
@@ -12,6 +13,7 @@ export default function autoPip(art) {
|
||||
art.emit('artplayerPluginAutoPip', false);
|
||||
}
|
||||
}, 300);
|
||||
|
||||
events.proxy(window, 'scroll', scrollDebounce);
|
||||
|
||||
return {
|
||||
|
||||
Reference in new issue
Block a user