How to figure out when a HTML5 video player enters the full screen mode on iOS / iPads?

后端 未结 1 553
悲&欢浪女
悲&欢浪女 2020-11-30 04:10

The HTML5 tag offers the user a button to toggle on and off the fullscreen mode on Safari for mobile devices (iOS).

I would like to captur

相关标签:
1条回答
  • 2020-11-30 05:03

    After much faffing around a friend finally pointed me in the right direction.

    The events I was looking for are: webkitbeginfullscreen and webkitendfullscreen

    var player = document.getElementsByTagName("video")[0];
    player.addEventListener('webkitbeginfullscreen', onVideoBeginsFullScreen, false);
    player.addEventListener('webkitendfullscreen', onVideoEndsFullScreen, false);
    

    With that I can safely capture when the user clicks over the fullscreen button on Safari for the iPads. Interestingly the same events don't seem to work for Safari on the iMac (tested on version 5.1.2).

    Thanks Apple for their inconsistency and hours of wasted time.

    0 讨论(0)
提交回复
热议问题