AirPlay and how does it work?

AirPlay is the Apple way for sharing media between your Apple devices. You can share music, photos and videos from an iPhone, iPad, or Mac to an Apple TV and it is also possible to share music to an Airport Express with attached speakers. Apple has licensed the audio streaming part of the AirPlay protocol to different manufacturers so third party devices can be used to receive AirPlay streams.

Beside the possibility to stream content from an IOS or OSX device it is also possible to use the AirPlay mirroring function. With this function you can use a tv as a second screen. Because the mirroring image feed is encoded using the H.264 codec more recent hardware is required. This more recent hardware uses the graphic card for the encoding process. The following devices (and newer) can be used:

  • iPad 2
  • iPad mini
  • iPhone 4S
  • iPod touch
  • iMac, Mac mini, Macbook Air (mid 2011) + (Mountain Lion)
  • MacBook Pro (early 2011) + (Mountain Lion)
  • Apple TV (2nd or 3rd generation)

AirPlay mirroring does also require a fast and stable Wi-Fi connection, I would suggest using the 802.11n standard on 5GHz. This gives the most stable experience, especially in crowded Wi-Fi environments.

AirPlay discovers other devices with the Bonjour protocol. Because of this no extra configuration in the network is needed. When your are using a company network and the amount of apple devices grows you should think about the fact that Bonjour is a chatty protocol. Some companies that are using large numbers of Apple devices have seen a peak in multicast traffic after introducing IOS and OSX devices. To solve this problem you could use different SSID’s / different subnets for de IOS and OSX devices. The details of the AirPlay protocol are not officially made public by Apple but with reverse engineering people have discovered the details and published them unofficially. You can find this information on

http://nto.github.io/AirPlay.html

In the following part you will find a bandwidth usage tests for AirPlay mirroring. I have used the following test scenario:

Devices:

  • MacBook Pro 13 inch, late 2011, i5 2.4 GHz, 4GB memory.
  • Apple TV, 3th generation.
  • Apple Airport Extreme, 5th generation.

Network:

  • 802.11n 2,4GHz network

Tests:

  • Mirroring desktop, MacBook Pro –> Apple TV
  • Mirroring video, MacBook Pro –> Apple TV

(The test is conducted with a 720p video file)

Results:

Mirroring the desktop from the MacBook Pro to the Apple TV uses between 350KB/s and 1,3 MB/s and this delivered a good result. When playing a video on the MacBook Pro the usage varies between 1,5MB/s and peaks of 3,6MB/s. Normally the bandwidth should be sufficient to deliver a smooth video playback. In reality I experienced some hiccups. It is possible that the Wi-Fi network has a problem with some interference and cannot deliver a stable connection. Normally you would not notice this but because the mirroring feed cannot be buffered, every hiccup will be visible. When you are experiencing these problems you should try another channel for your Wi-Fi network or switch to the 5GHz band. I have switched to the 5GHz network and didn’t had any more hiccups in the playback.

In practice an 802.11g network will be sufficient for AirPlay streaming but you will see buffering problems when using AirPlay mirroring. When using an 802.11n 5GHz network you normally should be good. I hope I have given you some interesting and helpful facts about the Airplay protocol.

Advertisement

Sysprep techniques for OS X machines

It is possible to deploy OS X with different tools, for larger over the network deployments it is preferable to use DeployStudio or Apple’s NetInstall software. DeployStudio is the most preferable option because you have a truckload of customization option. In a future blogpost I want to discuss these options. For now I want to look at some OS X sysprep techniques you can use for small scale sneakernet deployments.

The first thing you want to do is choosing an OS X machine that will function as image builder. Keep in mind when you choose your hardware you cannot deploy the created image on a newer generation of hardware. So when you have an image build on a 2009 iMac you cannot use this image on a 2012 iMac. This will most likely not work at all and if the system boots it will be unstable or you cannot use some features. In contrary, if you use an 2012 iMac for building the image you will be able to deploy this image on 2009 iMacs.

When you have chosen a machine you make a clean OS X installation. After the installation you apply updates and install all software you want to include in the image. When you are ready to create the image there are some sysprep techniques that can be used.

The first technique is not really a sysprep one but this can still be very useful!

Making an hidden admin account:

sudo defaults write /Library/Preferences/com.apple.loginwindow HiddenUsersList -array-add %user%

Before applying the command you need the create the admin account in OS X. With this command the user sees his own account at login where he only needs the enter his password. Next to the users account a separate login window is displayed where both the username and password needs to be entered.

Reactivate the startup wizard at reboot:

sudo rm -rf /var/db/.AppleSetupDone

With this command the first time wizard will reappear after rebooting the machine. When you have deployed the image and the system is rebooted it will show the wizard where the user can enter his own password, information and settings.

Delete swapfiles: 

rm /private/var/vm/swapfile*

This says it all, it deletes the swapfile.

Clean up caches and temp data:

rm -rf /Library/Caches/*
rm -rf /System/Library/Caches/*
rm -rf /Users/Shared/*
rm -f /private/etc/ssh_host*

With these commands you clean-up the system caches and temporary data.

Clean up log files:

rm /private/var/log/%specifylog%
touch /private/var/log/%specifylog%

There are a lot of different log files in OS X. I will give you some examples:

  • /alf.log
  • /cups/access_log
  • /cups/error_log
  • /cups/page_log
  • /ftp.log*
  • /httpd/*
  • /lastlog
  • /mail.log*
  • /secure.log
  • /system.log*

It is important to use the touch command after each removal because syslog will not recreate a missing log on his own.

After you have used the above commands to create a clean image the system can be rebooted. You can now start from an external disk and use the disk utility to create an image from the system disk.