Tiny Clean jQuery & Html5 Video Player - zd-video.js
File Size: | 1.52 MB |
---|---|
Views Total: | 3648 |
Last Update: | |
Publish Date: | |
Official Website: | Go to website |
License: | MIT |

zd-video.js is a lightweight jQuery plugin used to create a custom and easy to style Html5 video player for your MP4 and WebM files.
How to use it:
1. Create the html for the Html5 video player.
<div class="zd-video-container zd-video-ispause" id="myvideo"> </div>
2. Include jQuery library and the jQuery zd-video.js script at the bottom of the webpage.
<script src="//code.jquery.com/jquery-2.1.4.min.js"></script> <script src="js/zd-video.js"></script>
3. Call the function and specify the video source & poster image for the video player.
var video = new ZdVideo({ container: 'myvideo', source: 'sample.mp4', poster: 'poster.png' });
4. The required CSS styles for the video player. Feel free to modify or override the rules as displayed below to create your own styles.
.zd-video-container { position: relative; } .zd-video { width: 100%; height: 100%; overflow: hidden; } .zd-video-controls { height: 44px; position: absolute; bottom: 15px; background-color: #242426; left: 15px; box-shadow: 1px 1px 2px rgba(0,0,0,0.75); visibility: hidden; -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)"; filter: alpha(opacity=0); opacity: 0; transition: all 0.3s ease; -webkit-transition: all 0.3s ease; -ms-transition: all 0.3s ease; -moz-transition: all 0.3s ease; -o-transtion: all 0.3s ease; } .zd-video-controls.show { -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=1)"; filter: alpha(opacity=1); opacity: 1; visibility: visible; } .zd-video-progress { position: relative; width: 100%; height: 2px; background-color: #666666; } .zd-video-progress-bar { position: absolute; left: 0; top: 0; height: 2px; background-color: #FFFFFF; } .zd-video-control { display: inline-block; vertical-align: top; background-position: center; background-repeat: no-repeat; background-size: cover; cursor: pointer; } .zd-video-control.hide { display: none; } .zd-video-big-play { width: 70px; height: 70px; position: absolute; top: 50%; left: 50%; margin-left: -35px; margin-top: -35px; background-image: url("../media/big-play.svg"); z-index: 1000; display: none; } .zd-video-container.zd-video-ispause .zd-video-big-play { display: inline-block !important; } .zd-video-container.zd-video-ispause .zd-video-play { display: inline-block; } .zd-video-container.zd-video-ispause .zd-video-pause { display: none; } .zd-video-play { width: 11px; height: 14px; background-image: url("../media/play.svg"); } .zd-video-pause { width: 12px; height: 14px; background-image: url("../media/pause.svg"); } .zd-video-fullscreen { width: 14px; height: 14px; background-image: url("../media/fullscreen.svg"); } .zd-video-unfullscreen { width: 14px; height: 14px; background-image: url("../media/unfullscreen.svg"); } .zd-video-mute { width: 12px; height: 14px; background-image: url("../media/volume.svg"); } .zd-controls-body { padding: 15px 20px; line-height: 14px; } .zd-controls-left { float: left; } .zd-controls-right { float: right; } .zd-video-time { font-size: 12px; font-weight: 400; color: rgba(255,255,255,0.8); padding-left: 30px; } .zd-video-volume { width: 70px; height: 2px; background-color: #666666; display: inline-block; position: relative; margin-right: 30px; margin-left: 6px; top: -5px; cursor: pointer; } .zd-video-volume-bar { position: absolute; left: 0; top: 0; height: 2px; background-color: #fff; width: 50%; }
5. Plugin's options.
var video = new ZdVideo({ // CSS selector container: 'myvideo', // video source source: 'sample.mp4', // path to the poster image poster: 'poster.png' // enable auto play autoplay: false // enable auto loop loop: false });
This awesome jQuery plugin is developed by nicholasxjy. For more Advanced Usages, please check the demo page or visit the official website.