Skip to content

Instantly share code, notes, and snippets.

View larryluoo's full-sized avatar

Larry larryluoo

View GitHub Profile
@larryluoo
larryluoo / InitializeZEGOLive.java
Created August 16, 2022 07:42
InitializeZEGOLive
// The AppID you get from ZEGOCLOUD Admin Console.
long appID = 214124124L;
// Initialize the SDK. We recommend you call this method when the application starts.
// The last parameter refers to the Application object of the ZEGOlive SDK.
ZegoRoomManager.getInstance().init(appID, this);
/** Destroy the ZegoExpressEngine instance */
ZegoExpressEngine.destroyEngine(null);
/** Log out of a room */
engine.logoutRoom("room1");
@larryluoo
larryluoo / stopPlayingStream.java
Created July 29, 2022 07:43
stopPlayingStream
/** Stop playing a stream*/
engine.stopPlayingStream(streamID);
/** Stop local video preview */
engine.stopPreview();
@larryluoo
larryluoo / stopPublishingStream.java
Created July 29, 2022 07:39
stopPublishingStream
/** Stop publishing a stream */
engine.stopPublishingStream();
@larryluoo
larryluoo / startPlayingStream.java
Created July 29, 2022 07:38
startPlayingStream
* Start playing a remote stream with the SDK's default view mode (AspectFill).
* The play_view below is a SurfaceView/TextureView/SurfaceTexture object on UI.
*/
engine.startPlayingStream("stream1", new ZegoCanvas(play_view));
@larryluoo
larryluoo / setEventHandler.java
Created July 29, 2022 07:38
setEventHandler
engine.setEventHandler(new IZegoEventHandler() {
/** Common event callbacks related to stream publishing. */
/** Callback for updates on stream publishing status. */
@Override
public void onPublisherStateUpdate(String streamID, ZegoPublisherState state, int errorCode, JSONObject extendedData){
/** Implement the callback handling logic as needed. */
}
});
@larryluoo
larryluoo / startPublishingStream.java
Created July 29, 2022 07:37
startPublishingStream
/** Start publishing a stream */
engine.startPublishingStream("stream1");
* Set up a view for the local video preview and start the preview with SDK's default view mode (AspectFill).
* The following play_view is a SurfaceView, TextureView, or SurfaceTexture object on the UI.
*/
engine.startPreview(new ZegoCanvas(preview_view));