Nosmai  Effects Nosmai  Moderation Nosmai Try-ons coming soon
Docs menu iOS
How-to guide

Use Nosmai Effects with Agora on iOS

Publish processed iOS CVPixelBuffer frames to Agora while Nosmai owns the camera and renders the local preview.

Platform iOS SDK version Nosmai 3.0.4 Updated Aug 22, 2026 Time 7 min

The streaming path

Camera frames pass through Nosmai Effects before Agora publishes them

Nosmai owns and processes the camera feed. Agora publishes only the processed output while the application keeps its local preview and session controls.

Prerequisites

  • Configure Agora broadcaster authentication, audio, and channel lifecycle.
  • Configure Agora to publish external video instead of its camera track.
  • Pin and test the Agora version used by your application.

Receive processed frames

[NosmaiCore shared].liveFrameStreamCallback =
    ^(CVPixelBufferRef pixelBuffer, double timestamp) {
        CVPixelBufferRetain(pixelBuffer);

        dispatch_async(agoraQueue, ^{
            [agoraAdapter pushPixelBuffer:pixelBuffer timestamp:timestamp];
            CVPixelBufferRelease(pixelBuffer);
        });
    };

agoraAdapter is the application layer that converts the Nosmai callback into the external-video API used by the pinned Agora release. Do not start Agora's camera while Nosmai owns it.

Preserve ownership and timing

  • The callback runs off the main thread.
  • Retain the pixel buffer when Agora consumes it asynchronously.
  • Preserve the timestamp and configure matching orientation and dimensions.
  • Do not block the callback with network, file, or UIKit work.

Stop in the correct order

Stop Agora publishing before clearing the callback:

[NosmaiCore shared].liveFrameStreamCallback = nil;

Then leave the channel and release Agora according to its lifecycle. Keep Nosmai alive if the local camera experience continues.

Common errors

SymptomCauseFix
Remote stream is unfilteredAgora is publishing its own camera trackDisable the camera track and publish the Nosmai processed source
Frames corrupt or crash laterThe buffer outlived the callback without being retainedRetain before asynchronous use and release after Agora finishes
Preview is smooth but remote video rotatesProvider orientation does not match the buffer contractTest portrait and landscape with the pinned Agora version

Verify it worked

Apply a visible effect, join from a second device, and confirm the remote video is filtered, correctly oriented, and stable through background and rejoin.

Next steps

References

Was this page helpful?

Your response helps us prioritize documentation improvements.

Nosmai

An AR and AI company. Founded on the idea that the next decade of software will be visual, and that the tools for it should be within reach of anyone building.

Newsletter

Product updates and release notes. No spam.

© 2026 nosmai, inc · all rights reserved