comein-player-web 0.1.11 → 0.1.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.esm.js CHANGED
@@ -594,9 +594,24 @@ function createInteractiveLayout(el, locale = 'zh-cn', documentRef = globalThis.
594
594
  clearContainer(questionPanel);
595
595
  setActiveTab('chat', tabs);
596
596
  };
597
+ let hideInteractionTimer;
597
598
  const setInteractionVisible = visible => {
598
- root.classList?.[visible ? 'add' : 'remove']?.('has-interaction');
599
- interaction.hidden = !visible;
599
+ if (hideInteractionTimer) {
600
+ globalThis.clearTimeout?.(hideInteractionTimer);
601
+ hideInteractionTimer = undefined;
602
+ }
603
+ if (visible) {
604
+ interaction.hidden = false;
605
+ // Flush the unhidden state so the grid/opacity transition can start reliably.
606
+ void interaction.offsetWidth;
607
+ root.classList?.add?.('has-interaction');
608
+ return;
609
+ }
610
+ root.classList?.remove?.('has-interaction');
611
+ hideInteractionTimer = globalThis.setTimeout?.(() => {
612
+ interaction.hidden = true;
613
+ hideInteractionTimer = undefined;
614
+ }, 190);
600
615
  };
601
616
  const getOverlayHost = () => {
602
617
  const fullscreenTarget = playerElement.querySelector?.('#player') || documentRef.getElementById?.('player');
@@ -615,6 +630,7 @@ function createInteractiveLayout(el, locale = 'zh-cn', documentRef = globalThis.
615
630
  setInteractionVisible,
616
631
  setLocale,
617
632
  destroy() {
633
+ if (hideInteractionTimer) globalThis.clearTimeout?.(hideInteractionTimer);
618
634
  destroyPanels();
619
635
  clearContainer(host);
620
636
  },
@@ -1238,6 +1254,9 @@ async function createWebPlayer(el, options = {}, dependencies = {}) {
1238
1254
  requestAnimationFrameRef(() => {
1239
1255
  player.resize?.();
1240
1256
  });
1257
+ setTimeoutRef(() => {
1258
+ player.resize?.();
1259
+ }, 190);
1241
1260
  };
1242
1261
  const setInteractionVisible = visible => {
1243
1262
  if (interactionVisible === visible) return;