1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374 |
- using Scenes.scripts.utils;
- using UnityEngine;
- //½ÓÊÕ·½
- public class TextureHelper
- {
- private static string UXR_TEXTURE_Reviever = "Receiver.";
- private static AndroidJavaObject textureHolder;
- public static void Create()
- {
- Debug.Log("TextureHelper Create");
- //´´½¨½ÓÊÕ¶Ë
- new AndroidJavaObject("com.rokid.mrcplugin.codingtransmission.textureholder.TextureHolder");
- }
- public static void Start(string ip,int unityTextureId, int width, int height, int frameRate = 60, int bitRate = 1024)
- {
- Debug.Log($"TextureHelper.Start IP - {ip} TexID - {unityTextureId} Width - {width} Height - {height} FrameRate - {frameRate} BitRate - {bitRate}");
- CallBridge.callAndroid(Request.Build()
- .Name(UXR_TEXTURE_Reviever + "start")
- .Param("ip", ip)
- .Param("unityTextureId", unityTextureId)
- .Param("width", width)
- .Param("height", height)
- .Param("frameRate", frameRate)
- .Param("bitRate", bitRate * 1024));
- textureHolder = CallBridge.callAndroid(Request.Build()
- .Name(UXR_TEXTURE_Reviever + "getInstance"));
- }
- public static void _updateTexture()
- {
- //Debug.Log("TextureHelper _updateTexture");
- textureHolder.Call("updateTexture");
- }
- public static bool _isFrameUpdated()
- {
- if(textureHolder == null)
- {
- return false;
- }
- return textureHolder.Call<bool>("isUpdateFrame");
- }
- public static void Release()
- {
- Debug.Log("TextureHelper.Release");
- CallBridge.callAndroid(Request.Build()
- .Name(UXR_TEXTURE_Reviever + "release"));
- //textureHolder.Call("release");
- }
- //public static void initTCP()
- //{
- // Debug.Log("TextureHelper initTCP");
- // CallBridge.callAndroid(Request.Build()
- // .Name(UXR_TEXTURE_Reviever + "initTCP"));
- //}
- public static void _setTextureModeListener(string callObj, string method)
- {
- CallBridge.callAndroid(Request.Build()
- .Name(UXR_TEXTURE_Reviever + "setTextureModeListener")
- .AndroidCallback(CallBridge.createCallback(callObj, method)));
- }
- }
|