[HN Gopher] An open-source AirPlay mirroring server for the Rasp...
       ___________________________________________________________________
        
       An open-source AirPlay mirroring server for the Raspberry Pi
        
       Author : chetangoti
       Score  : 204 points
       Date   : 2021-02-04 10:45 UTC (12 hours ago)
        
 (HTM) web link (github.com)
 (TXT) w3m dump (github.com)
        
       | spiderfarmer wrote:
       | > By using OpenSSL for AES decryption, I was able to speed up the
       | decryption of video packets from up to 0.2 seconds to up to 0.007
       | seconds for large packets (On the Pi Zero). Average is now more
       | like 0.002 seconds.
       | 
       | This is cool.
        
       | toxik wrote:
       | Apple and friends should be _required_ to document their
       | protocols. It would improve competition and benefit everyone in
       | the long run.
        
         | tinus_hn wrote:
         | They'd just block third party implementations using patents.
        
         | meibo wrote:
         | Absolutely. Some smart person at my local school district
         | decided that all rooms be fitted with Apple TVs(a great budget
         | decision, especially since they're used exclusively as cast
         | targets and have no accounts), which now only about 30% of
         | students and about 70% of teachers can use because you need
         | Apple clients to use them. This is in Europe, so Android has a
         | relatively large userbase, especially for students.
         | 
         | The same smart person worked out a great deal during Covid that
         | lets "disadvantaged" families buy an iPad for only 500EUR so
         | they can participate in online schooling.
        
           | mensetmanusman wrote:
           | That is insane.
           | 
           | I love my iPad and have used them in research for over 10
           | years. But I also have kids. It should be illegal to purchase
           | glass tablets for education.
           | 
           | If Apple wants the education business, they should release a
           | plastic touch screen version with a plastic backing (kids
           | throw things, they can cut people in fights).
           | 
           | It's sad when wealthy parents with too much time on their
           | hands join these decision making committees and end up
           | fighting for large corporations; and in this case, hurting
           | the poor.
        
           | wlesieutre wrote:
           | I don't know what country specifically or how iPads are
           | priced there, but just picking Germany at random the iPad's
           | list price starts at 379EUR. Quite a deal they've got
           | going...
        
             | laurent92 wrote:
             | PCs with a javascript console, GCC and Word-Excel (if not
             | LibreOffice or just a browser) also start at 350EUR.
             | 
             | It's for pupils. People who will _make_ tomorrow's world.
             | We don't want to give them a read-only world.
        
               | djrogers wrote:
               | > We don't want to give them a read-only world
               | 
               | One pan make many valid arguments about iPads vs PCs, and
               | open vs walled gardens, but calling an iPad a 'read-only'
               | device is NOT one of them.
               | 
               | My brilliant 12 year old daughter is an artist (both 2
               | and 3d, depending on her whims), and uses an iPad as a
               | creative device that literally has no peer from other,
               | more open ecosystems.
               | 
               | My 14 year old son learned the basics of coding on an
               | iPad, and can use his for writing, math homework, and an
               | incredible level of creative output programming various
               | robotics devices he has.
               | 
               | An iPad does live in a walled garden, but it is far from
               | a read-only device.
        
               | chanmad29 wrote:
               | Tangent: Do you see any downsides of your kids using this
               | technology vs writing/painting on paper?
        
               | djrogers wrote:
               | No, I really don't. The kinda of things my daughter does
               | on an iPad aren't possible on paper, and use a part of
               | her brain that she doesn't trigger when she uses pen or
               | paint and paper. Also, she does both.
        
               | drewzero1 wrote:
               | Can you recommend any creation apps? I'm trying to make
               | my iPad more useful to me than the browser and video
               | watching device it currently is, but have had a hard time
               | finding good apps for art and coding.
        
               | djrogers wrote:
               | There are literally hundreds of great art apps - it
               | really depends what you're in to. Procreate is perhaps
               | the most popular, but there are options for animation and
               | 3d art as well. Like any area of software, different
               | tools fit different uses.
        
               | handedness wrote:
               | Setting aside the very necessary questions around the
               | pros and cons of ed tech, from a strictly IT-management
               | standpoint the support costs for iPads will be vastly
               | lower than for PCs, especially a 350EUR PC.
               | 
               | (Assuming they're well-insured and/or the children don't
               | abuse them, etc.)
        
               | noizejoy wrote:
               | Why not use iPad plus Raspberry Pi? - the combination
               | would seem to cover a very wide spectrum of computing and
               | learning.
        
         | nr2x wrote:
         | 100% agree, an elegant solution to anti-trust would be
         | prohibition on exclusive API access for any add-on products
         | (watch, airplay, etc). I'm not that worried about the AppStore
         | as an end-user as I like knowing I'm not downloading malware,
         | that they are enforcing strong privacy requirements etc, but if
         | I want to buy a non-Apple watch it should have complete
         | compatibility with Apple Fitness, otherwise there's zero room
         | for an honest case to be made that there isn't an abuse of
         | dominance in one area (iOS/iPhone) to create dominance in
         | another (wearables).
        
           | zepto wrote:
           | In this situation, as soon as Apple makes changes to any of
           | their protocols, that would also be seen as anti-competitive
           | behavior.
           | 
           | How would you propose to deal with API changes?
        
             | nr2x wrote:
             | Like any other API they already make public for iOS/macOS:
             | clear communication and deprecation timelines.
        
               | zepto wrote:
               | It's worth noting that newly introduced Apple
               | technologies are notoriously poorly documented. See
               | SwiftUI as an example. Half of the api surface was
               | undocumented at release. Surely that would give them a
               | competitive advantage.
               | 
               | As for deprecation - why wouldn't they deprecate as soon
               | as they have a software update for their own supported
               | devices?
        
               | Mindwipe wrote:
               | Tbf AirPlay has been badly documented for more than a
               | decade, it's not just recently!
        
               | zepto wrote:
               | Exactly - so 'documentation as usual' can't really be the
               | solution.
        
         | swiftcoder wrote:
         | Even just legislation to safeguard adversarial interoperability
         | would be a big help, so that companies like Apple can't wield
         | DRM laws to shut down reverse engineering.
        
           | laurent92 wrote:
           | I'm all for "protocols should mandatorily be free" but then,
           | how does Apple "guarantees authenticity" of the opposite
           | device, to ensure it doesn't brick it or gets bricked by it?
           | I'm half serious, it's always the excuse used for applying
           | DRM to any device (even the famous orange juice presser,
           | Juicero, now bankrupt, which only works with DRM'ed oranges,
           | to ensure it doesn't intoxicate the consumer), so should law
           | also mandate that a device producer who doesn't respect the
           | specs is liable for the bricked iPhone?
        
             | Wowfunhappy wrote:
             | If an improper Airplay implementation could brick an
             | iPhone, what's to say a hacker couldn't do the same
             | (whether or not you've opened up the protocol, because
             | anything can be hacked)? Or even just a network screwup, or
             | a random bitflip.
             | 
             | Which is to say, airplay shouldn't be capable of bricking
             | an iPhone, and if it can, that's a critical issue which
             | needs to be fixed.
        
         | Aaargh20318 wrote:
         | Documenting the protocols would do little. You could have a
         | completely documented protocol, as long as it requires some
         | form of secret access key they won't tell you there would be
         | little you could do with it.
        
           | acct776 wrote:
           | That just takes a crowd, and time
        
             | laurent92 wrote:
             | Sure the DVD and HDMi encryption keys are now public, but I
             | doubt a long-enough encryption key will necessarily be
             | cracked.
        
               | tinus_hn wrote:
               | Any key that is in large amounts of consumer devices will
               | be cracked.
        
               | Mindwipe wrote:
               | Maybe, but it will also get revoked by the provider and
               | not be very useful any more
               | 
               | There are lots of compromised Widevine Level 1 keys out
               | there, but Widevine license servers no longer accept
               | them.
        
               | tinus_hn wrote:
               | If the key is in hardware is isn't quite that easy to
               | revoke, and if it is in software it isn't quite that
               | difficult to crack.
        
           | lxgr wrote:
           | Does AirPlay require mandatory DRM? If not, I don't see why
           | the base protocol couldn't be open, with DRM as a proprietary
           | extension.
        
             | Mindwipe wrote:
             | There are several AirPlay's. Some do, some have optional
             | DRM, some just rely on device keys (some of which were
             | reverse engineered years ago).
             | 
             | AirPlay is not a very useful term at this point tbh, but
             | the Apple documentation on the differences is also garbage.
        
       | ho_schi wrote:
       | I've just poked into some source files and decided to compile it
       | on Archlinux with GNOME and Avahi. It seem to work in general :)
        
       | adav wrote:
       | This maybe an odd workaround but I've found the Airplay support
       | in Zoom screen share to work quite well. Not good enough for
       | video, but very reliable for showing the screen of an iPhone or
       | Mac.
        
       | darkwater wrote:
       | So, with this you can stream from your iDevice using AirPlay to a
       | Raspberry connected to, say, a TV? Is this correct?
        
         | jseven wrote:
         | correct
        
       | freewizard wrote:
       | Thanks for sharing.
       | 
       | There was an Airplay 2 implementation existed for not very long.
       | Hopefully this one will stay.
       | 
       | Looking forward to more open source projects supporting AirPlay
       | 2.
        
         | bluesign wrote:
         | I think this one is using the legacy protocol
        
           | read_if_gay_ wrote:
           | What is the difference between the two?
        
             | mjlee wrote:
             | Airplay 2 adds multi-room streaming, and a nifty shared up-
             | next playlist that multiple users can add to.
        
             | [deleted]
        
             | danpalmer wrote:
             | In addition to the features given by others, I believe
             | AirPlay 2 significantly re-worked the way timing and sync
             | works.
             | 
             | Previously I believe AirPlay (1) had a fixed 2 second
             | delay, which was not a great UX and also caused issues in
             | syncing multi-room (or multi-output) audio.
             | 
             | AirPlay 2 does this in a much more dynamic way that reduces
             | the latency (anecdotally, maybe 100-200ms is typical) and
             | improves the sync. I have no idea how it achieves this
             | though.
        
               | anamexis wrote:
               | I believe AirPlay 1 could not do multi-room audio at all.
               | 
               | Edit: OP actually has a really nice breakdown.
               | https://github.com/FD-/RPiPlay#airplay-protocol-versions
        
               | funcDropShadow wrote:
               | AirTunes already had multi-room support. It might have
               | been technically different. But you could select to
               | mulitple AirPort Express at once and they would play the
               | audio synchronized.
        
             | pbronez wrote:
             | From [0]:
             | 
             | > Airplay doesn't offer multi-room audio; AirPlay 2 does
             | 
             | > AirPlay lets you stream from any Apple device to your
             | speakers or TV
             | 
             | > AirPlay 2 lets you play from speakers over Wi-Fi, and
             | it'll stay in sync
             | 
             | > AirPlay 2 lets play different songs in different rooms
             | with multiple HomePods
             | 
             | Personally I've been very happy using AirPlay 2 with recent
             | iPhones, a collection of HomePod Minis, an AppleTV and
             | Denon Receiver. It makes it pretty easy to set up complex
             | audio routing configurations from your phone. You can send
             | a stream to several devices simultaneously while
             | controlling volume independently and as a group. You can
             | see what's playing on each device. Audio quality is good,
             | battery impact seems fine.
             | 
             | I wish I could have strong AirPlay 2 support from non-Apple
             | devices, but I know how the ecosystem works. Still, easy
             | enough to use something like the Emby iOS app [1] to bridge
             | arbitrary content into the system.
             | 
             | [0] https://www.pocket-
             | lint.com/speakers/news/apple/144646-apple...
             | 
             | [1] https://apps.apple.com/us/app/emby/id992180193
        
               | funcDropShadow wrote:
               | > Airplay doesn't offer multi-room audio; AirPlay 2 does
               | 
               | That seems strange. Because I remember buying several
               | used Airport Express base station to build a multi-room
               | audio system. It worked great. That was around 2006/7, if
               | my memory serves me right. At that time the protocol and
               | the feature was called AirTunes.
        
               | 3JPLW wrote:
               | Yeah, you (used to?) be able to do multi-room audio with
               | the original Airplay, but it was only supported from
               | Macs. iOS did not support it.
        
       | sp1rit wrote:
       | Out of interest, is there also a AirPlay display sink client for
       | Linux? I'm still looking for a way to share my screen of my Linux
       | laptop to an Apple TV / stuff like this.
        
         | coolspot wrote:
         | There is open-airplay[777] doing that.
         | 
         | [777] - https://github.com/openairplay/open-airplay
        
       | Thrymr wrote:
       | Nice to see this! Hoping it can be ported to Kodi soon (which has
       | AirPlay support but is limited to audio only for recent iOS
       | versions, see https://kodi.wiki/view/AirPlay).
        
       | rusk wrote:
       | Oh this is great. Hopefully won't have to spend EUR250 on _yet
       | another box_ to function as essentially a wireless HDMI adapter
       | ...
        
         | stevehawk wrote:
         | any Roku will serve as a miracast device and as a WiDpi or
         | whatever it's called
        
           | somehnguy wrote:
           | They also added Airplay officially pretty recently.
           | 
           | All my TVs have Roku built in and I was surprised a few weeks
           | ago to wake up and see that My MacBook & iPhone started
           | offering Airplay audio/video casting to any of my TVs.
           | 
           | Pretty slick addition to the already great Roku featureset.
        
             | rusk wrote:
             | > I was surprised a few weeks ago
             | 
             | Oh well that's cause for hope!
        
               | [deleted]
        
         | whizzter wrote:
         | I can recommend AirServer if you have leftover PC or Xbox,
         | bought it for my Xbox and it's worked fine for my use-cases.
         | Also many "smart-TV"'s seems to have it built in these days.
        
       | iamlemec wrote:
       | This has been really useful for me when teaching online. Just
       | mirror my iPad to a desktop window, then point OBS at said window
       | (then pipe OBS to Zoom through a virtual camera). I tried to
       | modify the source to output to a v2l loopback device instead, but
       | couldn't quite get it to work.
        
         | llampx wrote:
         | Can't you share the iPad screen directly in zoom?
        
       | techstrategist wrote:
       | I have been using this on my RPi4B and it's been pretty
       | inconsistent. I haven't had a chance to troubleshoot it yet
       | though.
        
       | fudged71 wrote:
       | Could you use this as an "analog hole" to scrape/OCR screen
       | content from iOS apps?
        
       | wjdp wrote:
       | Gave up on chromecast for audio recently, had too many issues
       | with discovery of the client.
       | 
       | Now using shairport (via the excellent hifiberry os and
       | picoreplayer) on RPis and AirMusic on Android.
       | 
       | Seems a bit silly to be using an Apple protocol when I own zero
       | Apple devices but works rather well. Had to give up on clientless
       | playback (podcast app via chromecast) but this setup is
       | significantly more reliable.
        
         | pantalaimon wrote:
         | AirPlay also works well with PulseAudio as a source IIRC, so
         | even streaming from the desktop is pretty seamless.
        
           | wjdp wrote:
           | Have tried, works well.
           | 
           | Does have a weird quirk where it'd detect two devices for
           | each speaker, an IPv4 and v6 address. Only the v4 worked and
           | both had the exact same name, mildly irritating.
           | 
           | Did try and find docs on disabling discovery and hard-coding
           | addresses but to no avail.
        
       | thomasfl wrote:
       | For Spotify users, there is the excellent RaSpotify client.
       | https://github.com/dtcooper/raspotify
        
       | Naac wrote:
       | So it looks like this is an open source implementation of the
       | airplay server. So Apple devices using airplay can stream to
       | whatever server is running this.
       | 
       | Is there a program that does the same thing for the client? Such
       | that I can run the client software on my laptop, and airplay to a
       | raspi connected to my TV running the server software?
        
         | jeroenhd wrote:
         | For Linux, pulseaudio (for sound) and Miracast (for video) come
         | to mind. Support isn't as smooth, though.
         | 
         | I've seen several attempts at open source Chromecast servers
         | because the client support is excellent, but very few have
         | remained after Google changed their API to be more closed and
         | encrypted.
         | 
         | I do wish there was such a tool, though. An open source
         | alternative to Chromecast would be amazing imo.
        
       | ed25519FUUU wrote:
       | I've used this and it was surprisingly easy to setup. It makes
       | the RPI show up just the same as any airplay device, which is
       | convenient.
        
       | RIMR wrote:
       | This is excellent. I have a Macbook for work, and a Linux media
       | center, and I just added this as a button on my remote so that I
       | can Airplay. Much better than the previous workarounds I was
       | using.
        
       | ArtTimeInvestor wrote:
       | Would this run on plain Debian on the PI?
       | 
       | Raspbian took a turn that makes me think one should not use it
       | anymore:
       | 
       | https://www.cyberciti.biz/linux-news/heads-up-microsoft-repo...
       | 
       | Sweeping in a repo by a third party is a bad thing imo.
        
         | _joel wrote:
         | I can't see an issue running it on Debian or Ubuntu for that
         | matter
        
         | azinman2 wrote:
         | > Microsoft may collect more info about RPi and Linux users as
         | many try to reduce their digital footprint such as your IP
         | address and build a profile about you.
         | 
         | So Microsoft, assuming they want to go the extra effort (these
         | are likely unconnected infrastructure pieces) could build a
         | fingerprint of you to know that.. what, you have a raspberry
         | pi? And they could go to extreme lengths to associate this with
         | your GitHub account to know that yes you, John Smith, have a
         | raspberry pi? What business value is this for them, and how
         | could it be used for "evil"?
        
           | derivagral wrote:
           | In the future, coordination across Github, Linkedin, and
           | other properties of theirs could exist (e.g. Facebook &
           | Oculus). The not-that-nefarious-but-annoying one I can come
           | up with immediately is better targeting for recruiter spam on
           | LinkedIn based on hobby projects, code language, and
           | Linkedin/Github connection graphs. I know they have ads on
           | Bing that could benefit as well, but I don't know if they run
           | their own ad network or how those things might tie together.
           | 
           | I think others could probably give the "evil" part a better
           | take. Mine is just an unfounded guess around business/market
           | research and future competition.
        
             | azinman2 wrote:
             | Firstly, I wouldn't underestimate the level of separation
             | between fiefdoms in Microsoft. LinkedIn, Bing, Github...
             | these are all pretty different parts of the company.
             | Secondly, so LinkedIn is better able to target people who
             | own a raspberry pi? I'm not even sure what kind of signal
             | that gives you (could correlated to a wide variety of
             | things), but given it's 1-bit nature... ok so I'm
             | headhunted more or less specifically a tiny bit? I can't
             | imagine this is even worth the engineering time at
             | Microsoft, but if it is somehow, I still don't see the big
             | deal here.
             | 
             | To me it just sounds like a general distrust of Microsoft
             | compared to the Raspberry Pi foundation. I just wish it was
             | more framed as 'I don't like Microsoft, no matter how
             | rational or irrational this fear is.' I'd respect that far
             | more than alluding to some potential tangible harm cross
             | referencing that you own a Raspberry Pi with your github
             | profile. You already declare what you own in your user
             | agent when you use github to begin with -- why is an RPI so
             | different and that much worse?
        
               | fartcannon wrote:
               | Would you object to google or facebook getting private
               | keys installed on your computer without being asked?
               | 
               | How about a repo just for the CCP/US Gov/Russia?
        
               | azinman2 wrote:
               | The private keys are specifically for accessing a repo,
               | which is also easy to disable. No, I wouldn't object if I
               | was downloading software from them: I'd want it to be
               | cryptographically verified. Similarly, I accept an OS
               | with keys from Google and all kinds of people and
               | governments in the form of SSL root certificate trust.
               | 
               | If I was getting software from the CCP/US Gov/Russia then
               | that would also be fine. Here I'm not, it's a repo for
               | VSCode from Microsoft. Context matters.
        
               | fartcannon wrote:
               | For the rest of us, I guess the canary died.
        
               | azinman2 wrote:
               | Can you point me to this 'death' scenario? What did it
               | die of?
               | 
               | Are you worried Microsoft is going to install spyware by
               | overriding something like 'git' in their repo that your
               | pi would download instead? I see I'm getting downvoted,
               | but no one has actually spelled out the potential evil
               | scenario here other than better LinkedIn recruiting.
        
         | taneq wrote:
         | Wow that sucks. If they must install VSCode they should use
         | VSCodium which omits the telemetry.
        
         | e2le wrote:
         | _"Microsoft bashing."_
         | 
         | Such a strange reason to give for locking a thread concerning
         | these recent changes to Raspbian.
        
         | Uehreka wrote:
         | The author complains that if VS Code is to be included, then at
         | the very least it should be on a special version of RPi OS "for
         | kids" because other people just want to run RPi's headless. The
         | thing is, Raspberry Pi OS already works like this: there's a
         | Lite (headless) version, a desktop version, and a desktop
         | version "with recommended software". VS Code is almost
         | certainly only in that last one. So you can even run a
         | "headful" RPi without it!
         | 
         | With all that said, I'm glad they're including VS Code in the
         | recommended software. In the past I've tried compiling it from
         | source, but given the Pi's limited CPU muscle it takes a long
         | time.
         | 
         | https://www.raspberrypi.org/software/operating-systems/
        
           | ArtTimeInvestor wrote:
           | I'm glad they're including VS Code
           | 
           | The problem is not including VS Code in their distros repo.
           | The problem is adding a third party repo to their distro.
        
             | FDSGSG wrote:
             | >The problem is adding a third party repo to their distro
             | 
             | Why is that a problem? Lets not pretend that the article
             | you linked actually provides a legitimate answer to this
             | question.
        
               | forty wrote:
               | It's like if you let the key to your house to a friend
               | you trust, then that friend let your key to someone else
               | without asking you. It is not okay.
        
               | fartcannon wrote:
               | And that someone they lent it to is a well known bad guy.
        
               | derivagral wrote:
               | From what (little) I've seen on the topic, the concern
               | arises both from who that repo belongs to (many haven't
               | rebuilt that trust) as well as that repo having general
               | activity data from the update/install pings.
               | 
               | As someone who has a couple, I'm not thrilled about it
               | but I'll just quietly disable it with a guide every time
               | I install or update one. If they keep going in this
               | direction, competition does exist.
        
               | FDSGSG wrote:
               | >the concern arises both from who that repo belongs to
               | (many haven't rebuilt that trust)
               | 
               | What's the concern? One of the largest Linux contributors
               | is going to start pushing malware in their repos? If you
               | don't trust MS, why would you be using Linux in the first
               | place?
               | 
               | >that repo having general activity data
               | 
               | Literally the only thing you can determine from this
               | activity is that someone at your IP address has an arm64
               | device running apt.
               | 
               | >install pings Only if you install something from that
               | repo, so that's a very limited set of software.
        
               | ArtTimeInvestor wrote:
               | Now suddenly data flows between my computer and
               | Microsoft. Without me ever agreeing to that.
               | 
               | And if I install the wrong application - BOOM - Code by
               | Microsoft is executed on my machine.
        
               | FDSGSG wrote:
               | If you're using Linux there's code by Microsoft being
               | executed on your machine, MS is one of the largest
               | contributors to the Linux kernel. This is a really
               | bizarre thing to object to.
               | 
               | >Now suddenly data flows between my computer and
               | Microsoft.
               | 
               | So what? Data probably flows between your computer and
               | NTP pool servers operated by completely random parties
               | too.
        
           | vorpalhex wrote:
           | > VS Code is almost certainly only in that last one
           | 
           | One might think that. One would be wrong. It appears to be in
           | the headless version and up.
        
         | nemothekid wrote:
         | 1. Raspbian goals seem to be for the OS is to provide an
         | educational platform. I don't see it as nefarious that they
         | would include VSCode, given they install a number of other
         | components (e.g. matlab) on the basic install. If you don't
         | need that, they offer the lite version.
         | 
         | 2. If you are thinking about playing video you need Rasbian's
         | closed source drivers and if you are using ffmpeg, you will
         | want their custom build that has hardware acceleration for the
         | pi.
        
           | ArtTimeInvestor wrote:
           | This is not about which software Raspbian includes in their
           | distro. It is about that they have added a third party repo
           | to their distro. So even people who do not use the software
           | are affected.
        
       | jxy wrote:
       | It looks great. I only wish it could drop the dependencies on
       | avahi and gstreamer.
        
         | NegativeLatency wrote:
         | Without Mdns there's no way to get it to show up in the airplay
         | list on iOS
        
       | yannovitch wrote:
       | Very interesting, if it has indeed the video capabilities that
       | Shairport (& shairport-sync, ...) lacks.
        
       | starik36 wrote:
       | I tried this last year to cast video and audio from the AppleTV+
       | app. I spent quite a bit of time trying to make it work, but
       | ultimately it didn't.
       | 
       | Has this been fixed at all? Has anyone been able to cast AppleTV+
       | content?
        
       ___________________________________________________________________
       (page generated 2021-02-04 23:01 UTC)