HTML5 Programming
Upcoming SlideShare
Loading in...5
×
 

HTML5 Programming

on

  • 1,199 views

 

Statistics

Views

Total Views
1,199
Views on SlideShare
1,023
Embed Views
176

Actions

Likes
0
Downloads
14
Comments
0

2 Embeds 176

http://hotrannam.wordpress.com 133
http://localhost 43

Accessibility

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment
  • http://introducinghtml5.com/examples/ch07/time/http://ie.microsoft.com/testdrive/HTML5/KidsBook/

HTML5 Programming HTML5 Programming Presentation Transcript

  • HTML5 Programming Nam Ho KMS Technology
  • HTML5 won’t be ready until 2022!
  • Do I need to wait forthe specifications are complete?
  • Real-world browser support is what matters!
  • A desktop example http://www.pirateslovedaisies.com/
  • A mobile examplehttp://m.microsoft.com/windowsphone/en-us/demo/index.html
  • The current state of HTML5 support http://caniuse.com/
  • Why programming?
  • This presentation doesn’t cover• Semantics & Markups• HTML5 Forms• Web Workers• WebGL• CSS3• SVG• …
  • This presentation covers• Video• Canvas• WebSocket• Data Storage• Offline• FileSystem• Geolocation
  • MultimediaThese specifications defines the video/audio elements with all the availablemethods, attributes and events. Through the new APIs you can access, controland manipulate timeline data and network states of the files. With the comingadditions to the APIs you will be able to read and write raw data to audio files(Audio Data API) or manipulate captions in videos (Timed Track API).
  • Video• Native video• Video tag – <video src=“light.ogv” controls autoplay />• Formats – .mp4 = H.264 + AAC – .ogg/.ogv = Theora + Vorbis – .webm = VP8 + Vorbis• Legacy browser fallback
  • Audio• Native audio• Audio tag – <audio src=“hello.ogg” controls />• Formats – .ogg/.oga – .mp3 – .wav – .aac (Advanced Audio Coding)• Legacy browser fallback
  • MIME typesFormat Attribute type MIME type.ogg video/ogg application/ogg.mp4 video/mp4 video/mpeg.webm video/webm video/webm.mp3 audio/mp3 audio/mpeg.wav audio/wav audio/wav.aac audio/aac audio/aac.mp4 audio/mp4 audio/mp4
  • CanvasThe canvas element provides scripts with a resolution-dependent bitmapcanvas, which can be used for rendering graphs, game graphics, or other visualimages on the fly.
  • Canvas• Native drawing surface• Canvas tag – <canvas id=“square” width=“10” height=“10” />• JavaScript API for 2D drawing
  • WebSocketTo enable Web applications to maintain bidirectional communications withserver-side processes, this specification introduces the WebSocket interface.
  • WebSocket• WebSocket object• New protocol – ws://html5rocks.websocket.org/echo• Establishing an open connection – Client and server can send data at any time – Realtime web application
  • WebSocket example
  • Web StorageThis specification introduces two related mechanisms, similar to HTTP sessioncookies, for storing structured data on the client side.
  • Web storage• Avoiding HTTP overhead of cookies• Key-value pairs• Local storage• Session storage• Quota – Needing user confirmation if exceeding storage capability
  • Indexed DatabaseThis specification defines APIs for a database of records holding simple valuesand hierarchical objects. Each record consists of a key and some value.Moreover, the database maintains indexes over records it stores. An applicationdeveloper directly uses an API to locate records either by their key or by using anindex. A query language can be layered on this API. An indexed database can beimplemented using a persistent B-tree data structure.
  • Indexed database• Object based data store• Asynchronous API• Execute commands and open cursor inside transactions
  • Opening indexed database
  • Creating an Object Store
  • Storing data into Object Store
  • Querying data by cursor
  • OfflineIn order to enable users to continue interacting with Web applications anddocuments even when their network connection is unavailable — forinstance, because they are traveling outside of their ISPs coverage area —authors can provide a manifest which lists the files that are needed for the Webapplication to work offline and which causes the users browser to keep a copyof the files for use offline.
  • Application cache• Cache resources locally – HTML, CSS, JavaScript, images, etc.• Use a manifest file to specify resources in order to cache• Download caching resources in a transaction• window.applicationCache• Add manifest attribute to html tag – manifest=“example.appcache”• MIME type – text/cache-manifest appcache• Clear cache: chrome://appcache-internals/
  • Manifest fileCACHE MANIFEST#v1.0.0CACHEindex.htmlstyle.cssScripts/main.jsimages/logo.pngFALLBACKtime.js fallback_time.js
  • Updating to new version
  • FileSystemThis specification defines an API to navigate file system hierarchies, and definesa means by which a browser may expose sandboxed sections of a users localfile system to web applications.
  • File system• Sandboxed environment• Allow create/edit/delete files and directories
  • GeolocationThe Geolocation API defines a high-level interface to location informationassociated only with the device hosting the implementation, such as latitudeand longitude. The API itself is agnostic of the underlying location informationsources. Common sources of location information include Global PositioningSystem (GPS) and location inferred from network signals such as IP address,RFID, WiFi and Bluetooth MAC addresses, and GSM/CDMA cell IDs, as well asuser input. No guarantee is given that the API returns the devices actuallocation.
  • Geolocation• Allow users to share their location for location-aware services – Application >> Browser >> 3rd services such as Skyhook or Google• Privacy – Users are asked to share their location• navigator.geolocation – getCurrentPosition – watchPosition• Location metadata – latitude/longtitude/altitude – accuracy/altitudeAccuracy – heading/speed
  • Resources• HTML5 rocks – http://www.html5rocks.com/en/• Modernizr – http://www.modernizr.com/• Mobile HTML5 – http://mobilehtml5.org/• Source code – http://bit.ly/tZ6eBn
  • Q & AEmail: namho@kms-technology.comTwitter: @hotrannam
  • Thank you for joining!