Skip to content

Commit 66e16c2

Browse files
committed
Deploy version 1.2.6
1 parent 35b488f commit 66e16c2

File tree

3 files changed

+22
-28
lines changed

3 files changed

+22
-28
lines changed

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-html5video",
3-
"version": "1.2.5",
3+
"version": "1.2.6",
44
"homepage": "https://github.com/mderrick/react-html5video",
55
"authors": [
66

dist/ReactHtml5Video.js

Lines changed: 20 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,8 @@ return /******/ (function(modules) { // webpackBootstrap
148148

149149
var _assetsCopy2 = _interopRequireDefault(_assetsCopy);
150150

151+
var EVENTS = ['onAbort', 'onCanPlay', 'onCanPlayThrough', 'onDurationChange', 'onEmptied', 'onEncrypted', 'onEnded', 'onError', 'onLoadedData', 'onLoadedMetadata', 'onLoadStart', 'onPause', 'onPlay', 'onPlaying', 'onProgress', 'onRateChange', 'onSeeked', 'onSeeking', 'onStalled', 'onSuspend', 'onTimeUpdate', 'onVolumeChange', 'onWaiting'];
152+
151153
var Video = _react2['default'].createClass({
152154
displayName: 'Video',
153155

@@ -190,9 +192,23 @@ return /******/ (function(modules) { // webpackBootstrap
190192
* @return {undefined}
191193
*/
192194
componentWillMount: function componentWillMount() {
195+
var _this = this;
196+
193197
// Also bind 'this' as we call _updateStateFromVideo outside
194198
// of Reacts synthetic events as well.
195199
this._updateStateFromVideo = (0, _lodashThrottle2['default'])(this.updateStateFromVideo, 100).bind(this);
200+
// Set up all React media events and call method
201+
// on props if provided.
202+
this.mediaEventProps = EVENTS.reduce(function (p, c) {
203+
p[c] = function () {
204+
if (c in _this.props && typeof _this.props[c] === 'function') {
205+
// A prop exists for this mediaEvent, call it.
206+
_this.props[c]();
207+
}
208+
_this._updateStateFromVideo();
209+
};
210+
return p;
211+
}, {});
196212
},
197213

198214
/**
@@ -433,7 +449,7 @@ return /******/ (function(modules) { // webpackBootstrap
433449
},
434450

435451
render: function render() {
436-
var _this = this;
452+
var _this2 = this;
437453

438454
// If controls prop is provided remove it
439455
// and use our own controls.
@@ -453,34 +469,12 @@ return /******/ (function(modules) { // webpackBootstrap
453469
_extends({}, otherProps, {
454470
className: 'video__el',
455471
ref: function (el) {
456-
_this.videoEl = el;
457-
},
472+
_this2.videoEl = el;
473+
}
458474
// We have throttled `_updateStateFromVideo` so listen to
459475
// every available Media event that React allows and
460476
// infer the Video state in that method from the Video properties.
461-
onAbort: this._updateStateFromVideo,
462-
onCanPlay: this._updateStateFromVideo,
463-
onCanPlayThrough: this._updateStateFromVideo,
464-
onDurationChange: this._updateStateFromVideo,
465-
onEmptied: this._updateStateFromVideo,
466-
onEncrypted: this._updateStateFromVideo,
467-
onEnded: this._updateStateFromVideo,
468-
onError: this._updateStateFromVideo,
469-
onLoadedData: this._updateStateFromVideo,
470-
onLoadedMetadata: this._updateStateFromVideo,
471-
onLoadStart: this._updateStateFromVideo,
472-
onPause: this._updateStateFromVideo,
473-
onPlay: this._updateStateFromVideo,
474-
onPlaying: this._updateStateFromVideo,
475-
onProgress: this._updateStateFromVideo,
476-
onRateChange: this._updateStateFromVideo,
477-
onSeeked: this._updateStateFromVideo,
478-
onSeeking: this._updateStateFromVideo,
479-
onStalled: this._updateStateFromVideo,
480-
onSuspend: this._updateStateFromVideo,
481-
onTimeUpdate: this._updateStateFromVideo,
482-
onVolumeChange: this._updateStateFromVideo,
483-
onWaiting: this._updateStateFromVideo }),
477+
}, this.mediaEventProps),
484478
this.renderSources()
485479
),
486480
controls ? this.renderControls() : ''

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-html5video",
3-
"version": "1.2.5",
3+
"version": "1.2.6",
44
"description": "",
55
"main": "./dist/ReactHtml5Video.js",
66
"scripts": {

0 commit comments

Comments
 (0)