| By Bryan Halfpap | Article Rating: |
|
| January 22, 2010 05:15 PM EST | Reads: |
9,178 |

HTML5-Compatible WebBrowsers
The first tag we will look at is the <AUDIO> tag. This new tag allows us to embed audio content in a variety of formats that the browsers will understand. As of now the browser file format support is somewhat spotty, so it’s worth checking the chart at w3c.org and enabling multiple file formats inside the audio tag.
Lets do a quick example of the <audio> tag:
<audio controls="controls">
<source src="song.ogg" type="audio/ogg" />
<source src="song.mp3" type="audio/mpeg" />
Your browser does not support the audio element.
</audio>
Before we had to embed a player application, then have some javascript load the object into the player, and finally, the player would play the music for us. With HTML5 compatible browsers, we just load a new audio object with controls.
The control GUI isn’t standardized, so you may see some issues in formatting when you view with diffrent browsers, but on the whole this process is much easier.
If you wanted to have the audio play automatically, loop, or do something when it is buffering you can do that quite easily.
<audio src=”song.ogg” autoplay loop>Your browser does not support audio tags</audio>
You’ll note that there are no = signs or quotes — we don’t need them anymore! HTML5 eliminates the need for boolean attributes to have = or “”‘s. Simply put the name of the desired boolean property and it will be interpreted by the browser as being set to true. We’ll discuss this syntax change at length in the next article.
Below is the table of currently supported audio formats and the browser support for each:
| Format | IE 8 | Firefox 3.5 | Opera 10.5 | Chrome 3.0 | Safari 3.0 |
| Ogg Vorbis | No | Yes | Yes | Yes | No |
| MP3 | No | No | No | Yes | Yes |
| Wav | No | Yes | Yes | No | Yes |
According to this chart from W3C (link here, we will need at least two file formats of our audio file in order to cover all major browsers. For the example I chose Ogg and Wav formats.
<audio loop autoplay>Your browser does not support audio tags.
<source src="song.ogg" type="audio/ogg" />
<source src="song.wav" type="audio/mpeg" />
</audio>
This will allow the browsers to select the correct file type it needs with only two additional lines of code!
The <VIDEO> tag:
<video src="movie.ogg" controls="controls">
your browser does not support the video tag
</video>
We can see that the formatting is exactly the same as the audio tag. Like audio, we can also define multiple file sources in order to supply the correct format. All major web browsers support Ogg video and/or MP4.
<source src="movie.ogg" type="video/ogg" />
<source src="movie.mp4" type="video/mp4" />
You’ll probably need to do alot more than just display some video with some controls, though. This is where the new HTML5 events come in. Try a few of the selections below with some javascript at the w3c website here http://www.w3schools.com/html5/tryit.asp?filename=tryhtml5_video_simple
oncanplaythrough — play the element as soon as it is buffered.
oncanplay — play when able, even if it might have to stop for buffering.
preload — buffer the element and wait for play.
autoplay — Play as soon as page loads, don’t wait for buffering
onend — do something when the element is done (like play the next video in a set)
onemptied — do something if the buffer is used up and no more buffer remains (like from disconnections)
onerror — pretty self-explanitory. Do something if any errors in playing the element are encountered
A full list of HTML5 events can be viewed here: http://www.w3schools.com/html5/html5_ref_eventattributes.asp
The <object> Tag:The <object> tag takes over the loading of applications into the web browser from the <applet> tag. It makes it easier for both programmers and machines alike to read HTML markup and determine the values and settings being passed into the loaded application. Take this example of an embedded object:
<object classid="xxxxxxxx-xxxxxx" id="example">
<param name="code" value="test.class" />
<param name="test2" value="testing" />
<param name="fname" value="Alan" />
<param name="lname" value="Jenner" />
</object>
<object> tags have multiple ways to declare the source of the target application or plugin: URLs and windows registry items with the “classid” option, or three other src-related attributes. It doesn’t matter which you use as long as you follow this style:
<param name=”[code/src/data]” value=”[URL]”>
You can define code, src, data, or any of the other parameters in the <object> tag itself or within <param> elements.
What's with the weird tags?You may be asking at this point why the <object> tag is structured this way. It’s structured with these extra tags to make it easier for machines to read the code in websites, something that will be needed for the semantic web, a revolution in how the web works similar to web 2.0.
Tim Berners-Lee (the creator of the World Wide Web) defines the semantic web thusly:
I have a dream for the Web [in which computers] become capable of analyzing all the data on the Web – the content, links, and transactions between people and computers. A ‘Semantic Web’, which should make this possible, has yet to emerge, but when it does, the day-to-day mechanisms of trade, bureaucracy and our daily lives will be handled by machines talking to machines. The ‘intelligent agents’ people have touted for ages will finally materialize.
In the next article, I will go into the semantic web in depth and show examples of the syntactical changes from HTML4 to HTML5 that will facilitate the development of the semantic web.
Read the original blog entry...
Published January 22, 2010 Reads 9,178
Copyright © 2010 SYS-CON Media, Inc. — All Rights Reserved.
Syndicated stories and blog feeds, all rights reserved by the author.
More Stories By Bryan Halfpap
Bryan Halfpap is an Engineering Intern II at ARINC.
- Cloud People: A Who's Who of Cloud Computing
- Enterasys Spotlights SDN's Impact on Traditional Networking in Upcoming Webinar
- NASA's Twitter Account Wins Back-To-Back Shorty Awards
- Google Compute enters the IaaS market
- GoBank Announces Timing of General Availability and National Distribution Relationships at FinovateSpring
- MicroStrategy Announces General Availability of MicroStrategy 9.3.1
- MicroStrategy Announces General Availability of MicroStrategy 9.3.1
- Cloud Expo | Maximizing the Small Things: Efficiencies for Cloud Hardware
- Cloud Business Solutions, Social Media, and Platform Systems of Engagement Market Shares, Strategies, and Forecasts, Worldwide, 2013 to 2019
- Google Submits Concessions to EC; Gets Sued in the UK
- Infinity Augmented Reality and Technical Evangelist Robert Scoble Are Enthusiastic About the Upcoming Release of Google Glass
- Global Mobile Security (mSecurity) Market 2013-2018
- Cloud People: A Who's Who of Cloud Computing
- Enterasys Spotlights SDN's Impact on Traditional Networking in Upcoming Webinar
- RetailMeNot Shoppers Trend Report: While Over 8 in 10 U.S. Residents Cite Affordability as Their Top Vacation Priority, a Majority (58%) Could Waste Hundreds of Dollars by Booking Travel a la Carte
- NASA's Twitter Account Wins Back-To-Back Shorty Awards
- ChannelAdvisor Participates in Upcoming Retail Industry Conferences RBTE and Retail Week Live
- Basho Announces Open Source Riak CS and General Availability of Riak CS Enterprise v1.3
- Google Compute enters the IaaS market
- How to Protect Your Facebook Account Before Graph Search is Public
- Google Says Motorola’s Upcoming Phones Don’t ‘Wow’ Them
- Why Cloud Computing Skills Will Be Required for IT Workers
- GoBank Announces Timing of General Availability and National Distribution Relationships at FinovateSpring
- MicroStrategy Announces General Availability of MicroStrategy 9.3.1
- Where Are RIA Technologies Headed in 2008?
- Cloud People: A Who's Who of Cloud Computing
- Dolphin Announces Open API With Over 50 Add-ons Including Dropbox and Wikipedia
- ManageWP Powers Over 100,000 WordPress Sites Within Three Months of Launch
- SEO/SEM Tips & Tricks: How and When Should You Submit Your Website to Google?
- Google Version 2.0: Googzilla - The Calculating Predator
- Google's Competitive Advantage: It Leverages "The Power of Free"
- Cloud Expo 2011 East To Attract 10,000 Delegates and 200 Exhibitors
- Google Space Launches at Heathrow Airport
- AOL To Enhance Video Search Engine by Adding RSS Feeds
- Ulitzer’s Amazing First 30 Days in Public Beta
- The World's Youngest "Google Entrepreneur" Is One Month Old



























