Difference between revisions of "AirTunes/AirPlay"

From MythTV Official Wiki
Jump to: navigation, search
(Created initial page for Airtunes and AirPlay to the best of my knowledge.)
 
(Troubleshooting: No iOS)
 
(45 intermediate revisions by 17 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 has limited support for '''AirPlay''' for streaming audio Apple iTunes to MythFrontend.  Previously, iOS devices (iPhone, iPad) were able to stream to MythFrontend as well but changes in recent versions of iOS now prevent this.
  
''AirPlay (video support) is experimental at this time.''
+
{{Note box|''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 ==
+
AirPlay was originally called "AirTunes" when it only supported streaming music.  MythTV support was added in version 0.25 and substantially enhanced in 0.27.
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.
+
 
 +
==Enabling AirPlay==
 +
AirPlay is a proprietary format and is encrypted...but the encryption key has been discovered which enables its use in open source applications such as MythTV.
  
 
When starting the frontend, you will get the following message in the log:
 
When starting the frontend, you will get the following message in the log:
Line 10: Line 12:
 
   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].
+
You can obtain the key from the [https://raw.github.com/juhovh/shairplay/master/airport.key shairplay source]. Copy the entire section:-
 
 
Simply copy the entire section:-
 
  
 
   -----BEGIN RSA PRIVATE KEY-----
 
   -----BEGIN RSA PRIVATE KEY-----
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.
  
== Enabling AirPlay (video support) ==
+
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
Because AirPlay support is experimental, you have to manually enable it at the command line.
+
 
 +
  ''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
 +
 
 +
==Using AirPlay==
 +
===iPhone or iPad===
 +
 
 +
[[File:AirPlay_icon.png|thumb|AirPlay icon]]
 +
 
 +
From http://support.apple.com/kb/HT4437
 +
 
 +
Connect your iPhone or iPad and your Apple TV [MythTV frontend, in our case] to the same Wi-Fi network.
 +
 
 +
iOS 7:  Swipe up from the bottom of the screen to show the Control Centre.  Tap the AirPlay icon and select from the available AirPlay devices.
 +
 
 +
iOS 6:  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.  Tap the icon to display a list of available AirPlay devices.
 +
 
 +
[[File:Myth0.25_Airplay_video.PNG|thumb|Example Airplay selection screen from iPhone 5 running iOS 6.]]
 +
 
 +
If the AirPlay icon does not appear in the Control Centre, 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.
 +
 
 +
===iTunes (Mac or Windows)===
 +
In iTunes, AirPlay is enabled by the same icon, which should appear in the lower right corner of the window.
 +
 
 +
===No mirroring===
 +
Note that AirPlay Mirroring is not supported.
 +
 
 +
==Troubleshooting==
 +
 
 +
=== iOS Airplay doesn't work ===
 +
 
 +
Apple made changes in recent versions of iOS that disable the hack the Myth has been using.  There is no known workaround.  Airplay from iTunes to MythFrontend continues to work at least with iTunes 12.6 on OS X.
 +
 
 +
=== Can't Start / Nothing in frontend logs ===
 +
 
 +
Ensure mythfrontend is listening on a network-connected interface, especially if you see initial startup logs that imply AirPlay is active, but you can't get any further. If you have a combined backend/frontend system, you may have a local IP address specified in mythtv-setup -> General (e.g. 127.0.0.1 for IPv4 and ::1 for IPv6), which means mythfrontend isn't listening on any interfaces that are reachable from your local network. Usually, this can be solved simply by checking the "Link-local" box on the same mythtv-setup page, which instructs MythTV to listen on IPv6 addresses that are reachable on your local network. However, this requires that you have IPv6 enabled: check that at least one network-connected interface has an IPv6 address (e.g. "ip -6 addr").
 +
 
 +
AirPlay may also work without IPv6 so long as mythfrontend is listening on a network-accessible interface (e.g. 192.168.0.2). This is unclear, though. You can try setting the IP addresses specified in mythtv-setup to a network-accessible one, or else leave those fields blank to allow MythTV to choose sensible defaults.
 +
 
 +
After changing IP addresses, a restart of both the backend and frontend is required.
 +
 
 +
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 ===
 +
 
 +
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 ([http://bugreports.qt-project.org/browse/QTBUG-25634 Bug 25634])
 +
 
 +
=== Seeking on some streaming content hang the frontend ===
  
Set the environment variable named MYTHTV_AIRPLAY before starting the frontend, for example:-
+
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.
  
  export MYTHTV_AIRPLAY="1"
 
  mythfrontend
 
  
''I have documented this, but AirPlay did not work for me.  The AirPlay option for the frontend was available, but the video streaming failed.  This was using an iPad2.  Music streaming worked, but was occasionally choppy''
+
[[category:HOWTO]]
[[User:Danellisuk|Danellisuk]]
 

Latest revision as of 01:47, 31 January 2018

MythTV has limited support for AirPlay for streaming audio Apple iTunes to MythFrontend. Previously, iOS devices (iPhone, iPad) were able to stream to MythFrontend as well but changes in recent versions of iOS now prevent this.


Important.png 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.

AirPlay was originally called "AirTunes" when it only supported streaming music. MythTV support was added in version 0.25 and substantially enhanced in 0.27.

Enabling AirPlay

AirPlay is a proprietary format and is encrypted...but the encryption key has been discovered which enables its use 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. 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

Using AirPlay

iPhone or iPad

AirPlay icon

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

Connect your iPhone or iPad and your Apple TV [MythTV frontend, in our case] to the same Wi-Fi network.

iOS 7: Swipe up from the bottom of the screen to show the Control Centre. Tap the AirPlay icon and select from the available AirPlay devices.

iOS 6: 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. Tap the icon to display a list of available AirPlay devices.

Example Airplay selection screen from iPhone 5 running iOS 6.

If the AirPlay icon does not appear in the Control Centre, 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.

iTunes (Mac or Windows)

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

No mirroring

Note that AirPlay Mirroring is not supported.

Troubleshooting

iOS Airplay doesn't work

Apple made changes in recent versions of iOS that disable the hack the Myth has been using. There is no known workaround. Airplay from iTunes to MythFrontend continues to work at least with iTunes 12.6 on OS X.

Can't Start / Nothing in frontend logs

Ensure mythfrontend is listening on a network-connected interface, especially if you see initial startup logs that imply AirPlay is active, but you can't get any further. If you have a combined backend/frontend system, you may have a local IP address specified in mythtv-setup -> General (e.g. 127.0.0.1 for IPv4 and ::1 for IPv6), which means mythfrontend isn't listening on any interfaces that are reachable from your local network. Usually, this can be solved simply by checking the "Link-local" box on the same mythtv-setup page, which instructs MythTV to listen on IPv6 addresses that are reachable on your local network. However, this requires that you have IPv6 enabled: check that at least one network-connected interface has an IPv6 address (e.g. "ip -6 addr").

AirPlay may also work without IPv6 so long as mythfrontend is listening on a network-accessible interface (e.g. 192.168.0.2). This is unclear, though. You can try setting the IP addresses specified in mythtv-setup to a network-accessible one, or else leave those fields blank to allow MythTV to choose sensible defaults.

After changing IP addresses, a restart of both the backend and frontend is required.

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

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.