Solutions for some iphone and Xiaomi phones that do not trigger seek events

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.