Nuxt 3 / Vite Brightcove player?

108 views Asked by At

In Nuxt 2 https://github.com/brightcove/player-loader this worked great for me. I am now on to Nuxt 3 and trying to implement a brightcove player and this plugin is causing errors. I decided to try and create a player manually and am getting close to the video displaying. The container and brightcove nodes are rendering but no video and I am getting this error?

VIDEOJS: ERROR: TypeError: Cannot read properties of undefined (reading 'includes')

Video Component:

<script setup>
const playerId = 'PLAYERID';
const accountId = 'MYACCOUNT';
const videoId = 'MYID';
const videoPlayer = ref(null);

onMounted(() => {
  const options = {
    accountId,
    playerId,
    videoId,
  };

  const script = document.createElement('script');
  script.src = `https://players.brightcove.net/account/id_default/index.min.js`;
  script.async = true;
  script.onload = () => {
    videoPlayer.value = window.bc(`#video-player-id`, options);
  };
  document.body.appendChild(script);
});
</script>

<template>
  <div class="video-player">
    <div ref="videoPlayer" id="video-player-id" />
  </div>
</template>
0

There are 0 answers