Is there an API for retrieving the Apple TV's version? - ios

I just fired up the new Netflix app for iOS and upon trying to AirPlay the video to my Apple TV, I got this message:
So I was wondering how they're able to do this. Is there a public API that lets an app retrieve the version of the Apple TV that's selected for AirPlay? Or does Netflix use some other means to detect this?

It's actually not that difficult to be able to pull something like this off. We're going to need to be doing two things: 1) listening for when the audio route changes to know when we've connected to an AirPlay device, and 2) searching the network for AirPlay devices to get info from.
Once we get notified when the audio route changes, we can get info about the new route. The most important bit for us is the name of the output port for the AirPlay device. Once we have that, we can iterate through all the AirPlay devices we know about to find the one that matches the name of the output port. Once we have that device, we can get info from its TXT record, which contains info about the version of the software its running.
I've pushed a sample project to Github that details how I pulled this off. This is a really simple project that just handles when a route changes. If you wanted to go live with this code, then you'd also want to add checks at certain other places, like when you present an MPMoviePlayerViewController.
EDIT: Note that this is pretty hacky, as we rely on the name of the port to be the same as the name of the AirPlay device. If Apple changes either of those things, this breaks. Alternatively, you can compare the "deviceid" field of the TXT record of the device to the UID of the port, which is the deviceid with the string "-airplay" appended to it, as far as I can tell. Again, if that is changed by Apple, it would break, but at least it's another potential way of checking.

Related

Publish IOS App to Appstore with SSID ( wifi) discovery/connect through app

I was trying to get a specific info before a IOS App development task which I searched but couldn't find anything relevant.
Wanted to know whether this requirement restricts (non compliance issue as per publish guidelines) the app to be published in App Store with features as below
User scans and lists all available wifi connections in a tableview
Selects one of the Wifi connection and connects on button click
Stores the password and SSID for future connections.
Would there be any compliance issue related to the same functionalities when submitting to IOS app store. One of my colleague have advised me about the same but not able to explain why? Which I tried to find out searching the internet, but too specific to find anything relevant. Deeply appreciate an Expert advise on this.
Thanks in advance.
I can't find anything in the Review Guidelines that would object your app idea: https://developer.apple.com/app-store/review/guidelines
A couple of areas where you should have a more detailed look:
2.5.1 Apps may only use public APIs.
2.5.9 Apps that alter the functions of standard switches, such as the Volume Up/Down and Ring/Silent switches, or other native user
interface elements or behaviors will be rejected.
5.1 Privacy
Technically, I'm not sure if it's even possible to change the WIFI not via the settings app, so I'd have a look their first. (https://apple.stackexchange.com/questions/1592/is-there-an-ipod-app-to-easily-switch-wifi-on-and-off)
I don't believe I've ever seen an app or a way to change SSID outside the Settings app. I explored a way to detect network changes, connects, disconnects, which work fine while the app is running. I was never able to influence how the user connected, just that a change happened. It also falls apart pretty quickly when the user backgrounds the app. Trying to keep a background task open long enough to poll the current connection fails pretty fast.
I wish Apple would provide some system level notification of Wifi connect events. This could be very useful to developers that want a little more control than Background App Refresh events.

youtube Integration on a settop box and questions

We are trying to integrate Youtube app on a STB that is using RDK middleware (capable of running HTML5/javascript applications). I have been through the "YouTube TV HTML5 Technical Requirements 2016" document and have some questions.
1) As per my understanding youtube is an opensource app and integration work will be required? Will there be any customization be required? For example there is a difference how search functionality is available on different device types. Youtube app being run on a browser on a PC, a textbox is available where you can type what you want to search and then press the search icon next to it to start the search. However on the devices like Smart TV, Set Top Box where user does not have the pointing device and the keyboard, usually soft keyboard is required to be shown on the screen and search starts automatically after entering certain number of characters. I want to know if this functionality is customized by the app integrator or there are different code bases for different device types?
Similar questions i have is for the settings menu. For example to support dial 2.0 protocol to remotely launch the youtube application from the remote device you need to have settings menu to let you to pair / unpair the device. So settings menu seems to be different for different device types.
2) Similarly there are differences how user is allowed to perform forward / rewind during the playback. On PC browser i have seen user can seek to any position with in a stream using a mouse. However on smart TV's there is a rewind forward button which result in seek -/+ 10 secs. I have not seen trick modes on any implementation. Are trick modes required and how they are performed? If they are required then using seek or some sort of iframe tag file to allow smooth trickmodes? Again doesn't that part come from the app itself?
3) I'm trying to find if Youtube support any or all of these MPEG-DASH, Apple HLS, Microsoft Smooth Streaming, adaptive bit rate protocols. However not having much luck with them. I tried to capture the packets using wireshark and launched the youtube application and played back the video but i was unable to see any http calls that can give me hint that youtube app is using any of the above ABR formats (may be all the communication was under TLS and so encrypted and so i was unable to find whats going on). Even youtube app running from a browser on a PC, when i playback the video, i can see under settings -> Quality always remain at auto, 480p for the whole duration of playback. And if i change the quality to any value e.g 720p it always stay there for the whole duration of the playback. This is telling me it is not using any of the ABR formats. So i guess these ABR formats are probably for future use?
4) Under the youtube specifications i can see that target device must implement at least com.youtube.playready and com.widevine.alpha (for 4K contents) DRM's. I was trying to find if you tube has any content available in these formats but was unable to find any. Can you please confirm?
I would appreciate if someone can answer these or point me in the right direction.
Best Regards,
Farhan

