react-video-renderer
Advanced tools
Comparing version 2.4.7 to 2.4.8
@@ -60,2 +60,3 @@ import * as React from 'react'; | ||
audioRef: RefObject<HTMLAudioElement>; | ||
hasCanPlayTriggered: boolean; | ||
state: VideoComponentState; | ||
@@ -62,0 +63,0 @@ static defaultProps: { |
@@ -22,2 +22,3 @@ import { __assign, __extends } from "tslib"; | ||
_this.audioRef = React.createRef(); | ||
_this.hasCanPlayTriggered = false; | ||
_this.state = { | ||
@@ -74,3 +75,7 @@ isLoading: true, | ||
}); | ||
onCanPlay && onCanPlay(event); | ||
if (!_this.hasCanPlayTriggered) { | ||
// protect against browser firing this event multiple times | ||
_this.hasCanPlayTriggered = true; | ||
onCanPlay && onCanPlay(event); | ||
} | ||
}; | ||
@@ -153,2 +158,3 @@ _this.onPlay = function () { | ||
if (hasSrcChanged) { | ||
this.hasCanPlayTriggered = false; | ||
// TODO: add test to cover this case | ||
@@ -155,0 +161,0 @@ if (status === 'playing') { |
@@ -60,2 +60,3 @@ import * as React from 'react'; | ||
audioRef: RefObject<HTMLAudioElement>; | ||
hasCanPlayTriggered: boolean; | ||
state: VideoComponentState; | ||
@@ -62,0 +63,0 @@ static defaultProps: { |
@@ -25,2 +25,3 @@ "use strict"; | ||
_this.audioRef = React.createRef(); | ||
_this.hasCanPlayTriggered = false; | ||
_this.state = { | ||
@@ -77,3 +78,7 @@ isLoading: true, | ||
}); | ||
onCanPlay && onCanPlay(event); | ||
if (!_this.hasCanPlayTriggered) { | ||
// protect against browser firing this event multiple times | ||
_this.hasCanPlayTriggered = true; | ||
onCanPlay && onCanPlay(event); | ||
} | ||
}; | ||
@@ -156,2 +161,3 @@ _this.onPlay = function () { | ||
if (hasSrcChanged) { | ||
this.hasCanPlayTriggered = false; | ||
// TODO: add test to cover this case | ||
@@ -158,0 +164,0 @@ if (status === 'playing') { |
{ | ||
"name": "react-video-renderer", | ||
"version": "2.4.7", | ||
"version": "2.4.8", | ||
"main": "dist/es5/index.js", | ||
@@ -5,0 +5,0 @@ "jsnext:main": "dist/es2015/index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
31736
714