In the mobile phone page when encountered a demand, is to require the video can not fast forward and backward. It is found that a seeking and seeked function should be triggered at the time of addressing, but it has been tested that browsers of 4s and MI 2 cannot trigger these two functions. At the same time can not detect the status of Media.seeking, print out all is false.
If you remove controls, there is no problem with most Android phones, and the controller is not displayed. But the Xiaomi browser will automatically play full screen, and the controller including the progress bar will be displayed. The iphone also automatically fullscreen, leaving the full screen to not play the video. But iphone5 above can hear seeking and seeked events, and then control.
After a reminder that the Timeupdate function will be triggered in real time, you can cache the time of the last trigger, and then compare it with the previous time when the next trigger occurs. If there is more than 1s between the two, it is considered a jump. The base is the trigger time of timeupdate is less than 1s, after listening and printing, found that the function trigger time is millisecond, not more than 1s.
Related code:
varMedia; varBeforetime=0; varType=0; varTemp=0; $ (document). Ready (function(){ varBrowser =Window.browser; varIOSB; if(Browser.ipad | |Browser.iphone) {IOSB=true; } Media=document.getelementsbytagname (' video ') [0]; $(' #start '). Bind (' click ', start); $(' #video_block '). Bind (' click ',function(e) {$ (' #start '). Show (); Media.pause (); }); $(' video '). Bind (' Timeupdate ')., timeupdate); $(' video '). Bind (' pause ',function(){ if(!IOSB) { $(' #start '). Show (); } }); $(' video '). Bind (' Webkitendfullscreen ',function(){ varstr=$ (' #start '). CSS (' Display '); if(str== "None" &&!IOSB) { $(' #start '). Show (); } }); $(' video '). Bind (' ended ',function(){ $('. Next '). Show (); }); }) functiontimeupdate () {if(media.currenttime-beforetime>1) {Media.currenttime=0; } Else if(media.ended) {$ ('. Next '). Show (); } beforetime=Media.currenttime; } functionStart () {$ (' #start '). Hide (); Media.play (); }
Solutions for some iphone and Xiaomi phones that do not trigger seek events