
- HTML Tutorial
- HTML - Home
- HTML - Overview
- HTML - Basic Tags
- HTML - Elements
- HTML - Attributes
- HTML - Formatting
- HTML - Phrase Tags
- HTML - Meta Tags
- HTML - Comments
- HTML - Images
- HTML - Tables
- HTML - Lists
- HTML - Text Links
- HTML - Image Links
- HTML - Email Links
- HTML - Frames
- HTML - Iframes
- HTML - Blocks
- HTML - Backgrounds
- HTML - Colors
- HTML - Fonts
- HTML - Forms
- HTML - Embed Multimedia
- HTML - Marquees
- HTML - Header
- HTML - Style Sheet
- HTML - Javascript
- HTML - Layouts
- HTML References
- HTML - Tags Reference
- HTML - Attributes Reference
- HTML - Events Reference
- HTML - Fonts Reference
- HTML - ASCII Codes
- ASCII Table Lookup
- HTML - Color Names
- HTML - Entities
- HTML - Fonts Ref
- HTML - Events Ref
- MIME Media Types
- HTML - URL Encoding
- Language ISO Codes
- HTML - Character Encodings
- HTML - Deprecated Tags
Play local (hard-drive) video file with HTML5 video tag?
The <video> tag is used to add video, with the following video formats − MP4, WebM and Ogg
On selecting a file via the input element.
The change event is fired
The event is fired for <input>, <select>, and <textarea> elements when a change to the element's value is performed by the user.
Getting File object
The File interface provides information about files and allows JavaScript in a web page to access the content. Object of this type is returned by the files property of the HTML <input> element, which eventually lets you access the list of files selected with the <input type="file"> element.
Object URL pointing to the File object
Use the URL.createObjectURL() static method to create a DOMString containing a URL representing the object given in the parameter.
Set the object URL to the video.src property
Finally, here is how the video is visible. Use the src attribute to add the location (URL) of the video file.
- Related Articles
- Play infinitely looping video on-load in HTML5
- Streaming a video file to an HTML5 video player with Node.js so that the video controls continue to work
- HTML5 Video Tag in Chrome - Why is currentTime ignored when video downloaded from my webserver?
- How to play audio and video file in iOS?
- How to play HTML5 video on fullscreen in android WebView?
- XMLHttpRequest for Video Tag?
- HTML DOM Video play( ) Method
- Commonly used Video formats while using HTML5 video
- Play video on canvas and preserve the last frame/image on HTML5 Canvas
- Using FFMPEG with HTML5 for online video hosting
- Display video inside HTML5 canvas
- HTML5 video not playing in Firefox
- HTML5 video full preload in JavaScript
- How android YouTube app Play Video from Intent
- HTML5 video not working with jquery bxSlider plugin on iPad
