SCRtcMe.cs 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Runtime.InteropServices;
  5. using UnityEngine;
  6. using UnityEngine.UI;
  7. public class SCRtcMe
  8. {
  9. [DllImport("NativeCameraPlugin")]
  10. public static extern void SetTextureLocal(System.IntPtr texture);
  11. [DllImport("NativeCameraPlugin")]
  12. private static extern IntPtr GetLocalEventFunc();
  13. public string peerId;
  14. public string cId;
  15. public Texture2D tex;
  16. public string cIdV = "";
  17. public string cIdA = "";
  18. public int TextureID;
  19. public void updateTexture()
  20. {
  21. #if UNITY_ANDROID && !UNITY_EDITOR
  22. if (TextureID != 0)
  23. {
  24. GL.IssuePluginEvent(GetLocalEventFunc(), TextureID);
  25. }
  26. else
  27. {
  28. }
  29. #endif
  30. }
  31. public virtual void setMyCamera(Texture myRenderTexture)
  32. {
  33. #if UNITY_ANDROID && !UNITY_EDITOR
  34. TextureID = myRenderTexture.GetNativeTexturePtr().ToInt32();
  35. SetTextureLocal(myRenderTexture.GetNativeTexturePtr());
  36. #endif
  37. }
  38. }