Streaming live at 10am (PST)

Video Fit to Width OR Height of Viewport


Hi everyone,

Trying to get this bit of javascript to work for an embedded HTML5 video. The goal is when the viewport is wider than it is tall, that the video fit to the height. When the viewport is taller than it is wide, the video should fit to the width.

Public site is here (page called "Chapter 1"):

Javascript I found is here (first answer below question. See "Solved it myself with a javascript function...")

Kinda new at calling the javascript, what am I doing wrong?

Would also be open to other ideas of achieving this besides this script. I've found a few things in StackOverflow but nothing is working for me.