using LitJson; using System; using System.Collections; using System.Collections.Generic; using System.Runtime.InteropServices; using UnityEngine; using UnityEngine.UI; public class SCRtcPeer { [DllImport("NativeCameraPlugin")] public static extern void SetTextureFromUnity(System.IntPtr texture); [DllImport("NativeCameraPlugin")] private static extern IntPtr GetRenderEventFunc(); public string name; public string peerId; public string avater; public bool isSn; public string cIdV=""; public bool isAudio; public bool isVideo; public string cIdA=""; public Texture2D tex; public int FPS = 0; public float volumn = 0.5f; private int TextureID; public virtual void setTexture(JsonData data) { this.tex = new Texture2D(int.Parse(data["data"]["data"]["w"].ToString()), int.Parse(data["data"]["data"]["h"].ToString()), TextureFormat.RGB24, false); TextureID = this.tex.GetNativeTexturePtr().ToInt32(); SetTextureFromUnity(this.tex.GetNativeTexturePtr()); SCRtcFactory.Instance.mSCRtcHandle.addTextureID(this.cIdV, TextureID); } public virtual void changeVolumn(int v) { volumn = v; } public virtual void setName(string n) { name = n; } public virtual void changeTexture(JsonData data) { setTexture(data); } public virtual void updateTexture() { if (TextureID != 0) { GL.IssuePluginEvent(GetRenderEventFunc(), TextureID); } } public virtual void setInfo(string type, string id,bool isOpen) { if (type == "video") { Debug.Log("huan......"); this.cIdV = id; isVideo = isOpen; } else { this.cIdA = id; isAudio = isOpen; } } }