@vime/core
Version:
Customizable, extensible, accessible and framework agnostic media player.
19 lines (18 loc) • 464 B
JavaScript
import { getElement } from '@stencil/core';
import { createStencilHook } from '../../../utils/stencil';
const players = new Set();
export function withAutopause(player) {
const el = getElement(player);
createStencilHook(player, () => {
players.add(el);
}, () => {
players.delete(el);
});
}
export function autopause(player) {
const el = getElement(player);
players.forEach(p => {
if (p !== el && p.autopause)
p.paused = true;
});
}