This time I will share jQuery Plugin and tutorial about jQuery Plugin For Easy Vimeo Video Controller – Vimeo.API.js, hope it will help you in programming stack.
Vimeo.API.js is a lightweight jQuery wrapper around the Vimoe video API which allows you to control Vimeo videos embedded in your webpage with custom jQuery methods and events.
Basic usage:
1. Make sure both the jQuery vimeo.api.js and jQuery library are included.
1 |
< script src = "//code.jquery.com/jquery-1.11.3.min.js" ></ script > |
2 |
< script src = "src/jquery.vimeo.api.js" ></ script > |
2. Embed an iframe Vimoe player into your web page.
3. Available API methods to control the Vimeo video.
02 |
$( "iframe" ).vimeo( "play" ); |
05 |
$( "iframe" ).vimeo( "pause" ); |
08 |
$( "iframe" ).vimeo( "seekTo" , 10); |
11 |
$( "iframe" ).vimeo( "setVolume" , 0.6); |
14 |
$( "iframe" ).vimeo( "setLoop" , true ); |
17 |
$( "iframe" ).vimeo( "setColor" , "#666" ); |
20 |
$( "iframe" ).vimeo( "unload" ); |
4. Get the return information about the vidoe.
03 |
$( "iframe" ).vimeo( "paused" , function (data){ |
04 |
console.log( "Is paused?" , data ); |
08 |
$( "iframe" ).vimeo( "getCurrentTime" , function (data){ |
09 |
console.log( "Current time" , data ); |
13 |
$( "iframe" ).vimeo( "getDuration" , function (data){ |
14 |
console.log( "Video length" , data ); |
18 |
$( "iframe" ).vimeo( "getVolume" , function (data){ |
19 |
console.log( "Volume is" , data ); |
23 |
$( "iframe" ).vimeo( "getVideoHeight" , function (data){ |
24 |
console.log( "Height" , data ); |
28 |
$( "iframe" ).vimeo( "getVideoWidth" , function (data){ |
29 |
console.log( "Width" , data ); |
33 |
$( "iframe" ).vimeo( "getVideoUrl" , function (data){ |
34 |
console.log( "Video URL" , data ); |
38 |
$( "iframe" ).vimeo( "getColor" , function (data){ |
39 |
console.log( "Player color" , data ); |
5. Events.
02 |
$( "iframe" ).on( "play" , function (){ |
03 |
console.log( "Video is playing" ); |
07 |
$( "iframe" ).on( "pause" , function (){ |
08 |
console.log( "Video is paused" ); |
12 |
$( "iframe" ).on( "finish" , function (){ |
13 |
console.log( "Video is done playing" ); |
17 |
$( "iframe" ).on( "playProgress" , function (event, data){ |
22 |
$( "iframe" ).on( "seek" , function (event, data){ |
6. Mixing methods and events.
1 |
$( "iframe" ).vimeo( "play" ) |
2 |
.vimeo( "getVolume" , function (d){ console.log( "volume" , d); }) |
3 |
.vimeo( "setVolume" , 0.6) |
4 |
.vimeo( "getVolume" , function (d){ console.log( "new volume" , d); }) |
5 |
.on( "pause" , function (){ console.log( "paused" ); }) |
This awesome jQuery plugin is developed by jrue. For more Advanced Usages, please check the demo page or visit the official website.