I really need to think of a clever name for my blog

Code samples, geeky links and other musings. Note this blog has recently moved from Posterous, so isn't fully back up to speed yet!

Scheduling Web Audio – Link

Having built a simple game with plenty of audio effects last year, I can testify as to how tricky HTML5 Audio can be – support varies wildly (Try getting two simultaneous samples on an iPad…)

Timing is also difficult, but this article sets out to explain how to get it right. Fascinating reading…

http://www.html5rocks.com/en/tutorials/audio/scheduling/

Ninja Reloads

Just a couple of quick links for future reference.

http://shoogledesigns.com/blog/blog/2012/07/23/sublime-text-2-package-control-and-livereload/

No more switching windows and hitting reload? Yeah, pretty damn ninja.

But not as ninja as…. a NINJA!

http://arstechnica.com/information-technology/2012/07/ninja-power-open-source-html5-toolset-hopes-to-unleash-the-web/

@font-face pitfalls and answers

Some useful tips to avoid certain @font-face pitfalls:

@font-face gotchas – Paul Irish [new window]

 

I have copied Paul’s post over here wholesale just in case his site ever goes down – Do check out his site though – there are always interesting posts to be found and I highly recommend it.

See also: Disasterman’s <pre>posterous – @font-face – The Complete Solution?

All content below here sould be considered © Paul Irish and his relevant sources, not me!

 

 

Over the past few months, I’ve collected a few worthwhile notes on @font-face that are worth reading over if you geek out about this stuff…

font-weight:normal;      font-style:normal;      font-variant:normal;      /* these values are defaults in FF/Opera/IE but not webkit */

@font-face links that might have sneaked past you

And.. regarding @font-face syntax

I now recommend the bulletproof smiley variation over the original bulletproof syntax.

@font-face {  font-family: 'Graublau Web';  src: url('GraublauWeb.eot');  src: local('☺'),         url('GraublauWeb.woff') format('woff'), url('GraublauWeb.ttf') format('truetype');}

From the bulletproof post:

Yes, it’s a smiley face. The OpenType spec indicates any two-byte unicode characters won’t work in a font name on Mac at all, so that lessens the likelihood that someone actually released a font with such a name.

There are a few reasons why smiley is a better solution:

These are all pretty edge case issues, but it’s worth considering. FontSquirrel has already made the smiley syntax the new default in the Generator, and you should use it going forward as well.

Take a look at some of my other (recently updated) webfont stuff:

 

 

 

Fully cross platform video – HTML5 for iPad/iPhone with Flash fallback for older browsers

If, like me, you are a bit excited by the advent of native video and audio in HTML5, you are also probably apprehensive about cross platform support and backwards compatiblity.

The expolsion of iPlatforms without flash support is causing concern for many site owners – having spent enormous amounts of time and money creating and converting their videos to FLV for Flash video players, a lucrative demographic is now excluded from their content. HTML 5 promises a solution to this, but how best to implement it, and how to do it cheaply without investing in new software for conversion and delivery?

Luckily there are nutters out there who are already putting the hours in to create the solutions utilising Javascript to handle as many situations as possible..

I’ve tried two so far, and both have their pros and cons, as is to be expected.

It’s a pretty complicated sphere, and I’m not going into details here – GIYF, if you need to know more, but the information here should get you up and running in no time. Build either (or even both) solution into your own copy of HTML5 Boilerplate and I reckon you are really onto something…

VideoJS [★★★]

Simple, lightweight and easy to implement, VideoJS is a great solution for a single item player. I had this up and running in no time, with my eyes closed.VideoJS is either developed by or has been purchased by Zencoder. Thanks for that guys – cunning way to promote your paid-for encoding service! Makes sense really – make it easy for people to use video online and increase demand for your services…

http://videojs.com [new window]

Open Standard Media Player (OSM Player) [★★]

Complex, heavy, trickier to implement and sparsely docuemented, yet despite all this, based on my experience the jQuery driven OSM Player has massive potential. It’s much more feature rich, comes with a PHP implementation and if you are already using jQuery it’s nice to have something that fits in with your existing framework. This is one to keep an eye on in my opinion. I’d love to see all its parameters properly documented, but if you are prepared to dig under the hood it could be well worth the effort.

