请求画中画滚动 chrome

Request Picture In Picture on scroll chrome

我想通过滚动事件侦听器在视频超出视口时使用 chrome 的画中画。 Chrome 给出此错误:

Must be handling a user gesture to request picture in picture.

有人可以确认滚动是否是用户手势吗?如果是为什么会出现这个错误?

这是可以触发“用户激活”的事件列表,如defined by the specs:

  • change
  • click
  • contextmenu
  • dblclick
  • mouseup
  • pointerup
  • reset
  • submit
  • touchend

scroll 不存在,并且由于 Request Picture-in-Picture algorithm 的步骤 .6 明确要求

If the algorithm is not triggered by user activation, throw a NotAllowedError and abort these steps.

您将无法通过此活动请求画中画。


在你的立场上,我会重新考虑画中画的必要性,并检查固定位置的