You can provide a hint to the user by applying the type attribute to the source element, specifying the MIME type of the file.
<!DOCTYPE HTML> <html> <head> <title>Example</title> </head> <body> <video controls width="360" height="240"> <source src="http://java2s.com/style/demo/your.webm" type="video/webm" /> <source src="http://java2s.com/style/demo/your.ogv" type="video/ogg" /> <source src="http://java2s.com/style/demo/your.mp4" type="video/mp4" /> Video cannot be displayed // ww w . j a va 2s. co m </video> </body> </html>
The media attribute provides the browser with guidance about the kind of device that the video is best suited for.