http://www.mediafront.org/project/osmplayer [new window]

[update 20110223-1140]

jPlayer [★★★★]

More features than VideoJS? Please.
More documentation and simpler implementation than OSM? Ta very muchly.
jQuery based? Why, ambassador… *flutters eyelids*
Worthy contender for the crown, with a few issues (IE is supported but why I can’t get it going in my initial implementation I do not yet know), jPlayer is, in general, right up my street. I like the coding style. The documentation is a bit spartan, but hardly required. Support forums are in place and in use. And their website is reasonably attractive and pleasant to use. All things that mark OSM down heavily, which considering OSM’s features is a tragedy. Get stuck in with jPlayer I say.

Note that for jPlayer’s Flash fallback to function it requires H.264/MP4 files to have an .m4v file extension – it doesn’t seem to support FLV video oddly for a flash player, but that does save you converting one more format.

http://www.jplayer.org [new window]

[/update]

[update 20110720-1625]

Projekktor [★★★]

Thought I would add this one in quickly (especially as this is one of my more popular posts) – I needed a player with easy YouTube support, and Projekktor did the job nicely. Very easy to implement, with some advanced features including playlists, skins and pre- and post-roll ads, with reasonable documentation. Well worth a shot if you want to get up and running quickly…

http://www.projekktor.com/ [new window]

[/update]

Converting your videos – Miro Video Converter

The important thing to remember is that you now need to provide at least THREE formats for every video – MP4, OGG and FLV.
This is because Safari (essential for those iPlatforms) and Chrome support MP4, Firefox and Opera support OGG. Oh my lord. Format wars? More on that in a minute.
The third format (FLV) is for older or obscure browsers. Which includes the latest Internet Explorer, because it is obviously both old and obscure. Or just plain awkward. Take your pick.

[update 20110223-1223]

For more on the format bunfight see my blog post on the subject

[/update]

Now assuming you already have all your old FLV videos, one quick and dirty solution is Miro Video Converter – this is a free and extremely simple utility that will output Theora (OGG) and H.264 (MP4/M4V) file. If you need to do batch conversions you will need to hunt out a better solution – as I am only testing my first implementation for a site with just a single video I haven’t looked into one yet, but I’m sure it will be coming up soon! Also, for MP4, Miro only seems to do single-pass encoding, so you may want to look at an alternative (like Avidemux) for two-pass encoding.

http://www.mirovideoconverter.com [new window]

There is a third format for HTML 5 – .webm. Say whaaat? It’s a format for Google’s open source codec VP8. It is supported by Firefox, Chrome and Opera currently, and if Safari adds support (and IE when they decide to join the HTML 5 video party) then it will solve the format wars problem. Of course whether Apple and Microsoft are comfortable with everyone using Google’s video codec is something that remains to be seen.

You can also convert your files to .webm with Miro Video Converter.

Online Conversion

If you are regularly converting large numbers of files, or want a solution to integrate with a CMS then a service like Zencoder [new window] is worth looking into, and I have had very satisfying results.

Alternatively, if you are running a *nix server and a willing to throw the resources at processing video yourself, you can check out ffmpeg [new window] - installation and configuration can be challenging, but there are people out there who will do it for you at very reasonable rates. If you are processing a lot of videos though, this will impact on your overall server performance, so bear this in mind.

Serving OGG files

Many web servers are not configured to correctly server OGG or WEBM files – this can easily be corrected by adding ‘AddType video/ogg .ogv ‘ and ‘AddType video/webm .webm’ to your .htaccess file. For safety’s sake you might want to add MP4 too:

AddType video/ogg .ogv
AddType video/mp4 .mp4
AddType video/webm .webm

Exciting me today… Social media jQuery, one element icons and more…

Hell yeah… Dealing with social media counters and buttons is TEDIOUS.

http://filamentgroup.com/lab/socialcount/

