iOS5 mobile safari changes and additions developers should be aware about

October 14th, 2011 1 comment

Mainly some notes for myself:
* utilizes HTTP Pipelining (Sends multiple requests on the same connection) to avoid round trip delays on servers that support them
* GPU accelerated rendering (for CSS transitions and such)
* “async” attribute for scripts now supported
* Loading of CSS scripts are now blocking
* HTML5 Web workers support
* CSS position: fixed
* CSS overflow: scroll (-webkit-overflow-scrolling: touch;)
* Still no browser based file upload (input type=”file”)
* new input types: date, datetime, month, time, range
* new EcmaScript 5 stuff

Categories: html5, iOS, iOS5, mobile development Tags:

Web app http request errors in iOS5 mobile safari caused by HTTP Pipelining?

October 14th, 2011 1 comment

iOS5 seams to have broken functionality in our HTML5 mobile webapp. Requesting audio media assets are currently failing 1 out of 2 times with one of two errors:

The operation couldn’t be completed. (NSURLErrorDomain error – 1013.)
The operation could not be completed

After much research I’ve come to the conclusion that our authenticated media host is having issues with the updated HTTP Request behavior in iOS5′s version of mobile Safari. iOS5 now uses its own flavor of HTTP Pipelining to speed up data transfer and my theory is somewhere along the line our host’s web server is disagreeing with it.

Since mobile networks usually have very high latency HTTP Pipelining allows the HTTP client to avoid round trips to the server by send multiple requests on the same connection without waiting for the server to respond. You can read up on iOS5′s version of HTTP Pipelining and the concept in general here:
http://www.blaze.io/mobile/ios5-top10-performance-changes/
http://www.blaze.io/mobile/http-pipelining-big-in-mobile/

We’ll be reaching out to our media content provider today to validate but I figured I would throw up a place for others experiencing the same issue to discuss as I am not seeing other posts about it yet.

Categories: html5, iOS, iOS5, mobile development Tags:

The IE silver bullet for HTML5 CSS3 Webapp development: Chrome Frame

October 11th, 2011 2 comments

Building javascript heavy webapps using html5 and css3 is tough when you have old but still stubbornly popular Internet Explorer browsers to support. The solution: Chrome Frame

In Google’s words:

Google Chrome Frame is an open source plug-in that seamlessly brings Google Chrome’s open web technologies and speedy JavaScript engine to Internet Explorer.

In my words: Hello IE 6, 7, 8 render my shit automagically using Chrome.

Once installed, this meta tag in your html will tell IE to use Chrome’s engine to render the document:

<meta http-equiv="X-UA-Compatible" content="chrome=1">

Don’t have Chrome Frame installed yet? These few lines of condition IE logic will check and prompt:

<!--[if IE]>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/chrome-frame/1/CFInstall.min.js"></script>
<style>
         .chromeFrameInstallDefaultStyle {
           width: 800px;
           border: 5px solid blue;
           z-index: 99999;
         }
        </style>

        <script>
         // The conditional ensures that this code will only execute in IE,
         // Therefore we can use the IE-specific attachEvent without worry
         window.attachEvent("onload", function() {
           CFInstall.check({
             mode: "inline", // the default
             oninstall: function(){
                 alert("Chrome Frame is now installed. You may need to restart your browser.");
             }
           });
         });
        </script>
<![endif]-->

Chrome Frame is installed at the user level if the user does not have admin access (Win!). The documentation states a restart isn’t even necessary once installed but I’ve found in my tests that the browser does need to be fully restarted so I’ve included a post-install alert specifying so in my code.

Forcing a user to install a plug-in to see content is usually a no-no but when it comes to all-or-nothing HTML5 CSS3 webapps that need to span all browsers an devices with a single codebase sometimes those IE6 users can use a little prodding. To clarify, Chrome the web browser does not have to be installed beforehand and installing the plug-in does not install the Chrome browser. Chrome Frame’s name is a bit of a misnomer as the structure of your document is not modified and no DOM frame is used–everything is just rendered beautifully even in IE6 using Chrome’s versions of the WebKit layout engine and V8 JavaScript engine via the IE plugin.

