Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
fullscreen aspect ratio respecting video in reveal.js [hack]
[...]
function startEmbeddedContent( slide ) {
[...]
if( el.hasAttribute( 'data-autoplay' ) ) {
// paste this above el.play()
var nw = el.videoWidth,
nh = el.videoHeight,
es = Math.min(nh / nw),
elheight = Math.floor(document.documentElement.clientWidth * es),
videoPosX = 0 - el.parentNode.parentNode.offsetLeft,
videoPosY = (0 - el.parentNode.parentNode.offsetTop) + Math.floor((document.documentElement.clientHeight - elheight) / 2);
el.parentNode.setAttribute('style', 'top:0px; left:0px;');
el.setAttribute('style', 'max-height:5000px; max-width:5000px; position:absolute; top:' + videoPosY + 'px; left:' + videoPosX + 'px; width:' + document.documentElement.clientWidth + 'px; height:' + elheight + 'px;');
// end paste
el.play();
}
[...]
function stopEmbeddedContent( slide ) {
[...]
if( !el.hasAttribute( 'data-ignore' ) ) {
// paste line below above el.pause
el.style.display = 'none';
// end paste
el.pause();
}
[...]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.