surmon-china / videojs-player

@videojs player component for @vuejs(3) and React.
https://github.surmon.me/videojs-player
MIT License
5.25k stars 1.13k forks source link

How to play youtube videos? #414

Open kentforth opened 3 years ago

kentforth commented 3 years ago

The player shows an error: "No compatible source found for this media" How can I fix it to play you tuibe video?

      <video-player
        class="video-player-box"
        ref="videoPlayer"
        :options="playerOptions"
      />

playerOptions: {
        sources: [
          {
            type: "video/youtube",
            src: "https://www.youtube.com/watch?v=W-4GcIC7G7A",
          },
        ],
      },

computed: {
    player() {
      return this.$refs.videoPlayer.player;
    },
  },
IgorShayderov commented 2 years ago

Hello! You need plugin https://github.com/videojs/videojs-youtube Based on: https://videojs.com/guides/troubleshooting/#make-sure-you-are-using-formats-that-videojs-can-play