# SetExternalRemoteEglContext (/zh-CN/api-reference/rtc/csharp-windows/api-irtcengine-setexternalremoteeglcontext)
> For AI agents: see the complete documentation index at [llms.txt](/llms.txt).
```csharp
public abstract int SetExternalRemoteEglContext(IntPtr eglContext);
```
通过设置该方法,开发者可以替换 SDK 内部默认的远端 EGL 环境上下文,便于实现统一的 EGL 上下文管理。
引擎销毁时,SDK 会自动释放 EGL 环境上下文。
## 适用场景 [#适用场景]
该方法适用于使用 Texture 格式的视频数据进行远端视频自渲染的场景。
## 调用时机 [#调用时机]
该方法需要在加入频道前调用。
## 调用限制 [#调用限制]
无。
## 参数 [#参数]
### `eglContext` [#eglcontext]
用于远端视频流渲染的 EGL 环境上下文对象。
## 返回值 [#返回值]
- 0: 方法调用成功。
- < 0: 方法调用失败。 详见 [错误码](/zh-CN/realtime-media/rtc/reference/error-code) 了解详情和解决建议。