Popcorn-js Video Frame Simple usage

Source: Internet
Author: User

<div>             <video class= "video" id= "Ourvideobig" preload= "Auto" controls= "Controls" >                <source src= "/file/video/1.mp4"/>            </video>        </div>

  

<script>//Video list facilitates multiple video switching var videos = ["/file/video/1.mp4", "/file/video/2.mp4", "/file/video/3.mp4",        "/file/video/4.mp4", "/file/video/5.mp4"]; var activitytab = 0;        Video Toggle value var pop = null;        var $video = null;            var init = function () {pop = popcorn ("#ourvideobig");            $video = document.getElementById ("Ourvideobig"); Loadedready ();        Video load complete Execution event} $ (function () {init ();//Initialize}) var wait = 0;             Video load complete execution event function Loadedready () {var rdy = pop.readystate ();//Get Video status if (Rdy = = 4)//load complete                {$ ("#msg"). HTML ("Total video time:" + pop.duration ());                Console.log ("Total video time:" + pop.duration ());                Timeupdate ();//dynamic listener playback time} else {Console.log ("video Status:" + Rdy + ", times =" + wait); Loop if (wait <=) {//Console.log ("Wait:" + WaiT);                    SetTimeout (Loadedready, 200);                wait++; }}}//Bind dynamic Listen play time function timeupdate () {$video. AddEventListener ("Timeupdate"                , function (e) {$ ("#txt_msg"). Val ("Current Play Time:" + $video. currenttime);        Can be used for automatic switching function});                }//Bind drag video Time function seeked () {$video. AddEventListener ("seeked", function (e) {            Console.log ("Current video Drag Time:" + $video. currenttime);        });        }//Reset the video to set the video current time to 0 function reset () {pop.currenttime (0);}            Stop video function Destroy () {pop.currenttime (0); Pop.pause ();//pause}//full-screen function fullscreen () {$video. Webkitrequestfullscreen ();} </script>

  

Popcorn-js Video Frame Simple usage

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.