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

Use Nosmai Effects with Agora on Android

Publish the processed Android camera feed to Agora through a shared EGL texture path while keeping the local preview visible.

Platform Android SDK version Nosmai 3.0.4 · Agora Android 4.6.0 verified demo Updated Aug 22, 2026 Time 8 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.
  • Disable Agora's camera track because Nosmai owns the camera.
  • Pin and test the provider version used by your application.

Register Agora's EGL context first

Create the Agora engine, get its shared EGL context, and register its native handle before Nosmai initialization:

long agoraContext = EglBaseProvider.instance()
    .getRootEglBase()
    .getEglBaseContext()
    .getNativeEglContext();

NosmaiSDK.setAgoraShareContext(agoraContext);

This order is required. A context registered after Nosmai initialization cannot join the existing share group and can produce a correct local preview with black remote video.

Publish processed textures

NosmaiSDK.setRenderMode(NosmaiSDK.RenderMode.DUAL_OUTPUT);

NosmaiSDK.setTextureFrameCallback((textureId, width, height,
                                   timestampNs, fence) -> {
    agoraAdapter.pushTexture(
        textureId, width, height, timestampNs, fence,
        () -> NosmaiSDK.releaseStreamSlot(textureId)
    );
});

The adapter must wait for the EGL fence before sampling. Release every stream slot after Agora finishes with it, including dropped-frame and error paths.

Stop in the correct order

  1. Stop Agora publishing so it cannot request another frame.
  2. Clear the Nosmai texture callback.
  3. Return Nosmai to PREVIEW_ONLY.
  4. Leave the channel and release Agora when the session ends.
NosmaiSDK.setTextureFrameCallback(null);
NosmaiSDK.setRenderMode(NosmaiSDK.RenderMode.PREVIEW_ONLY);

Common errors

SymptomCauseFix
Local preview works but remote video is blackThe EGL share context was registered too lateCreate Agora and call setAgoraShareContext before Nosmai initialization
Stream stalls after several framesTexture slots are not returnedCall releaseStreamSlot on success, drop, and error paths
Remote video is croppedEncoder dimensions or orientation do not match the pushed framesKeep the provider configuration aligned with actual output

Verify it worked

Apply a visible effect, join from a second device, and confirm the remote video is filtered, correctly oriented, and stable through camera switch 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