0
How to add a video to an HTML code?
I have tried a lot and the videos don't work, I added videos from YouTube and Chrome and it doesn't work This is the code I tried. <video controls> <source src="http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ElephantsDream.mp4" type="video/mp4"> Video Not Supported </video> And yes I heard I can use <iframe> but I haven't reached there yet and I just would like to learn this one first.
6 Respostas
+ 1
did you try:
<video width="320" height="240" controls>
<source src="movie.mp4" type="video/mp4">
<source src="movie.ogg" type="video/ogg">
Your browser does not support the video tag.
</video>
it in this way?
(source: w3schools)
0
Thank you so much but I'm new so no I didn't try it sorry.
0
Why not trying an embedded link, like you would for say a youtube video? but instead of setting it to "https://example.com", you set it to "file://internal storage/some folder/example.mp4"?
0
Thank you also
0
I think it's better to download any video you wish to use in your website.
Use Vidmate to download YouTube videos
0
I had similar issues when first working with video elements, but I found a solution that might help you. Make sure you're testing your code on a proper web server (even a local one) rather than just opening the HTML file directly, as many browsers restrict media playback from local files for security reasons. Another common issue is that some YouTube videos have embedding disabled, so try using their official embed code instead of directly linking to the video file. For Chrome videos, you'll need to check if the source URL allows cross-origin requests, as browsers often block media from different domains unless CORS headers are properly set. The sample Elephants Dream video you're trying to use should work, so the issue might be with your server configuration or browser permissions. If you're using a local development environment, try installing a simple server like "Live Server" extension for VS Code or using Python's http.server module. Once you've got the basic video element working, then you can move on to exploring iframe embeds which are often more reliable for third-party content.RetryClaude can make mistakes. Please double-check responses.