This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void Join() | |
{ | |
mRtcEngine.EnableVideo(); | |
mRtcEngine.EnableVideoObserver(); | |
myView.SetEnable(true); | |
mRtcEngine.JoinChannel(ChannelName, "", 0); | |
} | |
void Leave() | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void OnApplicationQuit() | |
{ | |
if (mRtcEngine != null) | |
{ | |
IRtcEngine.Destroy(); | |
mRtcEngine = null; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void OnJoinChannelSuccessHandler(string channelName, uint uid, int elapsed) | |
{ | |
// can add other logics here, for now just print to the log | |
Debug.LogFormat("Joined channel {0} successful, my uid = {1}", channelName, uid); | |
} | |
void OnLeaveChannelHandler(RtcStats stats) | |
{ | |
myView.SetEnable(false); | |
if (remoteView != null) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void SetupAgora() | |
{ | |
mRtcEngine = IRtcEngine.GetEngine(AppID); | |
mRtcEngine.OnUserJoined = OnUserJoined; | |
mRtcEngine.OnUserOffline = OnUserOffline; | |
mRtcEngine.OnJoinChannelSuccess = OnJoinChannelSuccessHandler; | |
mRtcEngine.OnLeaveChannel = OnLeaveChannelHandler; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void SetupUI() | |
{ | |
GameObject go = GameObject.Find("MyView"); | |
myView = go.AddComponent<VideoSurface>(); | |
go = GameObject.Find("LeaveButton"); | |
go?.GetComponent<Button>()?.onClick.AddListener(Leave); | |
go = GameObject.Find("JoinButton"); | |
go?.GetComponent<Button>()?.onClick.AddListener(Join); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public string AppID; | |
public string ChannelName; | |
VideoSurface myView; | |
VideoSurface remoteView; | |
IRtcEngine mRtcEngine; | |
void Awake() | |
{ | |
// SetupUI(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#region =========== Push Video ================= | |
public const TextureFormat ConvertFormat = TextureFormat.BGRA32; // RGBA will be compatible with Web | |
public const VIDEO_PIXEL_FORMAT PixelFormat = VIDEO_PIXEL_FORMAT.VIDEO_PIXEL_BGRA; // note: RGBA is available from v3.0.1 and on | |
Texture2D BufferTexture; | |
bool _isRunning; | |
IEnumerator CoShareRenderData() | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[SerializeField] | |
private GameObject avatarVideoPrefab; | |
// Create new image plane to display users in party. | |
private void CreateUserVideoSurface(uint uid, bool isLocalUser, bool isAvatar) | |
{ | |
// Avoid duplicating Local player VideoSurface image plane. | |
for (int i = 0; i < playerVideoList.Count; i++) | |
{ | |
if (playerVideoList[i].name == uid.ToString()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using UnityEngine.UI; | |
using System.Collections.Generic; | |
public class AvatarViewController : MonoBehaviour | |
{ | |
[SerializeField] | |
Dropdown EffectDropdown; | |
[SerializeField] | |
GameObject EffectsParent; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
. | |
├── Android | |
│ ├── AgoraRtcEngineKit.plugin | |
│ │ ├── AndroidManifest.xml | |
│ │ ├── AndroidManifest.xml.meta | |
│ │ ├── libs | |
│ │ │ ├── PLACEHOLDER | |
│ │ │ ├── PLACEHOLDER.meta | |
│ │ │ ├── agora-rtc-sdk.jar | |
│ │ │ ├── agora-rtc-sdk.jar.meta |