<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Softcore software development &#187; html5</title>
	<atom:link href="http://tea.cesaroliveira.net/archives/tag/html5/feed" rel="self" type="application/rss+xml" />
	<link>http://tea.cesaroliveira.net</link>
	<description>It&#039;s all about the cycles</description>
	<lastBuildDate>Sun, 01 Aug 2010 02:04:06 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Uncovering the underlying metadata</title>
		<link>http://tea.cesaroliveira.net/archives/54</link>
		<comments>http://tea.cesaroliveira.net/archives/54#comments</comments>
		<pubDate>Thu, 22 Jan 2009 18:28:43 +0000</pubDate>
		<dc:creator>Cesar</dc:creator>
				<category><![CDATA[Web]]></category>
		<category><![CDATA[hugs]]></category>
		<category><![CDATA[audio]]></category>
		<category><![CDATA[bug]]></category>
		<category><![CDATA[extension]]></category>
		<category><![CDATA[html5]]></category>
		<category><![CDATA[seneca]]></category>
		<category><![CDATA[sleep]]></category>

		<guid isPermaLink="false">http://www.cesaroliveira.net/?p=53</guid>
		<description><![CDATA[A few weeks ago, I wanted to do some C++ Mozilla coding to make sure I wasn&#8217;t going soft. But I didn&#8217;t really know what to do. I left it for a bit until I found something weird about the HTML5 spec &#8211; there was a method of testing whether metadata has been loaded, but [...]]]></description>
			<content:encoded><![CDATA[<p>A few weeks ago, I wanted to do some C++ Mozilla coding to make sure I wasn&#8217;t going soft. But I didn&#8217;t really know what to do. I left it for a bit until I found something <a href="http://www.whatwg.org/specs/web-apps/current-work/multipage/video.html#dom-media-have_metadata" onclick="pageTracker._trackPageview('/outgoing/www.whatwg.org/specs/web-apps/current-work/multipage/video.html_dom-media-have_metadata?referer=');">weird about the HTML5 spec</a> &#8211; there was a method of testing whether metadata has been loaded, but no way to expose the metadata (eg. song title, artist, album, etc) to the user such as through page info.</p>
<p>I think this will be useful. As media starts being embedded into the web browser, it would make sense to start exposing this to the user. I know there have been a few instances where I was listening to something on the radio, but there was little hint of what the song was called (I usually tried to remember a few lyrics and did a Google search. Mixed success).</p>
<p>I brought this up in the whatwg irc channel, and apparently this is being considered for the next version of the spec. Which is understandable, because the server can always display the metadata. But often, media may not be central to the website. For example, background music.</p>
<p>I started look at the Audio/Video backend stuff that moz uses. It got confusing real quick (it doesn&#8217;t help that the <a href="http://mxr.mozilla.org/mozilla-central/source/content/html/content/src/nsHTMLAudioElement.cpp" onclick="pageTracker._trackPageview('/outgoing/mxr.mozilla.org/mozilla-central/source/content/html/content/src/nsHTMLAudioElement.cpp?referer=');">audio code</a> itself is completely empty). Plus I was in a hurry. So I decided to implement it as an extension.</p>
<p>It was a lovely experience. I had a few problems, including finding out that audio/video wasn&#8217;t actually being saved to the cache (<a href="https://bugzilla.mozilla.org/show_bug.cgi?id=469446" onclick="pageTracker._trackPageview('/outgoing/bugzilla.mozilla.org/show_bug.cgi?id=469446&amp;referer=');">bug 469446</a>). It was checked-in like 2 days after I found it out. Also, I hate string very much. The string guide helped, but it is still awful. And I made firefox crash a few times because I&#8217;m a nsCOMPtr n00b.</p>
<p>Right now, this extension is working only with ogg vorbis files. Which is stupid because &lt;audio /&gt; is rarely used anywhere, and if it is used, only with certain conditions (wikimedia commons uses the audio tag, but not really. Apparently, the video/audio tags start automatically downloading the media even if it isn&#8217;t under autoplay. This is a mess if you have dozens of audio tags in one page. <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=464272" onclick="pageTracker._trackPageview('/outgoing/bugzilla.mozilla.org/show_bug.cgi?id=464272&amp;referer=');">bug 464272</a>). It is so rarely used, that I had to create a <a href="/files/2009-01-22/audio">audio demo page</a> for testing purposes.</p>
<p>Using it is very simple. Right-clicking on a audio tag brings up the context menu. I decided to use the context menu over Page Info because the media tab of the Page info dialog is very much geared towards images, and that code has to be changed in the firefox source (it&#8217;s not easy/pretty to overlay).</p>
<div style="text-align:center;"><img src="/files/2009-01-22/context.png" alt="audio context menu"/></div>
<p>Which brings up the audio&#8217;s metadata</p>
<div style="text-align:center"><img src="/files/2009-01-22/properties.png" alt="audio properties"/></div>
<p>While a lot of metadata is displayed, some isn&#8217;t. For example, iTunes has support for cover art as a COVERART header. While you can put that in vorbis, it should be noted that it isn&#8217;t <a href="http://wiki.xiph.org/index.php/VorbisComment#Unofficial_.22COVERART.22_field" onclick="pageTracker._trackPageview('/outgoing/wiki.xiph.org/index.php/VorbisComment_Unofficial_.22COVERART.22_field?referer=');">widely supported</a>. So I decided to put in only the <a href="http://www.xiph.org/vorbis/doc/v-comment.html" onclick="pageTracker._trackPageview('/outgoing/www.xiph.org/vorbis/doc/v-comment.html?referer=');">standard headers</a> for now.</p>
<p>This is dealing with C++ code. Which is much more dangerous than javascript code because NS_ERROR_OMGWTF doesn&#8217;t appear in your error console when I try to free an uninitialized pointer. I made basic checks so hopefully nothing bad will happen. But I didn&#8217;t do extensive checking in case we have a bad ogg file or something.</p>
<p>Well, to be fair to me, I always save the function&#8217;s return value. I just didn&#8217;t check whether it passed nor did anything about it. And this won&#8217;t just crash at any time. It&#8217;ll crash if you try to load the metadata (I&#8217;m very nice like that).</p>
<p>The name of the <a href="https://addons.mozilla.org/en-US/firefox/addon/10465" onclick="pageTracker._trackPageview('/outgoing/addons.mozilla.org/en-US/firefox/addon/10465?referer=');">extension is saraswati</a>, named after the <a href="http://en.wikipedia.org/wiki/Saraswati" onclick="pageTracker._trackPageview('/outgoing/en.wikipedia.org/wiki/Saraswati?referer=');">hindu God of music and knowledge</a> (really, a Google search helped out a lot here). Please enjoy! (Linux x86, x86-64 and Windows x86 only right now)</p>
]]></content:encoded>
			<wfw:commentRss>http://tea.cesaroliveira.net/archives/54/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Now for something completely different</title>
		<link>http://tea.cesaroliveira.net/archives/42</link>
		<comments>http://tea.cesaroliveira.net/archives/42#comments</comments>
		<pubDate>Fri, 31 Oct 2008 05:41:31 +0000</pubDate>
		<dc:creator>Cesar</dc:creator>
				<category><![CDATA[Web]]></category>
		<category><![CDATA[hugs]]></category>
		<category><![CDATA[html5]]></category>
		<category><![CDATA[ria]]></category>

		<guid isPermaLink="false">http://www.cesaroliveira.net/?p=42</guid>
		<description><![CDATA[This post is a mashup of a few things I have been tinkering with over the last week that I think is fun to share. So if it seems I have been unfocused or whatever, this is pretty much why. The first project I started doing for fun was working on canvas. This was different [...]]]></description>
			<content:encoded><![CDATA[<p>This post is a mashup of a few things I have been tinkering with over the last week that I think is fun to share. So if it seems I have been unfocused or whatever, this is pretty much why.</p>
<p>The first project I started doing for fun was working on canvas. This was different then some canvas stuff I have done <a href="http://www.cesaroliveira.net/tea/archives/37" onclick="pageTracker._trackPageview('/outgoing/www.cesaroliveira.net/tea/archives/37?referer=');">in the past</a>, The interesting people at <a href="http://www.nihilogic.dk/" onclick="pageTracker._trackPageview('/outgoing/www.nihilogic.dk/?referer=');">nihilogic</a> did a <a href="http://www.nihilogic.dk/labs/imagefx/" onclick="pageTracker._trackPageview('/outgoing/www.nihilogic.dk/labs/imagefx/?referer=');">sepia filter</a> using canvas. I wondered if it was possible to do filter so you can see an image with a red-green colour blindness. After some substandard research, I finally managed to do it. Though the quality is poor because it tends to be inaccurate. YMMV.</p>
<p>I wondered if you can do something like this for an entire webpage. So I moved the Javascript to an extension so I can use canvas&#8217; drawWindow() method and take a picture of the entire website. Though I noticed that doing this on large image was computationally expensive and locking up the UI for an unreasonable amount of time.</p>
<p>I then tried to move all the calculations out of the main thread into a <a href="http://www.whatwg.org/specs/web-workers/current-work/" onclick="pageTracker._trackPageview('/outgoing/www.whatwg.org/specs/web-workers/current-work/?referer=');">DOM worker thread</a>. It was an interesting experience. I noticed though that while the main thread (and therefore, the UI) did not lock up, it was still sluggish and impractical to use. So I decided not to develop the extension further.</p>
<p><img src="/files/2008-10-29/firefox-transfer.png" alt="Image under Deuteranopia colour-blindness" /><br />
You can see the full demo <a href="http://www.cesaroliveira.net/samples/blindness/" onclick="pageTracker._trackPageview('/outgoing/www.cesaroliveira.net/samples/blindness/?referer=');">here</a>.</p>
<p>I then thought about what this would look like on other browsers. I didn&#8217;t expect anything requiring DOM worker threads to work on Safari/Opera. And sure enough, it didn&#8217;t. But I found out that DOM worker threads was based off of <a href="http://code.google.com/apis/gears/api_summary.html" onclick="pageTracker._trackPageview('/outgoing/code.google.com/apis/gears/api_summary.html?referer=');">Google gears</a>! So I looked into that and made a separate webpage that uses gears. Unfortunately, I found out that my efforts were largely wasted, as it only increased support to Firefox 2 and Mac Safari (Gears isn&#8217;t compatible with Windows Safari or Opera, and IE doesn&#8217;t have canvas support).</p>
<p>Either way, I made the Gears version available <a href="http://www.cesaroliveira.net/samples/blindness-gears/" onclick="pageTracker._trackPageview('/outgoing/www.cesaroliveira.net/samples/blindness-gears/?referer=');">here</a>.</p>
<p>Going away from canvas, I spent most of another day working on <a href="http://code.google.com/apis/maps/documentation/introduction.html" onclick="pageTracker._trackPageview('/outgoing/code.google.com/apis/maps/documentation/introduction.html?referer=');">Google Maps API</a>. The problem I was trying to solve was to see if I can highlight a 1 square kilometre radius from a pinpoint. This was difficult, as points on a map had a latitude, longitude co-ordinate, and I had to blindly figure out how much to reposition for a half-kilometre. Finding the distance between two points was also helpful, but hard getting a <a href="http://www.movable-type.co.uk/scripts/latlong.html" onclick="pageTracker._trackPageview('/outgoing/www.movable-type.co.uk/scripts/latlong.html?referer=');">good formula</a> for.</p>
<p><iframe src="/samples/gmaps-distance/" width="600px" height="410px"></iframe><br />
Of course, I am highlighting all the accomplishments and not mentioning the frustrating obstacles. There were  several lessons learn on the way. Including a lot about incompatibility and how much I still don&#8217;t know how to do the kind of algorithmic research that you sometimes need. I&#8217;m starting to wonder if the BSD course taught me more than just to be a code monkey with a business touch, and made me wonder whether the theoretical/mathematical part will ever stop me doing something because “I just won&#8217;t get it”. Though, at the same time, I wasn&#8217;t willing to put the time and effort of research into pet projects. So this will probably be a problem for almost everyone, and not just me (honestly, mapping out longitude and latitude to distance is not something you learn anywhere).</p>
]]></content:encoded>
			<wfw:commentRss>http://tea.cesaroliveira.net/archives/42/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
