10.07.2015 Views

Building the User Interface by Using HTML5: Text, Graphics ... - server

Building the User Interface by Using HTML5: Text, Graphics ... - server

Building the User Interface by Using HTML5: Text, Graphics ... - server

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

46 | Lesson 2compressing data. Compression reduces <strong>the</strong> amount of space needed to store a file, and itreduces <strong>the</strong> bandwidth needed to transmit <strong>the</strong> file. Video compression reduces <strong>the</strong> size ofvideo images while retaining <strong>the</strong> highest quality video with <strong>the</strong> minimum bit rate. All of thismakes for better performance.In a nutshell, <strong>the</strong> main video formats along with codecs (for <strong>the</strong> last two) are:• MP4 or H.264• OGG + Theora with Vorbis audio• WebM + VP8A best practice is to use <strong>the</strong> type attribute to specify <strong>the</strong> video format. You should alsouse <strong>the</strong> codecs attribute to specify <strong>the</strong> codec(s), if applicable. Sample markup is shownas follows:LICENSED PRODUCT NOT FOR RESALEThe tag is being used as content of <strong>the</strong> video element so that <strong>the</strong> type attributecan be set and so that <strong>the</strong> multiple format option is available.Not all video formats are supported <strong>by</strong> all browsers, although MP4/H.264 is <strong>the</strong> mostwidely used <strong>by</strong> both Web browsers and mobile devices. (The <strong>HTML5</strong> Video Web page athttp://www.w3schools.com/html5/html5_video.asp displays a table showing which videoformats work for what browser. The table is updated regularly.) To help make your videoviewable <strong>by</strong> <strong>the</strong> majority of browsers and devices, you can use <strong>the</strong> source attribute toinclude multiple formats in your markup. This example shows <strong>the</strong> same video available intwo formats, and <strong>the</strong> OGG format specifies codecs:WORK WITH THE VIDEO ELEMENTGET READY. To work with <strong>the</strong> <strong>HTML5</strong> video element, perform <strong>the</strong> following steps:1. Locate a video clip, and an image file to use as a poster. If you don’t have a videoclip, search for a public domain MP4 file on <strong>the</strong> Web and download it. Save <strong>the</strong> videoand image files to your <strong>HTML5</strong> folder.2. In your editing tool, create an HTML file with <strong>the</strong> following markup. Substituteappropriate file names for your image file and video clip. Change <strong>the</strong> type attribute,if necessary, and replace sample.mp4 with <strong>the</strong> name of your video file.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!