dmc1989
@dmc1989

Video.js is not a function?

Пытаюсь сделать другой плеер, но модуль не работает, в чем может быть ошибка?

const videojs = require('video.js');

let player = videojs('setup__video');
    player.options.autoplay = true;


я проверил модуль и это функция, почему тогда не срабатывает?

function videojs$1(id, options, ready) {
  var player = videojs$1.getPlayer(id);

  if (player) {
    if (options) {
      log$1.warn('Player "' + id + '" is already initialised. Options will not be applied.');
    }
    if (ready) {
      player.ready(ready);
    }
    return player;
  }

  var el = typeof id === 'string' ? $('#' + normalizeId(id)) : id;

  if (!isEl(el)) {
    throw new TypeError('The element or ID supplied is not valid. (videojs)');
  }

  if (!document.body.contains(el)) {
    log$1.warn('The element supplied is not included in the DOM');
  }

  options = options || {};

  videojs$1.hooks('beforesetup').forEach(function (hookFunction) {
    var opts = hookFunction(el, mergeOptions(options));

    if (!isObject(opts) || Array.isArray(opts)) {
      log$1.error('please return an object in beforesetup hooks');
      return;
    }

    options = mergeOptions(options, opts);
  });

  // We get the current "Player" component here in case an integration has
  // replaced it with a custom player.
  var PlayerComponent = Component.getComponent('Player');

  player = new PlayerComponent(el, options, ready);

  videojs$1.hooks('setup').forEach(function (hookFunction) {
    return hookFunction(player);
  });

  return player;
}
  • Вопрос задан
  • 291 просмотр
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы
SummerWeb Ярославль
от 120 000 до 180 000 ₽
КРАФТТЕК Санкт-Петербург
от 60 000 до 80 000 ₽
Brightdata Тель-Авив
от 5 500 до 6 500 $