void Start() { // render video if (VideoSurfaceType == AgoraVideoSurfaceType.Renderer) { mRenderer = GetComponent <Renderer>(); } if (mRenderer == null || VideoSurfaceType == AgoraVideoSurfaceType.RawImage) { mRawImage = GetComponent <RawImage>(); mRectTrans = GetComponent <RectTransform>(); if (mRawImage != null) { // the variable may have been set to default enum but actually it is a RawImage VideoSurfaceType = AgoraVideoSurfaceType.RawImage; } } if (mRawImage == null && mRenderer == null) { _initialized = false; Debug.LogError("Unable to find surface render in VideoSurface component."); } else { #if UNITY_EDITOR // this only applies to Editor, in case of material is too dark UpdateShader(); #endif _initialized = true; } }
void Start() { // render video if (VideoSurfaceType == AgoraVideoSurfaceType.Renderer) { mRenderer = GetComponent <Renderer>(); } if (mRenderer == null || VideoSurfaceType == AgoraVideoSurfaceType.RawImage) { mRawImage = GetComponent <RawImage>(); if (mRawImage != null) { // the variable may have been set to default enum but actually it is a RawImage VideoSurfaceType = AgoraVideoSurfaceType.RawImage; } } if (mRawImage == null && mRenderer == null) { _initialized = false; Debug.LogError("Unable to find surface render in VideoSurface component."); } else { _initialized = true; } }
void Start() { if (VideoSurfaceType == AgoraVideoSurfaceType.Renderer) { _renderer = GetComponent <Renderer>(); } if (_renderer == null || VideoSurfaceType == AgoraVideoSurfaceType.RawImage) { _renderer = GetComponent <RawImage>(); if (_renderer != null) { VideoSurfaceType = AgoraVideoSurfaceType.RawImage; } } if (_renderer == null) { AgoraLog.LogError("Unable to find surface render in VideoSurface component."); } else { #if UNITY_EDITOR // this only applies to Editor, in case of material is too dark UpdateShader(); #endif } }
/** Set the video renderer type. * * @param agoraVideoSurfaceType The renderer type, see AgoraVideoSurfaceType. */ public void SetVideoSurfaceType(AgoraVideoSurfaceType agoraVideoSurfaceType) { VideoSurfaceType = agoraVideoSurfaceType; }
/** Set the video renderer type. * * @param agoraVideoSurfaceType The renderer type, see AgoraVideoSurfaceType. */ public void SetVideoSurfaceType(AgoraVideoSurfaceType agoraVideoSurfaceType) { Debug.Log($"agoraVideoSurfaceType {agoraVideoSurfaceType}"); VideoSurfaceType = agoraVideoSurfaceType; }