Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Errors after leaving video call and joining again #38

Open
arpan-dirtcube opened this issue Oct 26, 2021 · 3 comments
Open

Errors after leaving video call and joining again #38

arpan-dirtcube opened this issue Oct 26, 2021 · 3 comments

Comments

@arpan-dirtcube
Copy link

arpan-dirtcube commented Oct 26, 2021

Getting this errors after leaving existing video call and any of the client leaves and try to join again.
Below is Leave function called on ui click.
public void Leave() { if (mRtcEngine == null) return; mRtcEngine.LeaveChannel(); mRtcEngine.DisableVideoObserver(); }

This is the error logged every frame.
"You didn't initialize native texture, please remove native texture and initialize it by agora.
UnityEngine.Debug:LogError (object)
agora_gaming_rtc.VideoSurface:Update () (at Assets/AgoraEngine/Scripts/AgoraGamingSDK/videoRender/VideoSurface.cs:148)"

@zhangtao1104
Copy link
Collaborator

You need to destroy the VideoSurface which you renderer the videoframe before.

You need to confirm that the Gameobject which you renderer the Video does not contain the texutre .
agora will create a native texture for your gameobject by VideoSurface.cs.

@arpan-dirtcube
Copy link
Author

this is what is being called after above code.
'selfview' is gameobject where rawimage component is added.
Destroy(_selfView.GetComponent<VideoSurface>()); selfView.GetComponent<RawImage>().texture = null;

@jukeboxplays
Copy link

jukeboxplays commented Sep 20, 2022

To solve this here, I did the steps below:

  1. If you are using delegates like ChannelOnJoinChannelSuccess, ChannelOnLeaveChannel or anything like that, in order to initialize/stop video, don't forget to unsubscribe any function on leave. In my case, I am doing something like ChannelOnJoinChannelSuccess += MyJoinFunction; ChannelOnLeaveChannel += MyLeaveFunction; when I join. And ChannelOnJoinChannelSuccess -= MyJoinFunction; ChannelOnLeaveChannel -= MyLeaveFunction; when I leave.
  2. As I am using Renderer, instead of RawImage, to my VideoSurface, I did selfView.GetComponent<Renderer>().material.mainTexture = null;
  3. Same as yours, but in different order Destroy(_selfView.GetComponent<VideoSurface>());

I hope it helps anyone that was getting the same error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants