Fix for bugs caused by #1055

Hi, 

This PR keeps PR #1055, but adds a work around for zero height containers.
When a video has width: 100%; height: 100%; on its style attribute, like on the code below the container's height would be zero.
`<video width="1920" height="1080" style="width: 100%; height:100%;">`

This PR fixes this by checking if the parent height is not zero before assigning it as the calculated height.

Thanks!
Merge pull request #1274 from maimairel/master

Fix for bugs caused by #1055