File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -75,9 +75,7 @@ var Video = React.createClass({
75
75
* @return {undefined }
76
76
*/
77
77
componentWillMount ( ) {
78
- // Also bind 'this' as we call _updateStateFromVideo outside
79
- // of Reacts synthetic events as well.
80
- this . _updateStateFromVideo = throttle ( this . updateStateFromVideo , 100 ) . bind ( this ) ;
78
+ this . _updateStateFromVideo = throttle ( this . updateStateFromVideo , 100 ) ;
81
79
// Set up all React media events and call method
82
80
// on props if provided.
83
81
this . mediaEventProps = EVENTS . reduce ( ( p , c ) => {
@@ -111,6 +109,10 @@ var Video = React.createClass({
111
109
// Remove event listener from video.
112
110
this . videoEl . children [ this . videoEl . children . length - 1 ]
113
111
. removeEventListener ( 'error' , this . _updateStateFromVideo ) ;
112
+ // Cancel the throttled function from being called once
113
+ // the video has been unmounted.
114
+ // https://github.com/mderrick/react-html5video/issues/35
115
+ this . _updateStateFromVideo . cancel ( ) ;
114
116
} ,
115
117
116
118
/**
You can’t perform that action at this time.
0 commit comments