How can i capture what's being played on an iOS device output audio stream and store it in an object? - ios

Is there a way to programmatically capture what's being played on an iOS device audio output? I want to capture an audio snippet and do some data processing on it.

There is an entire library devoted to this sort of thing that Apple built in for you called AVFoundation.
It's extensive and sprawling, so be prepared to do some work, but you'll be able to sample and manipulate the bit-streams directly with all types of audio.
If you are trying to have your app run in the background and strip audio from another app (like iTunes) or from the phone itself, put on your black hat, hack into the private API's of iOS, and release your stuff over in the jailbroken app-store, because that sort of thing is explicitly designed to not be possible with legal and legitimate apps.

Related

How to test ARKit app? Can ARKit app be tested using recorded video instead of live video?

Getting started with ARKit development. Imagine that testing an app in development between builds requires imaging an environment to expose the app to a scene and that having to physically hold and/or move camera to capture live scene will be extremely cumbersome each time.
Can an app be tested with recorded video in order to avoid having to capture a realtime scene each time an app has to be tested? If so, how to do so?
Unfortunately, there is no other way to test ARKit apps except running them on your device. I agree, it is a cumbersome process, but for now thats all we have. Hopefully, in the future, Apple will make some sort of AR simulator so that we can test our apps in a faster and easier way.
Yes you can record videos using Reality Composer, then airdrop them to your mac, add them to your Xcode project, edit the scheme to enable ARKit "Replay data" (it may only appear when a device is connected), then select your video in the drop-down list
Edit : screenshot made using Xcode 12.5.1

Do I use AIR or native code for iOS application?

I have been using Flex for desktop development for years. I'm new to mobile development and need to create an app for the iPhone 6 but have no idea whether I should be using Flex/AIR or native code.
The requirements of the iOS app is as follows:
Record video to local storage within app
Playback video from local storage within app
Pause/seek video within app
Overlay controls on top of the video such as TextInput, TextArea and DropDownList so user can make notes as video is being recorded
Data entered via TextInput/TextArea/DropDownList is saved to local storage
Option to upload video and text data to local server
Can I achieve all of this using AIR or should I be using native code?
Can I achieve all of this using AIR?
Yes. Use CameraUI to capture video on the device (using the device's native camera UI), and StageVideo to play the video (using GPU). Overlay your app UIs (Flex or your own) to control video playback. Save local data using File or EncryptedLocalStore or SharedObject. Upload to a server using File/upload().
Or should I be using native code?
That's up to you. There are trade-offs, and everyone will have their own opinion. If you have a lot of experience with Flex/AS3, then you should be able to work out this app in AIR quite easily and see if it meets your needs.
You can achieve this using Adobe AIR but performance will get a hit.
You will need a lot of effort in order to optimize performance especially for video capture functionality.
It is better to do it natively.

Any way to add music to iPod library in iOS?

I want to write an app to be able to transfer music between two iOS devices and put them into iOS music library. I understand that this is a violation of app store rules, but I don't want to publish it, I want to use it for my own devices.
Is there any way to do this on a non-jailbroken device? Like a private API or modifying a file manually? (like the private API for changing brightness I found)
About the closest you're going to be able to get is to share the files so you can access them via iTunes and drag them to the library (in iTunes). Consider simply creating your own music library and player for sharing music.

Live streaming Audio from iOS

I have tried to live stream audio (AAC-LC) from iOS for 3 months without much success...
I tried Audio Queues, which work well but there is a strange delay (~4s) and I don't know why (high level API ?)
I tried Audio Units, it sometimes works on the simulator but never with the phone using a modified code from this source
I am really lost, can anyone help me ?
EDIT
I have to do a live streaming application (iPhone-> Wowza Server via RTSP). The video part works well with little delay (1s). Now I'm trying to add audio in addition to video but I'm stuck with the SDK.
tldr : I need to capture microphone input then send AAC frames over the network without getting huge delay
This app, which I just now completed, broadcasts audio between any two iOS devices on the same network:
https://drive.google.com/open?id=1tKgVl0X92SYvgpvbljRzilXNQ6iBcjqM
Compile it with the latest beta release of Xcode 9, and run it on two iOS 11 (beta) devices.
The app is simple; you launch it, and then start talking. Everything is automatic, from network connectivity to audio streaming.
Events generated by the app are displayed in an event log in the app:
Even though the code is simple and concise, the event log was provided to make understanding the app's architecture quicker and more easily.

Saving video screencast of iPhone application

Is there a way to capture video of a screen from your own application? As far as I see there is no way to do it with UIImagePickerController (cameras only), but maybe there is a way to do it with iOS 4 AV Foundation or Core Video?
There seems to be two ways of capturing the content of the application while it's running:
Use the private API UIGetScreenImage() function which seems to be accepted by Apple now;
Use the following thread's captureView method to capture the image.
You'll have to capture it at many times per second (I guess 24 times should be ok for human eye persistence) then you'll have to produce the movie. Perhaps you could use the ffmpeg iphone port.
Alternatively, if you'd like to capture your application's running for a demo, your best bet would be to run your application on the simulator and use a Mac OS X screencast software to capture it. See also SimFinger which "bundle of little tricks to make a screen capture of the iPhone Simulator suck less".
Finally, perhaps the following StackOverflow thread might help you produce better screencasts.
SimFinger and ScreenFlow are great if you can shoot in the simulator.
If you have to shoot on the device (e.g. when accelerometer, GPS, camera, etc. are used) you currently have to resort to the jailbreak world. The app "Display Recorder", available for $5 in the Cydia Store, allows to create an AVI movie of the iPhone's screen content. This works across all apps. There's a YouTube video showing it. The movie files can then be uploaded to YouTube or pulled off the iPhone via the built-in web server.

Resources