Forked from jimjeffers/html5VideoAspectRatioAdjustment.coffee
Created
February 11, 2014 13:01
-
-
Save cemo/8934427 to your computer and use it in GitHub Desktop.
This file contains 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
# Just an example. | |
# @video is a direct reference to a '<video>' element. | |
# $() is assuming jQuery is being used in this example. | |
@video.addEventListener("loadedmetadata", (event) => | |
actualRatio = @video.videoWidth/@video.videoHeight | |
targetRatio = $(@video).width()/$(@video).height() | |
adjustmentRatio = targetRatio/actualRatio | |
$(@video).css("-webkit-transform","scaleX(#{adjustmentRatio})") | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment