Skip to main content

Starting March 27, 2026, RC is rebranded as Nexconn. Existing RC SDK customers can continue using this documentation. New customers should refer to the Nexconn developer documentation.

Publishing Custom Resources

tip

On Android, you must first successfully publish an audio resource by calling publish(RCRTCMediaType.audio_video) or publish(RCRTCMediaType.audio), then publishing a custom video stream will take effect. The tag cannot contain _ or RongCloudRTC characters.

Creating Custom Video Resources

  • Sample code:

    /// Create a custom video resource from an asset file
    engine.createCustomStreamFromAssetsFile(path, tag);

    /// Create a custom video resource from a local file
    engine.createCustomStreamFromFile(path, tag);

Setting Custom Video Attributes

  • Sample code:

    RCRTCVideoConfig config = RCRTCVideoConfig.create(
    minBitrate: 500,
    maxBitrate: 2200,
    fps: RCRTCVideoFps.fps_24,
    resolution: RCRTCVideoResolution.resolution_720_1280,
    );
    engine.setCustomStreamVideoConfig(tag, config);

Setting Preview Window for Custom Video Resources

  • Sample code:

    RCRTCView view = await RCRTCView.create();
    engine.setLocalCustomStreamView(tag, view);

Publishing Custom Video Resources

  • Sample code:

    engine.publishCustomStream(tag);

Setting Remote Custom Video Resource Publication Listener

  • Sample code:

    engine.onRemoteCustomStreamPublished = (String roomId, String userId, String tag, RCRTCMediaType type) {
    // roomId: Room ID
    // userId: Remote user ID
    // tag: Remote custom video resource tag
    // type: Resource type
    };

Subscribing to Remote Custom Video Resources

  • Sample code:

    engine.subscribeCustomStream(userId, tag);

Setting Preview Window for Remote Custom Video Resources

  • Sample code:

    RCRTCView view = await RCRTCView.create();
    engine.setRemoteCustomStreamView(userId, tag, view);