platform/video.videojs/dist/video.es.js
function stateful(target, defaultState) {
  assign(target, StatefulMixin);

  // This happens after the mixing-in because we need to replace the `state`
  // added in that step.
  target.state = assign({}, target.state, defaultState);

  // Auto-bind the `handleStateChanged` method of the target object if it exists.
  if (typeof target.handleStateChanged === 'function' && isEvented(target)) {
    target.on('statechanged', target.handleStateChanged);
  }

  return target;
}
function stateful(target, defaultState) {
  assign(target, StatefulMixin);

  // This happens after the mixing-in because we need to replace the `state`
  // added in that step.
  target.state = assign({}, target.state, defaultState);

  // Auto-bind the `handleStateChanged` method of the target object if it exists.
  if (typeof target.handleStateChanged === 'function' && isEvented(target)) {
    target.on('statechanged', target.handleStateChanged);
  }

  return target;
}
Applies {@link module:stateful~StatefulMixin|StatefulMixin} to a target
object.

If the target object is {@link module:evented|evented} and has a
`handleStateChanged` method, that method will be automatically bound to the
`statechanged` event on itself.

@param   {Object} target
The object to be made stateful.

@param   {Object} [defaultState]
A default set of properties to populate the newly-stateful object's
`state` property.

@returns {Object}
Returns the `target`.