mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-25 08:01:20 -08:00
add auto pip mode
This commit is contained in:
1 parent
8dc8dc3a3e
commit
6c0a198f02
9 files changed
+83
-31
No files matched your search
@@ -0,0 +1,14 @@
|
||||
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) {
|
||||
player.pip = true;
|
||||
} else if (player.pip) {
|
||||
player.pip = false;
|
||||
}
|
||||
}, 300);
|
||||
events.proxy(window, 'scroll', scrollDebounce);
|
||||
}
|
||||
Reference in new issue
Block a user