I’m a bit new to Unity3D.
I’m trying to build a Unity3D plugin for iOS. This plugin should be able to capture screen, and audio (or audio file names) being played by the game. Do I need to override some method or register for notification etc.?
Similar questions like this and this had been asked in the forum months ago, but nobody answered or commented. I hope this time someone gracious enough will come forward to help out.
I know there are some plugins out there on the asset-store but I want to have my own custom plugin.
I was able to capture the Unity frames through render-to-texture. (though part of the core functionality is still at the script side, and I want the core functionality be concealed at the native iOS library side).
Audio could be captured at the script side by the use of AudioListener, however the scripting side solution for capturing the audio is extremely inefficient on iPhone 4. (works fine on iPhone 4S).
As I read somewhere, Unity uses FMOD. Is it possible to capture the audio at the native iOS side? I believe native library would not only help conceal my code for proprietary reasons but will also be much more efficient than UnityScript.
Thanks but I can’t use Kamcord. My goal is to develop my own custom library with my own custom modifications later on.
OnAudioFilterRead and associate script for writing wav file has huge performance issues, and the other draw back is that the script is open for everyone to see. I wan’t to develop a static library which can conceal my code; and that’s only possible in through native iOS library, right?
Its been a few months, but for anyone looking in on this. I will be trying this in morning. Since you said you are running on iOS, I’m assuming you are using AVFoundation to record video from your plugin. In OnAudioFilterRead(), just pin the array you are handed (See http://forum.unity3d.com/threads/80962-How-to-send-a-byte-argument-in-Native-Plugin), and send a pointer to your plugin along with a timestamp. Construct a buffer object around this (avoid copying) and pass it to the recording session. You will also need to implement some method for telling the script to unpin the array after it has been encoded so it doesn’t leak.