Skip to content

Instantly share code, notes, and snippets.

View icywind's full-sized avatar

Rick Cheng icywind

View GitHub Profile
Assets/
├── Editor
│   ├── BL_BuildPostProcess.cs
│   └── BL_BuildPostProcess.cs.meta
├── Editor.meta
├── Plugins
│   ├── Android
│   │   ├── AgoraRtcEngineKit.plugin
│   │   │   ├── AndroidManifest.xml
│   │   │   ├── AndroidManifest.xml.meta
using UnityEngine;
using UnityEngine.UI;
using agora_gaming_rtc;
using agora_utilities;
using System;
using System.Collections;
// this is an example of using Agora Unity SDK
@icywind
icywind / TestHelloUnityVideo.cs
Created May 30, 2020 00:01
Updated Demo project script to push external audio
using UnityEngine;
using UnityEngine.UI;
using agora_gaming_rtc;
using agora_utilities;
using System;
using System.Collections;
// this is an example of using Agora Unity SDK
@icywind
icywind / ShareScreenMac.mm
Last active December 3, 2021 03:32
A library source to return a list of screen ids
//
// ShareScreenMac.mm
// ShareScreenLib
//
// Created by Rick Cheng on 4/17/20.
// Copyright © 2020 Agora. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <AppKit/AppKit.h>
@icywind
icywind / RAAR_IVideoChatClient.cs
Created April 3, 2020 19:03
The IVideoChatClient interface
public interface IVideoChatClient
{
void join(string channel);
void leave();
void loadEngine(string appId);
void unloadEngine();
void onSceneLoaded();
void EnableVideo(bool enable);
}
@icywind
icywind / AgoraPushFrame.cs
Last active March 17, 2021 18:27
How to push external video source frame with a coroutine
// Push frame to the remote client
IEnumerator PushFrame(byte[] bytes, int width, int height, System.Action onFinish)
{
if (bytes == null || bytes.Length == 0)
{
Debug.LogError("Zero bytes found!!!!");
yield break;
}
IRtcEngine rtc = IRtcEngine.QueryEngine();
@icywind
icywind / RAAR_JoinChannel.cs
Created April 3, 2020 18:14
Joining a channel in AR Client
public void join(string channel)
{
Debug.Log("calling join (channel = " + channel + ")");
if (mRtcEngine == null)
return;
// set callbacks (optional)
mRtcEngine.OnJoinChannelSuccess = onJoinChannelSuccess;
mRtcEngine.OnUserJoined = onUserJoined;
@icywind
icywind / DrawDots.cs
Created March 23, 2020 23:36
Method to draw the dots from the given position
int dotCount = 0;
/// <summary>
///
/// </summary>
/// <param name="pos">Screen Position</param>
void DrawDot(Vector2 pos)
{
if (anchorGO == null)
{
anchorGO = new GameObject();
@icywind
icywind / CoProcessDrawing.cs
Created March 23, 2020 22:31
Method to send the data
IEnumerator CoProcessDrawing(DrawmarkModel dm)
{
string json = JsonUtility.ToJson(dm);
if (dataStreamId > 0)
{
rtcEngine.SendStreamMessage(dataStreamId, json);
}
yield return null;
}
@icywind
icywind / RAAR_DrawmarkModel.cs
Created March 23, 2020 21:18
A model for drawing points
[Serializable]
public class DrawmarkModel
{
public Color color;
public List<Vector2> points;
}