Difference between revisions of "AirTunes/AirPlay"

From MythTV Official Wiki
Jump to: navigation, search
(Clarified AirPlay / iOS / iTunes relationships in several places)
(19 intermediate revisions by 8 users not shown)
Line 1: Line 1:
MythTV 0.25 added support for '''AirTunes''' and '''AirPlay''' for streaming audio and video from iOS devices to MythFrontend.
+
MythTV 0.25 added support for '''AirTunes''' and '''AirPlay''' for streaming audio and video from Apple iTunes & iOS devices to MythFrontend.
  
 
{{Note box|Please note - ''AirPlay'' (and MythTV in general) do not support DRM encrypted videos such as those purchased via the Apple Store. Playback of such content will fail.}}
 
{{Note box|Please note - ''AirPlay'' (and MythTV in general) do not support DRM encrypted videos such as those purchased via the Apple Store. Playback of such content will fail.}}
Line 10: Line 10:
 
   RAOP Conn: Failed to read key from: /home/<user>/.mythtv/RAOPKey.rsa
 
   RAOP Conn: Failed to read key from: /home/<user>/.mythtv/RAOPKey.rsa
  
You can obtain the key from this post at the [http://mailman.videolan.org/pipermail/vlc-devel/2011-April/079616.html vlc-devel mailing list] or from google's [http://webcache.googleusercontent.com/search?q=cache:6wePewHW9s0J:mailman.videolan.org/pipermail/vlc-devel/2011-April/079616.html+&cd=1&hl=en&ct=clnk cache].
+
You can obtain the key from the [https://raw.github.com/juhovh/shairplay/master/airport.key shairplay source].
  
 
Simply copy the entire section:-
 
Simply copy the entire section:-
Line 20: Line 20:
 
Paste into a new file at ''/home/<user>/.mythtv/RAOPKey.rsa'' and restart your frontend.
 
Paste into a new file at ''/home/<user>/.mythtv/RAOPKey.rsa'' and restart your frontend.
  
The correct RAOPKey.rsa file will have the [http://en.wikipedia.org/wiki/SHA-1 SHA-1] sum <code>35a168eaecec4d3c31424bba54de5ca0a058c24a</code>.  You can check this with the command
+
The correct RSA private key will have the [http://en.wikipedia.org/wiki/SHA-1 SHA-1] sum <code>7a07afcdf4cbb5653318a329906afe5367cb8b13</code>.  You can check this with the command
  
   ''shell> ''shasum ~/.mythtv/RAOPKey.rsa
+
   ''shell> ''openssl rsa -in ~/.mythtv/RAOPKey.rsa -outform der | sha1sum
 +
 
 +
Or, on shells missing sha1sum, like OS X:
 +
 
 +
  ''shell> ''openssl rsa -in ~/.mythtv/RAOPKey.rsa -outform der | openssl sha1
 +
 
 +
== Enabling AirPlay (video support) in MythTV 0.25 and Above==
 +
This section only applies to 0.25
  
== Enabling AirPlay (video support) ==
 
 
AirPlay support is disabled by default, you have to manually enable it at the command line.
 
AirPlay support is disabled by default, you have to manually enable it at the command line.
  
==== Enabling In All Operating Systems ====
+
=== Enabling In All Operating Systems ===
 +
 
 +
In 0.25:
  
 
Set the environment variable named MYTHTV_AIRPLAY before starting the frontend from the command line, for example:-
 
Set the environment variable named MYTHTV_AIRPLAY before starting the frontend from the command line, for example:-
Line 36: Line 44:
 
where ''shell>'' denotes the command-line prompt, not something you type.
 
where ''shell>'' denotes the command-line prompt, not something you type.
  
==== Permanently Enabling in OSX Finder ====
+
In 0.26 and above, use the frontend GUI,
 +
 
 +
Setup -> General -> AirPlay Settings
 +
 
 +
=== Permanently Enabling in Ubuntu 10.04 and later (0.25 only) ===
 +
Add this line in [http://manpages.ubuntu.com/manpages/hardy/man5/pam_env.conf.5.html ~/.pam_environment]
 +
 
 +
MYTHTV_AIRPLAY DEFAULT="1"
 +
 
 +
Re-login to load the environment variable.
 +
 
 +
=== Permanently Enabling in OSX Finder ===
  
 
If you want it enabled for starting '''MythFrontend''' from the Finder, run
 
If you want it enabled for starting '''MythFrontend''' from the Finder, run
Line 45: Line 64:
  
 
  ''shell> ''echo setenv MYTHTV_AIRPLAY 1 >> ~/.launchd.conf
 
  ''shell> ''echo setenv MYTHTV_AIRPLAY 1 >> ~/.launchd.conf
 +
 +
==In iTunes or on your iOS device==
 +
 +
From http://support.apple.com/kb/HT4437
 +
 +
Enable AirPlay from your iPhone (4S or 5) or iPad directly from the recently used apps section in iOS:
 +
 +
Connect your iPhone or iPad and your Apple TV to the same Wi-Fi network.
 +
On your iPhone or iPad, double-click the Home Button to display your recently used apps.
 +
Swipe your recently used apps twice from left to right until you see the  icon.
 +
 +
[[File:AirPlay_icon.png|AirPlay mirroring icon]]
 +
 +
Tap the icon to display a list of available AirPlay devices.
 +
 +
AirPlay Mirroring is not supported.
 +
 +
 +
If the AirPlay icon is not appearing in your app tray, it may appear inside supporting applications.  YouTube, Pandora, etc will show the AirPlay icon within the app if a supported target device (MythTV in this case) is detected on the network.
 +
 +
 +
In iTunes, AirPlay is enabled by the same icon, which should appear in the lower right corner of the window.   
 +
 +
  
 
== Troubleshooting Notes ==
 
== Troubleshooting Notes ==
  
==== Not seeing AirPlay device ====
+
=== Can't Start / Nothing in frontend logs ===
 +
If you are having trouble getting started, and have tried setting the environment variable (0.25) to no effect, and/or the AirPlay page is not showing up in the frontend settings (0.26), and/or Bonjour information isn't showing up in your frontend console output, it is possible that AirPlay support wasn't enabled when your build of MythTV was compiled.
 +
 
 +
Of particular note is a peculiarity for Gentoo users:  'avahi' [http://en.wikipedia.org/wiki/Avahi_%28software%29][http://en.gentoo-wiki.com/wiki/Avahi] is a required dependency, yet the current MythTV ebuilds ignore both the 'airplay' and 'avahi' USE flags.  Instead, the 'raop' USE flag must be set to enable AirPlay support. 
 +
 
 +
 
 +
=== Not seeing AirPlay device in iTunes or iOS device ===
 +
 
 +
Make sure your firewall isn't blocking Bonjour request.
 +
Bonjour uses port 5353 for UDP.
 +
For Windows XP SP2 and later, check http://support.apple.com/kb/ts2235
 +
 
  
If you are not seeing the AirPlay device on your iPhone/iPad, make sure the avahi daemons is running (Linux/FreeBSD only)
+
On Linux/FreeBSD, make sure the avahi daemons is running.
 +
On Windows, that the mDNS service is running
  
 
A message like the following in your logs would show, you can then lookup the error code below
 
A message like the following in your logs would show, you can then lookup the error code below
  
RAOPDevice bonjourregister.cpp:56 (Register) - Bonjour: Error: -65563
+
RAOPDevice bonjourregister.cpp:56 (Register) - Bonjour: Error: -65563
  
 
(taken from the freely available mDNSResponder source code)
 
(taken from the freely available mDNSResponder source code)
Line 89: Line 144:
 
     kDNSServiceErr_Timeout                  = -65568
 
     kDNSServiceErr_Timeout                  = -65568
  
==== Audio glitched in OS X ====
+
=== Audio glitched in OS X ===
  
 
When using MythFrontend on OSX, you may not experience perfect audio playback, this issue is linked to a bug with IPv6 in the Qt software framework used by myth ([http://bugreports.qt-project.org/browse/QTBUG-25634 Bug 25634])
 
When using MythFrontend on OSX, you may not experience perfect audio playback, this issue is linked to a bug with IPv6 in the Qt software framework used by myth ([http://bugreports.qt-project.org/browse/QTBUG-25634 Bug 25634])
  
==== Seeking on some streaming content hang the frontend ====
+
=== Seeking on some streaming content hang the frontend ===
  
 
When seeking on some online content, such as when using the YouTube application, may result in the frontend showing "Searching..." and become non-responsive.
 
When seeking on some online content, such as when using the YouTube application, may result in the frontend showing "Searching..." and become non-responsive.
 
You can usually interrupt it by stopping playback on the iPhone and restarting it.
 
You can usually interrupt it by stopping playback on the iPhone and restarting it.

Revision as of 23:50, 5 February 2013

MythTV 0.25 added support for AirTunes and AirPlay for streaming audio and video from Apple iTunes & iOS devices to MythFrontend.


Important.png Note: Please note - AirPlay (and MythTV in general) do not support DRM encrypted videos such as those purchased via the Apple Store. Playback of such content will fail.

Enabling AirTunes

AirTunes does not work out the box because AirTunes is a proprietary format and is encrypted in order to enable vendor lock-in. Fortunately the encryption key has been discovered which enables use of AirTunes in open source applications such as MythTV.

When starting the frontend, you will get the following message in the log:

 RAOP Conn: Failed to read key from: /home/<user>/.mythtv/RAOPKey.rsa

You can obtain the key from the shairplay source.

Simply copy the entire section:-

 -----BEGIN RSA PRIVATE KEY-----
 (and everything inbetween)
 -----END RSA PRIVATE KEY-----

Paste into a new file at /home/<user>/.mythtv/RAOPKey.rsa and restart your frontend.

The correct RSA private key will have the SHA-1 sum 7a07afcdf4cbb5653318a329906afe5367cb8b13. You can check this with the command

 shell> openssl rsa -in ~/.mythtv/RAOPKey.rsa -outform der | sha1sum

Or, on shells missing sha1sum, like OS X:

 shell> openssl rsa -in ~/.mythtv/RAOPKey.rsa -outform der | openssl sha1

Enabling AirPlay (video support) in MythTV 0.25 and Above

This section only applies to 0.25

AirPlay support is disabled by default, you have to manually enable it at the command line.

Enabling In All Operating Systems

In 0.25:

Set the environment variable named MYTHTV_AIRPLAY before starting the frontend from the command line, for example:-

shell> export MYTHTV_AIRPLAY="1"
shell> mythfrontend

where shell> denotes the command-line prompt, not something you type.

In 0.26 and above, use the frontend GUI,

Setup -> General -> AirPlay Settings

Permanently Enabling in Ubuntu 10.04 and later (0.25 only)

Add this line in ~/.pam_environment

MYTHTV_AIRPLAY DEFAULT="1"

Re-login to load the environment variable.

Permanently Enabling in OSX Finder

If you want it enabled for starting MythFrontend from the Finder, run

shell> echo setenv MYTHTV_AIRPLAY 1 | launchctl

and if you want it enabled this way permanently then run

shell> echo setenv MYTHTV_AIRPLAY 1 >> ~/.launchd.conf

In iTunes or on your iOS device

From http://support.apple.com/kb/HT4437

Enable AirPlay from your iPhone (4S or 5) or iPad directly from the recently used apps section in iOS:

Connect your iPhone or iPad and your Apple TV to the same Wi-Fi network. On your iPhone or iPad, double-click the Home Button to display your recently used apps. Swipe your recently used apps twice from left to right until you see the icon.

AirPlay mirroring icon

Tap the icon to display a list of available AirPlay devices.

AirPlay Mirroring is not supported.


If the AirPlay icon is not appearing in your app tray, it may appear inside supporting applications. YouTube, Pandora, etc will show the AirPlay icon within the app if a supported target device (MythTV in this case) is detected on the network.


In iTunes, AirPlay is enabled by the same icon, which should appear in the lower right corner of the window.


Troubleshooting Notes

Can't Start / Nothing in frontend logs

If you are having trouble getting started, and have tried setting the environment variable (0.25) to no effect, and/or the AirPlay page is not showing up in the frontend settings (0.26), and/or Bonjour information isn't showing up in your frontend console output, it is possible that AirPlay support wasn't enabled when your build of MythTV was compiled.

Of particular note is a peculiarity for Gentoo users: 'avahi' [1][2] is a required dependency, yet the current MythTV ebuilds ignore both the 'airplay' and 'avahi' USE flags. Instead, the 'raop' USE flag must be set to enable AirPlay support.


Not seeing AirPlay device in iTunes or iOS device

Make sure your firewall isn't blocking Bonjour request. Bonjour uses port 5353 for UDP. For Windows XP SP2 and later, check http://support.apple.com/kb/ts2235


On Linux/FreeBSD, make sure the avahi daemons is running. On Windows, that the mDNS service is running

A message like the following in your logs would show, you can then lookup the error code below

RAOPDevice bonjourregister.cpp:56 (Register) - Bonjour: Error: -65563

(taken from the freely available mDNSResponder source code)

   kDNSServiceErr_Unknown                   = -65537,  /* 0xFFFE FFFF */
   kDNSServiceErr_NoSuchName                = -65538,
   kDNSServiceErr_NoMemory                  = -65539,
   kDNSServiceErr_BadParam                  = -65540,
   kDNSServiceErr_BadReference              = -65541,
   kDNSServiceErr_BadState                  = -65542,
   kDNSServiceErr_BadFlags                  = -65543,
   kDNSServiceErr_Unsupported               = -65544,
   kDNSServiceErr_NotInitialized            = -65545,
   kDNSServiceErr_AlreadyRegistered         = -65547,
   kDNSServiceErr_NameConflict              = -65548,
   kDNSServiceErr_Invalid                   = -65549,
   kDNSServiceErr_Firewall                  = -65550,
   kDNSServiceErr_Incompatible              = -65551,  /* client library incompatible with daemon */
   kDNSServiceErr_BadInterfaceIndex         = -65552,
   kDNSServiceErr_Refused                   = -65553,
   kDNSServiceErr_NoSuchRecord              = -65554,
   kDNSServiceErr_NoAuth                    = -65555,
   kDNSServiceErr_NoSuchKey                 = -65556,
   kDNSServiceErr_NATTraversal              = -65557,
   kDNSServiceErr_DoubleNAT                 = -65558,
   kDNSServiceErr_BadTime                   = -65559,  /* Codes up to here existed in Tiger */
   kDNSServiceErr_BadSig                    = -65560,
   kDNSServiceErr_BadKey                    = -65561,
   kDNSServiceErr_Transient                 = -65562,
   kDNSServiceErr_ServiceNotRunning         = -65563,  /* Background daemon not running */
   kDNSServiceErr_NATPortMappingUnsupported = -65564,  /* NAT doesn't support NAT-PMP or UPnP */
   kDNSServiceErr_NATPortMappingDisabled    = -65565,  /* NAT supports NAT-PMP or UPnP but it's disabled by the administrator */
   kDNSServiceErr_NoRouter                  = -65566,  /* No router currently configured (probably no network connectivity) */
   kDNSServiceErr_PollingMode               = -65567,
   kDNSServiceErr_Timeout                   = -65568

Audio glitched in OS X

When using MythFrontend on OSX, you may not experience perfect audio playback, this issue is linked to a bug with IPv6 in the Qt software framework used by myth (Bug 25634)

Seeking on some streaming content hang the frontend

When seeking on some online content, such as when using the YouTube application, may result in the frontend showing "Searching..." and become non-responsive. You can usually interrupt it by stopping playback on the iPhone and restarting it.