AirPlay API for Mac OS X - objective-c

Is there currently any API (public or private) that will allow a 3rd party Mac OS X application to stream audio to AirPlay receivers? Airfoil by Rogue Amoeba Software seems to be able to do this, same goes for Erica Sadun's AirFlick, but I was unable to find any source code that would demonstrate how to do this. Any pointers are appreciated!

Here is an open source ruby implementation. It's pretty straight forward. https://github.com/elcuervo/airplay

It turns out AirPlay audio streaming is possible as of OS X 10.8 using public APIs, but wasn't really documented anywhere. Joris Kluivers wrote a great blog post on how to get it going.

There are a couple of open-source RAOP players available; I haven't tried them, so I don't know if Apple has broken them since they were written.

Mountain Lion (OS X 10.8) has added AirPlay support in the sound settings. The user can choose to send the local sound output to an AirPlay device. However, I don't think that you have access to any API within your app.
There are some libraries available to implement AirPlay, but know that Apple will reject your app if you try to publish it on the App Store. At least, that's what happened to me.
I wrote a node.js module to support AirPlay. Even if you don't use node, you can just pipe your audio data through stdin.
https://github.com/lperrin/node_airtunes/

I don't think it's available. At least not in versions prior to 10.7.
I'm guessing that Airfoil uses something like DVD John did a while ago when he cracked the Airport Express key payload. He released the code (C#) you should be able to find it but it's pretty cryptic.
I'm not aware of what AirFlick uses but you could always try pinging Erica, she usually shares her stuff.

Someone recently managed to obtain the AirPlay private key which allows you to have your program listed in the AirPlay menus on devices on your network.
You can read about it here. There is also an open source project linked from that page.
http://mafipulation.org/blagoblig/2011/04/08#shairport
Be aware that obviously any application you create will never be approved by apple and the private key could potentially be changed in a firmware/software update.

Related

Applying Non-Standard Power Assertions & Creating Virtual HIDs

I've got a big ask here, but I am hoping someone might be able to help me. If there's another site you think this should be posted on, please let me know.
I'm the developer of the free app Amphetamine for macOS and I'm hoping to add a new feature to the app - keeping a Mac awake while in closed-display (clamshell) mode while not having a keyboard/mouse/power adapter/display connected to the Mac. I get requests to add this feature on an almost daily basis.
I've been working on a solution (and it's mostly ready) which uses a non-App Store helper app that must be download and installed separately. I could still go with that solution, but I want to explore one more option before pushing the separate app solution out to the world.
An Amphetamine user tipped me off that another app, AntiSleep can keep a Mac awake while in closed-display mode, while not meeting Apple's requirements. I've tested this claim, and it's true. After doing a bit of digging into how AntiSleep might be accomplishing this, I've come up with 2 possible theories so far (though there may be more to it):
In addition to the standard power assertion types, it looks like AntiSleep is using (a) private framework(s) to apply non-standard power assertions. The following non-standard power assertion types are active when AntiSleep is keeping a Mac awake: DenySystemSleep, UserIsActive, RequiresDisplayAudio, & InternalPreventDisplaySleep. I haven't been able to find much information on these power assertion types beyond what appears in IOPMLibPrivate.h. I'm not familiar at all with using private frameworks, but I assume I could theoretically add the IOPMLibPrivate header file to a project and then create these power assertion types. I understand that would likely result in an App Store review rejection for Amphetamine, of course. What about non-App Store apps? Would Apple notarize an app using this? Beyond that, could someone help me confirm that the only way to apply these non-standard power assertions is to use a private framework?
I suspect that AntiSleep may also be creating a virtual keyboard and mouse. Certainly, the idea of creating a virtual keyboard and mouse to get around Apple's requirement of having a keyboard and mouse connected to the Mac when using closed-display mode is an intriguing idea. After doing some searching, I found foohid. However, I ran into all kinds of errors trying to add and use the foohid files in a test project. Would someone be willing to take a look at the foohid project and help me understand whether it is theoretically possible to include this functionality in an App Store compatible app? I'm not asking for code help with that (yet). I'd just like some help determining whether it might be possible to do.
Thank you in advance for taking a look.
Would Apple notarize an app using this?
I haven't seen any issues with notarising code that uses private APIs. Currently, Apple only seems to use notarisation for scanning for inclusion of known malware.
Would someone be willing to take a look at the foohid project and help me understand whether it is theoretically possible to include this functionality in an App Store compatible app?
Taking a quick glance at the code of that project, it's clear it implements a kernel extension (kext). Those are not allowed on the App Store.
However, since macOS 10.15 Catalina, there's a new way to write HID drivers, using DriverKit. The idea is that the APIs are very similar to the kernel APIs, although I suspect it'll be a rewrite of the kext as a DriverKit driver, rather than a simple port.
DriverKit drivers are permitted to be included in App Store apps.
I don't know if a DriverKit based HID driver will solve your specific power management issue.
If you go with a DriverKit solution, this will only work on 10.15+.
I suspect that AntiSleep may also be creating a virtual keyboard and mouse.
I haven't looked at AntiSleep, but I do know that in addition to writing an outright HID driver, it's possible to generate HID events using user space APIs such as IOHIDPostEvent(). I don't know if those are allowed on the App Store, but as far as I'm aware, IOKitLib is generally fine.
It's possible you might be able to implement your virtual input device using those.

How to get icon for network computer ( smb/afp ) on macOS based on type