I love clever CSS. one-div aims to build a database of single div icons leveraging pseudo elements and some cunning gradients – dig around in the css to learn some interesting tricks. Will be fascinating to see how much more cunning people’s techniques will become over time…

http://one-div.com/

If you have a heavily AJAX’ed web app, telling the user’s they are offline (a la Gmail) would be a great boon, n’est pas?

http://oskarkrawczyk.github.com/heyoffline.js/

Automated jQuery testing? Sounds interesting…

https://github.com/ianb/walkabout.js

Scrubby – scrub slider style adjustment of JS values. Fantastic for experimenting, damn handy for interfaces…

http://nornagon.github.com/scrubby/

All above scraped from the often very useful Co-drops Collective newsletter
http://tympanus.net/codrops/collective/collective-40

 

Learn about the HTML 5 Audio API from repropductions of the BBC Radiophonics workshop. Sounds pretty cool to me…

http://webaudio.prototyping.bbc.co.uk/

 

I also mean to get round to reading this at some point:

http://net.tutsplus.com/tutorials/javascript-ajax/what-they-didnt-tell-you-about-es5s-array-extras/

 

Prism – JS/CSS Syntax Highlighting

Looks great.

Well, the dark theme is a bit, shall we say, chocolate-y, and the funky theme is a horrific 80′s headfuck (if slightly amusing), but hey, CSS is CSS so you can change that. The default theme is perfectly tasteful. More importantly it’s lightweight, fast and extensible. I should add it to this blog sometime.

http://prismjs.com/

Bunfightclub: HTML5 Video – Google Vs. H.264

Allow me to digress. I know, I’ve not even started yet, but hey, what do I care?

I got an update from JW Player today that prompted me to check out their player again. I’ve recently been implementing open source HTML5 video solutions, and as a former proponent of the once world conquering JW Player, I thought I’d check out their latest offering.

Indeed, they are up to speed, as you would expect, and open source. But, licensing is STILL required for ANY ‘commercial’ (i.e. pretty much ANY full stop) website. Oh well. Sorry guys, you had a dominant position and probably make a lot of money these days, so drop those prices and create a more liberal definition of commercial and I’ll consider recommending you again. In the meantime I look forward to seeing you taken down a peg or two.

Forward the properly open standards!
For more on the subject, and some solutions I’ve tried, see my earlier post Fully cross platform video – HTML5 for iPad/iPhone with Flash fallback for older browsers

DIGRESSION
ENDS

A blog on their site brought something to my attention however – Google have dropped H.264 support from Chrome. This is a bit of a bunfight over standards, and has also stirred up a bunfight amongst commentators.

This blog on TechCrunch lays right in to Google over it, (as do a lot of commenters on the Chromium Blog post above) and they also dig at them over their proposed WEBM plugins for IE and Safari.

Personally, I understand Googles decision, and side with the Opera developer/blogger Havaard who explains his reasons for supporting Google’s move and also clarifies some of Googles arguments rather well. 

@font-face – The Complete Solution?

Embedding fonts for use in websites with cross-browser compatibility is now very much possible – but it’s still a bit complicated.

These two resources greatly help to make the solution bulletproof and painless:

Bulletproof @font-face syntax « Paul Irish

The best syntax solution explained
http://paulirish.com/2009/bulletproof-font-face-implementation-syntax/ [new window]

Paul is also a founder of the very interesting “HTML5 Boilerplate – A rock-solid default for HTML5 awesome.[new window] – a startup kit for developing HTML5 and cross-browser compatible websites.

Font Squirrel | Create Your Own @font-face Kits

An @font-face generator that converts your fonts and gives you the CSS ready to go!
http://www.fontsquirrel.com/fontface/generator [new window]

Font squirrel also provide hundreds of fonts free for commercial use, and @font-face kits ready to go for any website. 

[update201101070244]

Here’s a handy little presentation on the subject, and includes some tips on minimising the dreaded fout. It’s actually quite old, but from what I know it’s all still very relevant.

[/update]

[update201104051316]

Hmm. Not sure where that presentation has gone. Oh well. Some more useful tips can be found in this blog post: Disasterman’s <pre>posterous – @font-face pitfalls and answers