无法加入Agora.io和Unity Standalone频道(警告代码:104)



我已经有几天没有尝试以任何方式连接Unity中的Agora.io SDK了。我是Agora的新手,我刚刚开始学习如何使用它,我尝试了基本上所有的教程来学习如何使用SDK,但我无法使它以任何方式工作。

以下是我所做的步骤:

  1. 创建了一个新的Agora帐户
  2. 已创建新的appID(已尝试使用和不使用令牌(
  3. 在团结中创建了一个新的空项目
  4. 从资产存储导入SDK
  5. 设置appID,如果被问及令牌(取决于该项目是空项目还是GitHub上的示例项目(
  6. 尝试连接/加入通道
  7. 获取以下错误:警告代码:104消息:查找通道超时(服务器无响应(

这些是我遵循的教程:

  • https://www.youtube.com/watch?v=uxIQOZr6RiU
  • https://www.agora.io/en/blog/agora-video-sdk-for-unity-quick-start-programming-guide/
  • https://docs.agora.io/en/Video/start_call_unity?platform=Unity
  • https://docs.agora.io/en/Video/run_demo_video_call_unity?platform=Unity
  • https://medium.com/agora-io/how-to-create-a-video-chat-app-in-unity-26780b479a78
  • https://www.agora.io/en/blog/how-to-embed-group-video-chat-in-your-unity-games/?utm_source=twitter&utm_medium=社交&utm_campaign=将群组视频聊天嵌入到团结中

这真的很令人沮丧,我真的不知道还能做什么。此外,我试图打开电脑上的防火墙端口或禁用防病毒软件,但没有成功。(在另一个项目中使用了相同版本的Unity,我使用Mirror,它有效,没有任何东西阻止它(

如果有用的话,下面是我遵循的教程代码:

using agora_gaming_rtc;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
namespace Agora_tutorial
{
public class AgoraChat : MonoBehaviour
{
public string AppID;
public string ChannelName;
VideoSurface myView;
VideoSurface remoteView;
IRtcEngine mRtcEngine;
void Awake()
{
SetupUI();
}
void Start()
{
SetupAgora();
}
void SetupUI()
{
GameObject go = GameObject.Find("MyView");
myView = go.AddComponent<VideoSurface>();
go = GameObject.Find("JoinButton");
if (go != null)
{
Button objectButton = go.GetComponent<Button>();
objectButton.onClick.AddListener(Join);
}
go = GameObject.Find("LeaveButton");
if (go != null)
{
Button objectButton = go.GetComponent<Button>();
objectButton.onClick.AddListener(Leave);
}
}
void SetupAgora()
{
mRtcEngine = IRtcEngine.GetEngine(AppID);
// Callbacks for the local user
mRtcEngine.OnJoinChannelSuccess = OnJoinChannelSuccessHandler;      // When the local user joins the channel successfully
mRtcEngine.OnLeaveChannel = OnLeaveChannelHandler;                  // When the local user leaves the channel
// Callbacks for the remote users
mRtcEngine.OnUserJoined = OnUserJoined;                             // When the remote user joins the channel
mRtcEngine.OnUserOffline = OnUserOffline;                           // When the remote user leaves the channel
}
public void Join()
{
Debug.Log($"Joining");
mRtcEngine.EnableVideo();
mRtcEngine.EnableVideoObserver();
myView.SetEnable(true);
mRtcEngine.JoinChannel(ChannelName, "", 0);
}
public void Leave()
{
Debug.Log($"Leaving");
mRtcEngine.LeaveChannel();
mRtcEngine.DisableVideo();
mRtcEngine.DisableVideoObserver();
}
private 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)
{
// Turn off the rendering, otherwise, the last frame of the camera video will stay on the RawImage.
myView.SetEnable(false);
if (remoteView != null)
{
remoteView.SetEnable(false);
}
}
void OnUserJoined(uint uid, int elapsed)
{
GameObject go = GameObject.Find("RemoteView");
if (remoteView == null)
{
remoteView = go.AddComponent<VideoSurface>();
}
remoteView.SetForUser(uid);
remoteView.SetEnable(true);
remoteView.SetVideoSurfaceType(AgoraVideoSurfaceType.RawImage);
remoteView.SetGameFps(30);
}
void OnUserOffline(uint uid, USER_OFFLINE_REASON reason)
{
remoteView.SetEnable(false);
}
void OnApplicationQuit()
{
if (mRtcEngine != null)
{
IRtcEngine.Destroy();
mRtcEngine = null;
}
}
}
}

但当我按下联接按钮时,只有一个按钮调用(联接方法(,并且没有调用回调OnJoinChannelSuccessHandler。

感谢您的联系。首先,让我们运行基本的演示。

  1. 创建一个新的Unity项目,下载Agora视频SDK,并从我们的基础演示项目开始
  2. 将SDK导入Unity,并导航到Assets>AgoraEngine>演示>SceneHome。你已经拥有了开始所需的一切,你只需要将你的AppID添加到GameController对象>TestHome脚本
  3. 选择文件>生成设置。。。并将SceneHome(0(和SceneHelloVideo(1(添加到"构建中的场景"部分(这很可能是出现问题的地方(

一旦你开始工作:请尝试查看此Github Repo。它将带你进入许多可以用来开始的项目。

你很快就会成为Agora职业选手!

相关内容

  • 没有找到相关文章

最新更新