How do I deal with save game data when changing Apple ID on ios device

This comes close to an opinion question, but I hope that someone can give a definitive answer.
I have written a game app and I save game data locally. But I also will want it to be cloud capable and I am currently writing the code but I keep hitting a mental barrier. In several places in the iCloud and Game Center documentation it says if I change Apple ID, I need to delete the local save game data/file cache. This is contrary to how my app currently works, which is OK if I can figure out the right way to do it. In the ICloud documentation it says to either user the cloud or don't use the cloud and only ask once, but there is a button in the settings to turn the iCloud Drive on and off.
The core of my dilemma seems to be that an IOS device is not tightly linked to one Apple ID. I understand that multiple devices can be associated with one Apple ID, but not why it should be true the other way around.
This can be seen as either added capability or enough rope to hang oneself. As a user I can, using my Apple ID, get on to another device not associated with my Apple ID and:
download an App/Song
log into Game Center and play a game we both own.
etc.
I know Apple deals with this and now I have to do the same.
As App Developer I see a world of questions about what this might mean, like "Well I'll do this or that but what do I do the first time this other thing happens?", etc.
For example, initially I thought I could consider "local" store the same as a very long airplane mode, and when the cloud became available I could sync the delta to the cloud and across devices, but this does not address changing Apple ID. Do I blow away the local data, keep the new user from playing the game, only allow local or cloud but not both?
Now Apple is adding Multitasking, and a login to iPad's used in schools, the problems become even worse.
I keep trying to find some profundity that will steer me to the correct answer but I am at a loss on how to deal with Apple ID changes.

Voice Control iOS

I would like to build a simple reader app for the iPad 2 that would allow users to navigate/read via voice controls. The app would allow the user to enter a mode where the microphone was live and listened for predefined keywords like 'down', 'up', 'next', 'back', 'home', etc.
I don't want to reinvent the wheel on this so I'm just wondering first, if someone has done this already and if not, are there any good tutorials or SDKs available to help with recording someone's voice, and then comparing future output to see if it matches, or just dealing with the microphone in general?
Let's put aside that this is a fairly vaguely worded question for the moment.
If you are expecting to allow voice control in your app that somehow works throughout the entire device, it's just not possible. Your app would only work to control itself -- or at least itself and whatever external hooks you can normally get to the rest of the device, like, say, playing a song out of the user's iTunes library.
If you're planning on doing this in a jailbroken environment, then you should find some open-source library that does voice recognition -- if there are any -- and start from there. Be prepared for a very long haul, though.
Dragon Mobile SDK is what you're looking for.
http://dragonmobile.nuancemobiledeveloper.com/
There maybe others voice recognition SDKs out there, but this is the only one I can think of from the top of my head.
You can find a library called CMU Sphinx. There's an iphone version for it called
PocketSphinx. See if it fits your needs.
I would like to build a simple reader app for the iPad 2 that would allow users to navigate/read via voice controls.
The iOS 13 new feature Voice Control fully meets your request because you can control your device and your app with your voice exactly the same as with touches.
It's also possible to define actions for some specific words for instance.
The device settings are perfectly well detailed to handle this amazing new feature (Accessibility - Voice Control):
If you need dedicated names to be read out in your app, use the accessibilityUserInputLabels property to define them.
That's definitely the built-in tool your need to reach your goal: no need to use external library or SDK, everything is natively provided. ;o)

Can an iPhone application running in the background transfer data via USB interface?

There are 2 iPhone applications. One application running in the foreground and the other running in the background. Is there any way to get the background application to send data over USB without coming into foreground? Ideally we want to keep the foreground app in the foreground, while the background app process some data. Once the data is processed it will inform the foreground app that the data has been processed.
No it cannot. It cannot even do this without the use of private frameworks, unless you're in the Made for iPhone program. If you are, then your organization will know, based on the documentation made available to you, what you can and cannot access, when and how.
Should you be in the Made for iPhone program, and are unclear as to what you have access to and when, contact the person in your organization who is the technical contact with Apple for this program, they will be able to give you the details.
If the task is started while the app is in the foreground and you call the appropriate beginBackgroundTask/endBackgroundTask methods, you should be able to have it continue running after the app is backgrounded.
Note that access to USB is restricted (see jer's answer) and that there's no officially sanctioned way to communicate between different apps on the same device. Also, you can only buy/download one app at a time in the App Store and I can't see Apple approving an app that required you to download a second app for it to work. So you may have bigger problems to solve first.
It would help significantly if you told us what you actually wanted to achieve. For example, "I want MyApp on the user's phone to communicate with MyApp on the user's computer".
The absolute easiest way is to send data between the phone and a computer is to require that they're both on the same Wi-Fi network. Several iPhone apps incorporate a web server (this was the easiest way of "file sharing" before OS 3.2), and many more iPhone apps connect to a computer running server software.
Your other options, more or less:
Reverse-engineer the Bluetooth side of GameKit and reimplement it on the computer-side. I'm not aware of anyone who's done this. Loosely, I think it's IP over Bluetooth PAN plus some sort of Bluetooth service discovery.
Audio input/output, e.g. the headphone jack or certain pins on the dock connector. I'm not entirely sure how the mic side works (the resistance was a bit high for a carbon mic when I checked), but you might get lucky and find a way to turn it into "line in" or find "line in" pins on the dock connector.
A webcam pointing at the iDevice screen (and the iDevice camera pointing at the computer screen). Ewwwww.
Join the MFi program.

Resources