Last active
January 15, 2016 20:53
-
-
Save andrewscofield/6065270 to your computer and use it in GitHub Desktop.
Ooyala responsive embedding
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.video-container{ | |
width: 100%; | |
position: relative; | |
padding: 56.3% 0 0 0; //56.3% = 16:9 ratio | |
} | |
.video-container > .video{ | |
position: absolute; | |
top: 0; | |
} | |
.video-container .innerWrapper{ | |
position: absolute; | |
top: 0; | |
left: 0; | |
width: 100%; | |
height: 100%; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div style="width:640px;"> | |
<div class="video-container"> | |
<div id='ooyalaplayer-[ooyalaid]' data-ooyalaid="[ooyalaid]"></div> | |
</div> | |
</div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(function () { | |
$('[data-ooyalaid]').each(function () { | |
var ooyalaid = $(this).data('ooyalaid'); | |
var containerid = $(this).attr('id'); | |
var ooyalaplayer = OO.Player.create(containerid, ooyalaid); | |
//reference point for use later | |
$(this).data('ooyalaplayer', ooyalaplayer); | |
}); | |
}); |
Can someone help me out with this? I have no business being on github, but I would love to use this code. Obviously, if I create these three files as-is, they won't do much - what else do I need to have loaded in order for this to work?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thank you for this! Very clever padding trick (may want to update the comment syntax to
/* 56.3% = 16:9 ratio */
)