EXAMPLE: http://rochestb.github.io/jQuery.YoutubeBackground/
jQuery plugin that lets you create background videos using youtube api
Put the script at the bottom of your markup right after jQuery:
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script src="http://www.youtube.com/iframe_api"></script>
<script src="src/jquery.youtubebackground.js"></script>
<div id="video"></div>
Call the plugin function and your carousel is ready.
$('#video').YTPlayer({
fitToBackground: true,
videoId: 'LSmgKRx5pBo'
});
Youtube Javascript API Options
Access all of YouTube API of player:
var player = $('#video').data('ytPlayer').getPlayer();
player.pauseVideo();
player.mute()
ratio: 16 / 9, // change as needed
videoId: 'LSmgKRx5pBo'
mute: true,
repeat: true,
fitToBackground: true
None yet
I welcome contributors, bugs, and questions.
A bug is a demonstrable problem that is caused by the code in the repository. Good bug reports are extremely helpful, so thanks!
Guidelines for bug reports:
-
Use the GitHub issue search — check if the issue has already been reported.
-
Check if the issue has been fixed — try to reproduce it using the latest
develop
branch in the repository. -
Isolate the problem — ideally create a reduced test case and a live example. This JSFiddle is a helpful template you can fork.
By submitting a patch, you agree to allow the project owner to license your work under the terms of the MIT License.
The code and the documentation are released under the MIT License.