Is it possible to get icon for network computer/ip address under macOS so iMac has iMac icon etc?
I am using NSNetServiceBrowser to get available services, but I do not know how to get icon like official Finder app does. Finder recognize icons for iMac, MacBookPro etc. Thanks.
I don't have a working solution for you, but I see your question didn't get much attention yet so maybe I can point you in the right direction.
Finder looks for services, and it will check if found services have "device info" associated with them. This is done via Bonjour, looking for a _device-info._tcp pseudo service. A lookup for a device info may return a Bonjour TXT record that indicates the model ID of the gizmo. If Finder succeeds in getting this info, then it assigns an icon accordingly, otherwise, it picks a generic icon.
The icons themselves seem to be stored here: /System/Library/CoreServices/CoreTypes.bundle (at least on my 10.13 machine). Check the Info.plist on that bundle, and the other bundles contained within, and you can find mappings between device types and icons.
There are some posts talking about how to customise the icon that's shown for certain devices:
Add custom network device icons in Mac OS X Finder?
Can you use Bonjour for Windows to broadcast a different icon than the Bluescreen?
I tried to follow the steps in this post to examine the model names advertised by some Apple hardware on my network, but couldn't make it work (either using the dig tool or with NSNetService) (although I admit I didn't try very hard with NSNetService as I'm not familiar with it).
This thread discusses potential problems and solutions, however the dig tool wouldn't work for me despite having both SMB and AFP over TCP enabled.
All of these threads are fairly old, although the commentary in the linked SO post suggest this still works at least as of Sierra.
Good luck!

Utility like iFinBox and iExplorer for OS X

I want to make a Utility app like iFunBox and iExplorer for Mac OS X where i can retrieve information and files of connected device and display it.
Though i have good experience in iPhone Development, I have never developed anything for mac.Can anybody provide me good starting point from where i can start.
Thanks
There isn't a public API from Apple for working directly with iOS devices. There are open source solutions like libimobiledevice if you want to make an iFunBox style application.

Qt Mobile broadcasting (DVB-H) API

I want to create a Qt program that uses the DVB-H headset to watch and record programs. I know there is already such a program on the Nokia store but it doesn't work with latest headset. I have already found this http://library.developer.nokia.com/index.jsptopic=/Java_Developers_Library/GUID-154101B4-1539-4025-9698-FC1FBF393C0E.html for using the headset with a Java app, but I want to know if there is a Qt version of this API that I can use. I have been looking around but I can't find one, maybe there isn't one. If you know anything about this please help.
Qt APIs for DVB-H do not exist. JSR-272 is the only option on Symbian.

How to access device settings on a Sony Ericsson mobile phone?

Edited on April 29th, content changed
Hello everyone,
I recently bought a Sony Ericsson mobile phone and I would like to add a missing feature myself. In fact I cannot actually disable Internet connection in an easy way when roaming, which cost me a lot of money last time I moved away ... So I would like to develop a little application that would just replace the actual Internet configuration with a fake configuration to avoid auto-connections.
So what I would like to know is how can I access programmatically to my phone settings? I know that Sony Ericsson provides a SDK to run Java applications on its customised JVM. So what I am actually looking for is to know if they extended the J2ME functionality to fit their devices requirements.
This is not well documented so I am asking this question with the hope that someone here already had experience with development targeted for Sony Ericsson devices.
Thanks.
NB: This is a Sony Ericsson Elm which is based on the Sony Ericsson OS with SE Java Platform 8.5.
Edit: I accepted QuickRecipesOnSymbianOS answer as it gave me a clue on the only feature that could have helped me, but which is unfornatunately missing. The Sony Ericsson Java Platform is the only API I could use to develop real programs on my phone. But the JP-8.5 does not implement the JSR-307 package which could help me in managing APN. Thanks everyone for your help.
Well, I hope you got the great Vivaz phone, not the Satio.
In order to learn about Symbian OS C++, first go to the Foundation website.
Relevant plug: the latest introduction to Symbian OS C++ in book form is Quick Recipes on Symbian OS
For now, you won't find a better way than Symbian OS C++ to manipulate your handset access points.
JavaME simply doesn't have the correct APIs for this, at least not until JSR-307 is implemented.
I believe Qt isn't integrated quite tightly enough just yet either but that should change soon enough. Keep an eye on it.
Extending the Symbian Python runtime to do what you want would require some Symbian OS C++ anyway.
Yes you will need to use Symbian C++ to modify the CommDB, which holds the list of connections. It is quite painful to work with it directly, but there are some utility classes that can help you out. Take a look at CApSelect, CApDataHandler and CApAccessPointItem, all in the developer library.
And yes, these will work on all modern Symbian handsets, independent of brand.
Note: My answer below assumed it was about a symbian device. Since it was actually a J2me device none of the below applies
The easiest way to achieve what you want to do is probably to just remove all the "destinations" when you want to prevent auto connections. Otherwise the device will test each destination in turn until it finds one that works.
You can also set up your destinations so that they are not allowed to be used automatically. This setting must be done individually for each destination.
You can also group your destinations and set one of the groups to the default. If you set the default to an empty group you should not get any automatic connections.
Note that I have not tested any of these methods myself. When I roam I turn off automatic updates in the apps that use them. Some apps can even detect when you are roaming and avoid auto connects.
There are S60 apps available that improves the connection management of vanilla S60, but I do not know if any of them can help you with your problem.
If you are dead set on doing the programming yourself you have to use the C++ SDK for Symbian S60 available from Forum Nokia. Java ME does not allow you to manipulate the destinations of the device.
The Elm device should have (I haven't verified this) the access point API originally designed by Nokia. Not sure whether you can use it for the purpose you want though. The J2me developer guidelines available from developer.sonyericsson.com should have all the information you need.