Trouble in playing youtube videos in videojs

Trouble in playing youtube videos in videojs,video,html5-video,video.js,Video,Html5 Video,Video.js,Actually, I want to play youtube videos in videojs player. Here's my code <video id="my-video" class="video-js vjs-default-skin" controls preload="auto" poster="{{ $movie_preview_image }}" style="height: 550px; width: 1100px;"> <source src="{{$movie->link_full_hd}}" type="video/youtube"> </video> But it shows an error in firefox Specified "type" attribut

Actually, I want to play youtube videos in videojs player. Here's my code

    <video
                id="my-video"
                class="video-js vjs-default-skin"
                controls
                preload="auto"
                poster="{{ $movie_preview_image }}"
                style="height: 550px; width: 1100px;">
                <source src="{{$movie->link_full_hd}}" type="video/youtube">
    </video>

But it shows an error in firefox Specified "type" attribute of "video/youtube" is not supported. Load of media resource https://www.youtube.com/watch?v=wU5XkhUGzBs failed. I have already searched, but none of the solution is working.

Thanks in advance.


#1

The type field in the source tag is a MIME video type. This is just a way to indicate the type and format of a file. The full list of types is available here:

The type and subtype you have included, "video/youtube" is not a valid type/subtype, and this is what the error is showing you.

Looking at what you are trying to do, as a general rule, YouTube does not support playing its videos in other players. If you simply want to include a YouTUbe video on your page the usual approach is to just use their embed facility.

At the time of writing the basic way to do is to go to the video on YouTube, click on the share icon and copy the HTML5 code and then paste that code into your website: