Skip to content

Commit 689b233

Browse files
committed
1.0.1
1 parent 1957b9d commit 689b233

File tree

3 files changed

+13
-8
lines changed

3 files changed

+13
-8
lines changed

dist/VideoCover.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function"
3434
* IF YOU DO NOT HAVE TO SUPPORT IE, you probably do not need this component
3535
* just have a look at the styles for the non-fallback implementation
3636
*/
37-
3837
var VideoCover = function (_Component) {
3938
_inherits(VideoCover, _Component);
4039

dist/VideoCoverFallback.js

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,11 @@ var VideoCoverFallback = function (_Component) {
3838
innerRatio: undefined,
3939
outerRatio: undefined
4040
}, _this.updateContainerRatio = function () {
41-
var ref = arguments.length <= 0 || arguments[0] === undefined ? _this.containerRef : arguments[0];
41+
if (_this.containerRef) {
42+
var _this$containerRef$ge = _this.containerRef.getBoundingClientRect();
4243

43-
if (ref) {
44-
var _ref$getBoundingClien = ref.getBoundingClientRect();
45-
46-
var width = _ref$getBoundingClien.width;
47-
var height = _ref$getBoundingClien.height;
44+
var width = _this$containerRef$ge.width;
45+
var height = _this$containerRef$ge.height;
4846

4947
_this.setState({
5048
outerRatio: width / height
@@ -93,6 +91,14 @@ var VideoCoverFallback = function (_Component) {
9391
}
9492
}, {
9593
key: 'render',
94+
95+
96+
/**
97+
* We can get the width and height of a video after it has started loading.
98+
* Then we can compare the aspect ratio of the video to that of it's surrounding container.
99+
* That is all we need to determine if the video fills the container vertically or horizontally.
100+
* In the other dimension we just have to maintain the original aspect-ratio.
101+
*/
96102
value: function render() {
97103
var _this2 = this;
98104

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-video-cover",
3-
"version": "1.0.0",
3+
"version": "1.0.1",
44
"description": "displays video with object-fit: cover, with fallback for IE",
55
"homepage": "http://t-obi.github.io/react-video-cover/",
66
"bugs": "https://github.com/t-obi/react-video-cover/issues",

0 commit comments

Comments
 (0)