code: function createPlayer(mediaDataSource, optionalConfig) {
      let mds = mediaDataSource;
      if (mds == null || typeof mds !== 'object') {
          throw new InvalidArgumentException('MediaDataSource must be an javascript object!');
      }
  
      if (!mds.hasOwnProperty('type')) {
          throw new InvalidArgumentException('MediaDataSource must has type field to indicate video file type!');
      }
  
      switch (mds.type) {
          case 'flv':
              return new FlvPlayer(mds, optionalConfig);
          default:
              return new NativePlayer(mds, optionalConfig);
      }
  }
docs: factory method