Categories: html5, mobile development Tags:

Fix self hosted ogg and webm videos not loading in Firefox html5 tags

August 13th, 2011 No comments

If your videos are not loading in Firefox with a 206 Partial Content check the Content Type returned in the response header for the file. If it reads text/plain your server isn’t passing the MIME type of the video. You should be able to create a .htaccess file in your video directory to fill in the missing MIME types. For example include this:

AddType video/ogg ogg
AddType video/webm webm

Categories: html5 Tags:

Add webm and ogg export options to Mac Quicktime

August 13th, 2011 No comments

For WebM support you can download the installer here.

For OGG dowload XiphQT.component from here and put it in your /Library/Components folder

Its worth noting that this will also add Webm and Ogg support to the html5 video tag in Safari.

Categories: html5, mac Tags:

Mac OS Lion breaks Flash’s internal settings prompts (and some other stuff)

August 12th, 2011 1 comment

If you haven’t installed Mac OSX Lion yet I would probably wait. So far I’m finding it:
- Breaks encoded audio over hdmi (Can’t listen to movies with AC3 Audio through HDMI when using as a HTPC via VLC)
- Gets stuck in a mode where it won’t let me copy and paste files in Finder until I restart Finder (file is pasted then immediately disappears)
- and now I find out its even made the Flash Settings menu unclickable effectively breaking every site utilizing flash’s camera permission dialogue among other things (https://bugbase.adobe.com/index.cfm?event=bug&id=2918693)
Luckily its been fixed in an update that just came out, Flash Player 10.3.183.5. Its interesting to note that Flash Player now has its own icon in the OS System Preferences.

Other things I’m not a fan of:
- Minimizes the use of scrollbars to the point where you can’t tell if you have scrollable content unless you try to scroll
- Greyscales all Finder’s color icons in the left side toolbox so you can’t tell them apart without looking at them closely
- Puts your hard drives last in the order stuff on the left hand so its often not even on the screen (apparently you can’t even change this)
- never closes files automatically in Quicktime, so as you open videos and command-q the app they just pile up forever.
For the quicktime weirdness, you can type this in Terminal to permanently disable the “resume” feature:
defaults write com.apple.QuickTimePlayerX NSQuitAlwaysKeepsWindows -bool false

Categories: bugs, flash, mac Tags:

convert gradient rotation into webkit’s css3 -webkit-gradient percentage based x and y pairs

March 28th, 2011 No comments

Webkit has extended their css3 gradient options with -webkit-linear-gradient which uses the standard “gradient rotation” value found in Mozilla’s -moz-linear-gradient but unfortunately this is only supported in Safari 5.1+ and Chrome 10+. Until Safari 5.1 becomes the norm any programmatic references to gradient rotation have to be converted from the typical 360 based rotation value to Webkit’s powerful but awkward (powerfully akward?)  -webkit-gradient point syntax where your linear gradient’s start and end values have to be defined as X,Y value pairs that explicitly state at what point the gradient starts and ends.

For a linear right-to-left gradient you could define percentage points like so:
-webkit-gradient(linear, 0% 50%, 100% 50%, color-stop(0, rgba(80,80,80,1)), color-stop(1, rgba(80,80,80,0.5)));
Which reads “start the gradient at wherever “0% width and 50% height” is and end the gradient at “100% width and 50% height”.

This is easy enough to calculate by hand but if you have a project with a ton of regular gradient rotation styles already defined you’re going to need to convert via javascript and some Trigonometry which is the situation I was in. A bit of googling turned up no clear cut method of converting a gradient rotation value to a pair of percentage based X and Y values so here is what I came up with. First the code:

function pointOnCircle(radius, angleInDegrees, origin){
var x = (radius * Math.cos(angleInDegrees * Math.PI / 180)) + origin.x;
var y = (radius * Math.sin(angleInDegrees * Math.PI / 180)) + origin.y;
return {x:x, y:y};
}

//webkit has updated syntax from -webkit-gradient to a much more sensible -webkit-linear-gradient with angle but
//this is only supported in Safari 5.1+ nd Chrome 10+ so we’ll have to do the math to convert gradient rotation to
//start and end points on a circle
var gradientRotation = 0 – (node.gradientRotation%360);
var centerPoint = {x:0, y:0};
var rotatedStartPoint = KickUtils.pointOnCircle(50, 180-gradientRotation, centerPoint);
var rotatedEndPoint = KickUtils.pointOnCircle(50, 360-gradientRotation, centerPoint);
rotatedStartPoint.x = Math.round(rotatedStartPoint.x+50);
rotatedStartPoint.y = Math.round(rotatedStartPoint.y+50);
rotatedEndPoint.x = Math.round(rotatedEndPoint.x+50);
rotatedEndPoint.y = Math.round(rotatedEndPoint.y+50);
return ‘background-image: -webkit-gradient(linear, ‘ + rotatedStartPoint.x+’% ‘+rotatedStartPoint.y+’%, ‘+rotatedEndPoint.x+”% “+rotatedEndPoint.y+’%, color-stop(0, …

Since a numeric gradient rotation value defines a gradient that passes through the center of a circle, you can use the trig function above to calculate the 2 points that line intersects the radius of the circle. Defining the center of the circle at 50, 50 you can get values returned in the -50 to +50 range. Add 50 to that value and tack on a % and voila your 2 percentage based points start and end values are defined.

Categories: html5 Tags:

Pretty annoying flash bug with html text event links

March 10th, 2011 No comments

http://www.blog.lessrain.com/as3-texteventlink-and-contextmenu-incompatibilities/

There doesn’t appear to be a work around..other then not using html text event links.

Categories: bugs, flash Tags:

What Facebook’s authenticated comment module is doing for Techcrunch’s trolly comments on Flash

March 9th, 2011 2 comments

http://techcrunch.com/2011/03/08/adobe-wallaby-cant-jump/

Usually with any new Adobe/Flash related news comes a Techcrunch article to surmisely bash it with questionable ferocity. These are usually followed up by a ton of anonymous comments on the post echoing the same sentiments. It’s interesting to note that now that comments on Techcrunch are authenticated by way of Facebook’s commenting API practically every single comment is the reverse, as Steven Sacks says in the comments of the article above:

This is interesting. Ever since TechCrunch switched to Facebook comments, all their anti-Flash posts have a slew of comments supporting Flash. Prior to this, all the anti-Flash post comments were predominantly anti-Flash. Good to see all those anonymous posters don’t have the guts to post under their real names AND can’t write negative comments under numerous names.

The real public has spoken.

 

The more you know *ting*

Categories: flash Tags:

Loading zip files in AS3

November 2nd, 2010 1 comment

Working on a project where I need to load and unzip files in Flash I stumbled on some pretty useful libraries.

The first is FZip which can load modify and create zip files in Flash.
Perks: FZip parses ZIP archives progressively, allowing access to contained files while the archive is loading.
Detractors: If not used in an AIR environment which provides a low level deflate method it can’t unzip compressed zip files without your manually injecting an Adler32 Checksum to the file ahead of time. They provide convenient Python and Java code to unobtrusively inject Adler32 checksums in your zip files.

The other is nochump.com’s AS3 Zip Library.
Perks: Can unzip files without the need of injecting Adler32 Checksums ahead of time.
Detractors: Slow as balls.

For a project I’m working on where I have a ton of zip files to parse I find myself using the first and falling back to the latter if the Adler32 Checksum is not found. I’m far from a command line exert but here is a handy line you can place in terminal to recursively scan the working directory for every zip file and add Adler32 checksums via FZip’s handly fzip-prepare.py python script (note that it is only checking for zip files above 1MB):
find . -size +1M -iname “*.zip” | sed -e ‘s/.*/”&”/’ | xargs -I {} python /fzip-prepare.py {} -L1

Categories: flex Tags: