logo
Video Call
On this page

Show Live Streaming Instant Startup Solution

2026-03-05

Feature Introduction

In show live streaming scenarios, achieve instant startup by optimizing the audience's playing stream speed. Compared with the normal playing stream process, the advantage of instant startup playing is that it does not depend on the successful login room status. It initiates playing stream at the same time as initiating room login to accelerate the playing speed. The following is a comparison between normal playing and instant startup playing:

Prerequisites

Before implementing the show live streaming instant startup solution, please ensure:

  • You have created a project in the ZEGOCLOUD Console and applied for a valid AppID and AppSign. For details, please refer to Console - Project Information.

  • You have integrated the ZEGO Express SDK in the project and implemented basic audio and video publishing and playing functions. For details, please refer to Quick Start - Integration and Quick Start - Implementation Flow.

  • Before playing stream, you have obtained the stream ID and need to ensure the host is in the broadcasting status. The broadcasting status is managed by the business side.

    Notes

    The playing end needs to know the stream ID in advance, usually by splicing the stream ID according to fixed rules (such as splicing according to roomId_userId), or the business side obtains the room information in advance and adds the stream ID parameter.

Implementation Flow

1 Initialization

For details, please refer to the "Initialization" section in Quick Start - Implementation Flow.

- (void)createEngine {
    ZegoEngineProfile *profile = [[ZegoEngineProfile alloc] init];
    // Please obtain through official website registration, format: 1234567890
    profile.appID = <#appID#>;
    // Please obtain through official website registration, format: @"0123456789012345678901234567890123456789012345678901234567890123" (64 characters in total)
    profile.appSign = <#appSign#>;
    // Specify to use live streaming scenario (please fill in the scenario suitable for your business according to the actual situation)
    profile.scenario = ZegoScenarioBroadcast;
    // Create engine and register self as eventHandler callback. If you don't need to register callback, the eventHandler parameter can be nil, and you can call the "-setEventHandler:" method later to set the callback
    [ZegoExpressEngine createEngineWithProfile:profile eventHandler:self];
}

2 Login room

For details, please refer to the "Login Room" section in Quick Start - Implementation Flow.

- (void)loginRoom {
    // roomID is generated locally by you, need to ensure "roomID" is globally unique. Different users need to log in to the same room to make calls
    NSString *roomID = @"room1";

    // Create user object, ZegoUser's constructor userWithUserID will set "userName" to be the same as the passed parameter "userID". "userID" cannot be "nil", otherwise room login will fail.
    // userID is generated locally by you, need to ensure "userID" is globally unique.
    ZegoUser *user = [ZegoUser userWithUserID:@"user1"];

    // Only passing ZegoRoomConfig with "isUserStatusNotify" parameter value "true" can receive onRoomUserUpdate callback.
    ZegoRoomConfig *roomConfig = [[ZegoRoomConfig alloc] init];
    //If you use appsign for authentication, the token parameter does not need to be filled; if you need to use a more secure authentication method: token authentication.

    // roomConfig.token = @"<#token#>";

    roomConfig.isUserStatusNotify = YES;
    // Login room
    [[ZegoExpressEngine sharedEngine] loginRoom:roomID user:user config:roomConfig callback:^(int errorCode, NSDictionary * _Nullable extendedData) {
        // (Optional callback) Room login result. If you only care about the login result, just pay attention to this callback
        if (errorCode == 0) {
            NSLog(@"Room login successful");
        } else {
            // Login failed, please refer to errorCode description /real-time-video-ios-oc/client-sdk/error-code
            NSLog(@"Room login failed");
        }
    }];
}

3 Audience playing stream

After logging into the room, without relying on the successful room login status, you can initiate playing stream at the same time as initiating room login to accelerate the playing speed and achieve instant startup effect.

Notes
  • It is recommended that developers use Ultra Low Latency Live Streaming (L3) for playing to achieve a higher quality live streaming experience. For details, please refer to Ultra Low Latency Live Streaming.
  • When developers use ZEGO-configured CDN for direct publishing, they can directly play streams through streamID. Please refer to "Playing Stream" in Quick Start - Implementing Video Call.
  • When developers use third-party CDN for direct publishing, they can play streams through URL. Please refer to Playing Stream by URL.
//For specific playing methods, please refer to L3 playing, RTC playing, CDN playing
[[ZegoExpressEngine sharedEngine] startPlayingStream:streamID canvas:[ZegoCanvas canvasWithView:self.remoteUserView] config:playerConfig];
2024-09-27

Previous

Switching from CDN Playing Stream to Co-hosting Scenario

Next

FAQ

On this page

Back to top