I need to record and show video from a real camera device in iOS/Unity and show that video as a texture in RawImage (Image of what I want)

What I have tried so far:

  • Unity WebCamTexture API: It shows the camera in a texture but it has two problems! It does not record audio and does not have an API to save video!

  • Camera Capture Plugin: I bought this plugin but unfortunately it does not have the feature to show video in a texture; it just opens the camera device's application.

  • EverPlay plugin: I tried this plugin and it seems that it just creates a video from the screen and not the camera

  • Unity Video Capture API: There is also this API for recording video with sound but unfortunately it is part of Windows Mixed Reality and does not support iOS

  • Using Objective C: I tried to write the video recording section directly in Objective C, I did it but I could not find a way to embed that in the Unity scene -- I'm not sure it's even possible! ( what I tried)

I appreciate any other solutions that can help.


Are you targeting Metal or OpenGL?

I would suggest taking a look at CreateExternalTexture

This lets you basically take an id<MTLTexture> (Metal) or GLuint pointing to a native texture (OpenGL) and turn it into a Unity texture.

You can use AVFoundation to get the video and stream it to a Metal texture. Here is Apple’s example project which does that part.

  • \$\begingroup\$ ty for your response, It helps. actually, I ended up adding save functionality in unity's ios source code( which like you said uses AVFoundation for its webcamtexture API) \$\endgroup\$ – omid May 22 '18 at 4:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.