logo
Video Call
On this page

Instant Opening Solution for Show Live Streaming

2024-09-27

Feature Overview

In the show live streaming scenario, instant opening is achieved by optimizing the audience's stream playing speed. The advantage of instant opening compared to the normal stream playing process is that it does not rely on the successful login Room status. The stream playing is initiated at the same time as the Room login is initiated to speed up the stream playing. The following is a comparison between the normal stream playing and instant opening process.

Prerequisites

Before implementing the instant opening solution for show live streaming, 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 your project and implemented basic audio and video streaming functionality. For details, please refer to Quick Start - Integration and Quick Start - Implementation.

  • Before playing stream, the stream ID has been obtained, and it must be ensured that the host is in the broadcasting status. The broadcasting status is managed by the business side.

    Notes

    The playing stream side needs to know the stream ID in advance, usually by splicing the stream ID according to fixed rules (for example, splicing in the roomId_userId manner), or the room information obtained in advance by the business side adds the stream ID parameter.

Implementation Process

Initialization

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

// Create a ZegoExpress instance and listen for common events
void createEngine() {
    // Create an engine, access the general scenario, and register self as the eventHandler callback
    // If you don't need to register a callback, the eventHandler parameter can be passed null, and you can call the "setEventHandler:" method later to set the callback
    ZegoEngineProfile profile = new ZegoEngineProfile();
    profile.appID = appID;  // Please obtain through official website registration, format: 1234567890L
    profile.appSign = appSign; // Please obtain through official website registration, format: @"0123456789012345678901234567890123456789012345678901234567890123" (64 characters in total)
    profile.scenario = ZegoScenario.BROADCAST;  // Specify the use of the live streaming scenario (please fill in the scenario suitable for your business according to the actual situation)
    profile.application = getApplication();
    engine = ZegoExpressEngine.createEngine(profile, null);
}

Login Room

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

ZegoUser userInfo = new ZegoUser(userID, userName);
ZegoRoomConfig roomConfig = new ZegoRoomConfig();
roomConfig.isUserStatusNotify = true; //Room real-time notification of user count changes.
engine.loginRoom(roomID, userInfo, roomConfig);

Audience Playing Stream

After logging in to the Room, without relying on the successful login Room status, you can initiate stream playing at the same time as initiating Room login to speed up stream playing and achieve the instant opening effect.

Notes
  • It is recommended that developers use Low-Latency Live Streaming (L3) for playing streams to achieve a higher quality live streaming experience. For details, please refer to Low-Latency Live Streaming.
  • When developers use the CDN configured by ZEGO 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.
ZegoCanvas zegoCanvas = new ZegoCanvas(view);
zegoCanvas.viewMode = ZegoViewMode.ASPECT_FILL;
// For specific playing methods, please refer to L3 playing, RTC playing, CDN playing
engine.startPlayingStream(streamID, zegoCanvas);

Previous

Switching from CDN Playing Stream to Co-hosting Scenario

Next

Implement Call Invitation

On this page

Back to top