<?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>pixelbyter &#187; iTunes Extras</title>
	<atom:link href="http://pixelbyter.co.uk/tag/itunes-extras/feed/" rel="self" type="application/rss+xml" />
	<link>http://pixelbyter.co.uk</link>
	<description>#rich nicholls</description>
	<lastBuildDate>Tue, 11 May 2010 11:07:35 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>developing iTunes LPs/iTunes Extras for the AppleTV</title>
		<link>http://pixelbyter.co.uk/2010/01/25/developing-itunes-lpsitunes-extras-for-the-appletv/</link>
		<comments>http://pixelbyter.co.uk/2010/01/25/developing-itunes-lpsitunes-extras-for-the-appletv/#comments</comments>
		<pubDate>Mon, 25 Jan 2010 01:45:03 +0000</pubDate>
		<dc:creator>pixelbyter</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[AppleTV]]></category>
		<category><![CDATA[iTunes Extras]]></category>
		<category><![CDATA[iTunes LP]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[source code]]></category>

		<guid isPermaLink="false">http://pixelbyter.local/?p=76</guid>
		<description><![CDATA[Apple&#8217;s &#8216;hobby&#8217; TV unit, AppleTV, is a rather limited platform in terms of interactability and processing power. After getting my hands on a unit for testing iTunes LPs on, I was shocked at the changes necessary in order to make an LP work on this medium. This article does not cover the information outlined within [...]]]></description>
			<content:encoded><![CDATA[<p>Apple&#8217;s &#8216;hobby&#8217; TV unit, AppleTV, is a rather limited platform in terms of interactability and processing power. After getting my hands on a unit for testing iTunes LPs on, I was shocked at the changes necessary in order to make an LP work on this medium. This article does not cover the information outlined within the <a>iTunes Extras/iTunes LP Development Guide</a>, which features a section covering some of the basics for AppleTV development.</p>
<h3>designing for the AppleTV remote</h3>
<p>Navigation is limited to the 6 input controls on the AppleTV remote: up, down, left, right, select/play/pause and back/menu. There is no way to override this and use a mouse cursor as the META tag in the projects main web file, index.html, would imply (&lt;meta name=&#8221;hdtv-cursor-off&#8221; content=&#8221;true&#8221;/&gt;). TuneKit, Apple&#8217;s LP/Extras Javascript development framework, automatically implements methods of controlling your project via the AppleTV remote. When using the default TKController up and down will be automatically used to scroll within a scrollable content box. Although this is helpful in a way, it then leaves the only methods of navigation around the interface of the left and right buttons, which can will leave any vertical navigation inopperable. Horizontal navigation or no navigation whatsoever is best for scrolling content pages. iTunes disables the keyboard interface, but Safari will let you use the cursor keys for directional movement, enter for select/play/pause and backspace for back/menu, so try navigating through your project using just these keys during development.</p>
<h3>developing for limited processing power</h3>
<p>The AppleTV is quite limited when it comes to what it can comfortably process when it comes to Javascript and CSS transitions. CSS transitions are always preferable to Javascript ones within this environment, thanks to how CSS3 transitions are optimised on the webkit platform, so try to avoid using jQuery for eye candy. Even when using CSS transitions you will notice that they refresh slowly, making fades and movement look jumpy. Try to use longer transition times to minimise this effect, or no transitions at all if possible. Many LPs/Extras disable visualisers and other effects dependant upon Javascript for the AppleTV.</p>
<h3>designing for display on a television set</h3>
<p>The AppleTV can display resolutions as low as 420p, but don&#8217;t let that worry you. All LP/Extra content should be designed for an HD TV at 1280&#215;720 pixels. The title-safe display area is 1024&#215;576, but very few LPs/Extras I have found have limited themselves to this area. Colour and brightness levels can vary greatly between TV sets, much more than on computer monitors. If you are using subtle colour or alpha changes in your navigation try to make them much more prominant on the AppleTV.</p>
<h3>beware</h3>
<p>The AppleTV uses a custom version of the Safari code, and so operates slightly differently in places. Meaning it has a couple of bugs. Test everything throroughly on an AppleTV before deployment. Just because something works in iTunes and Safari it doesn&#8217;t mean that it will work on the AppleTV.</p>
<h3>in conclusion</h3>
<ul>
<li>Only use horizontal navigation on pages using a scrollable content box.</li>
<li>Use CSS transitions over Javascript ones.</li>
<li>Disable visualisers or other Javascript-heavy pages.</li>
<li>Design for a high degree of colour and brightness variation between TV sets.</li>
<li>AppleTV uses a custom implementation of Safari, so may be buggy using newer features.</li>
</ul>
<h3>helpful code</h3>
<p>The global Javascript variable IS_APPLE_TV is helpful when displaying different content on the AppleTV, but try using the following function so you can perform a basic functionality test for iTunes and AppleTV within Safari:</p>
<pre name="code" class="javascript">
//after initialisation, TuneKit creates the window.iTunes object within Safari, which is why the IS_ATV variable is created on init and referenced later. You could just use this global variable instead of the isAppleTV() function if you wanted to
var IS_ATV = isAppleTV_init();
function isAppleTV_init() {
	//safari
	if(window.iTunes == undefined)
		return false;

	//itunes
	if(window.iTunes.platform == "Windows"
		|| window.iTunes.platform == "Mac"
		|| window.iTunes.platform == "Emulator")
		return false;

	return true;
}
function isAppleTV() {
	return IS_ATV;
}
</pre>
<p>Sometimes you need to manually control how the AppleTV remote keypresses will affect your project. The following code will allow you to override the default behaviour outlined by TuneKit:</p>
<pre name="code" class="javascript">
var KEY_BACK = 8;
var KEY_ENTER = 13;
var KEY_LEFT = 37;
var KEY_UP = 38;
var KEY_RIGHT = 39;
var KEY_DOWN = 40;

function onKeyDown() {
	if(event.keyCode == KEY_BACK) {
		//your action
	} else if(event.keyCode == KEY_ENTER) {
		//your action
	} else if(event.keyCode == KEY_DOWN) {
		//your action
	} else if(event.keyCode == KEY_LEFT) {
		//your action
	} else if(event.keyCode == KEY_RIGHT) {
		//your action
	} else if(event.keyCode == KEY_UP) {
		//your action
	}

	//prevent default behaviour
	event.stopPropagation();
	event.preventDefault();
}

//assign key down listener
function onKeyDown_init() {
	window.addEventListener("keydown", onKeyDown, true);
}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://pixelbyter.co.uk/2010/01/25/developing-itunes-lpsitunes-extras-for-the-appletv/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>iTunes LP/Extras Javascript redirects</title>
		<link>http://pixelbyter.co.uk/2010/01/21/itunes-lpextras-javascript-redirects/</link>
		<comments>http://pixelbyter.co.uk/2010/01/21/itunes-lpextras-javascript-redirects/#comments</comments>
		<pubDate>Thu, 21 Jan 2010 14:48:10 +0000</pubDate>
		<dc:creator>pixelbyter</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[iTunes Extras]]></category>
		<category><![CDATA[iTunes LP]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[source code]]></category>

		<guid isPermaLink="false">http://pixelbyter.local/?p=21</guid>
		<description><![CDATA[For iTunes LP and iTunes Extras content programatically loading a link is very difficult. Both iTunes and AppleTV don&#8217;t support the Javascript function windows.open() or the property window.location. I&#8217;ve managed to come up with this bypass (aka hack) which is demonstrated in the Javascript code below. It triggers a mouse click event emulating the user [...]]]></description>
			<content:encoded><![CDATA[<p>For iTunes LP and iTunes Extras content programatically loading a link is very difficult. Both iTunes and AppleTV don&#8217;t support the Javascript function windows.open() or the property window.location. I&#8217;ve managed to come up with this bypass (aka hack) which is demonstrated in the <strong>Javascript</strong> code below. It triggers a mouse click event emulating the user manually clicking a link on the page.</p>
<pre name="code" class="javascript">
//click a link with id 'my_link'
clickLink(document.getElementById('my_link'));

function clickLink(elementId) {
	var elm = document.getElementById(elementId);

	//set up mouse click event
	var evt = document.createEvent('MouseEvents');
	evt.initMouseEvent('click', true, true, document.defaultView, 1, 0, 0, 0, 0, false, false, false, false, 0,  null);

	//trigger click event on html element
	elm.dispatchEvent(evt);
}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://pixelbyter.co.uk/2010/01/21/itunes-lpextras-javascript-redirects/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

