Application of Video.js

Source: Internet
Author: User

1. Introduction of CSS and JS files

<href= "./plugins/video-5.5.3/video-js.css"  rel= "stylesheet"  ><src= "./plugins/video-5.5.3/video.js"></  script>

2. HTML Introduction

<VideoID= "My-player"class= "Video-js"//must add controls//whether to display the control, default display preload= "Auto"//Pre-loaded poster= "//vjs.zencdn.net/v/oceans.png"//The picture displayed before the video is loaded Data-setup= ' {} '>//Must be added<Sourcesrc= "//vjs.zencdn.net/v/oceans.mp4"type= "Video/mp4"></Source>    <Sourcesrc= "//VJS.ZENCDN.NET/V/OCEANS.WEBM"type= "VIDEO/WEBM"></Source>    <Sourcesrc= "//VJS.ZENCDN.NET/V/OCEANS.OGV"type= "Video/ogg"></Source>    <Pclass= "Vjs-no-js">video playback requires JavaScript enabled and is recommended for browser access with HTML5 support. To view this video, enable JavaScript, and consider upgrading to a Web browser that<ahref= "http://videojs.com/html5-video-support/"Target= "_blank">supports HTML5 video</a>    </P></Video>

3. JS Introduction

var playerurl = data.data; var u = {type: "rtmp/flv", src:playerurl}; var myplayer =  Videojs ("My-player");  // Initialize Video Myplayer.reset (); myplayer.src (u);

4, when the page jumps, video does not stop automatically, you can call the player.dispose () method to destroy the current video

Adopt the method of Angularjs monitor route change, listen to the page jump, destroy video when the page jumps

function (event, ToState, Toparams, FromState, fromparams) {    var myplayer =  Videojs ("My-player");  // Initialize video    Myplayer.dispose ();    // destruction });

<Videoid="My-player"class="Video-js"Controls preload="Auto"width="640"height=" the"autoplay="AutoPlay"
poster="//vjs.zencdn.net/v/oceans.png"data-setup=' {} '>
<Sourceid="VideoMP4"src="" type="rtmp/flv">
<!--<source src= "//vjs.zencdn.net/v/oceans.mp4" type= "Video/mp4" ></source>
<source src= "//VJS.ZENCDN.NET/V/OCEANS.WEBM" type= "VIDEO/WEBM" ></source>
<source src= "//VJS.ZENCDN.NET/V/OCEANS.OGV" type= "Video/ogg" ></source>-->
<Pclass="Vjs-no-js">play video needs to be enabledJavascript, recommended use supportHTML5Browser access.
To view this video, enable JavaScript, and consider upgrading to a Web browser that
<ahref="http://videojs.com/html5-video-support/"target="_blank">
Supports HTML5 video
</a>
</P>
</Video>

Application of Video.js

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.