You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Unity C#中Android平台Video Player启动前黑屏闪烁问题求助

Unity Android端Video Player播放MP4前黑屏闪烁问题求助

这是我首次在论坛求助,希望能得到帮助。

当前遇到的问题是:场景加载后,我使用Unity的Video Player播放MP4视频,搭配Raw Image和RenderTexture实现。在编辑器及BlueStacks模拟器中运行正常,但在Android设备上,视频启动前会出现约1秒的黑屏闪烁,之后视频才能正常播放,该现象每次都会发生。我是Video Player的新手,不清楚问题所在,已通过代码分配纹理。

组件设置截图:
Video Player组件设置截图

代码实现如下:

void Start()
{
    renderTextureFirstVideo = new CustomRenderTexture(1080, 1920);
    renderTextureFirstVideo.initializationColor = new Color(0f, 0f, 0f, 0f);

    renderTextureLoopVideo = new CustomRenderTexture(1080, 1920);
    renderTextureLoopVideo.initializationColor = new Color(0f, 0f, 0f, 0f);

    time = _FirstVideo.clip.length;
    Timing.RunCoroutine(IShowVideo());
}

private IEnumerator<float> IShowVideo()
{
    yield return Timing.WaitForSeconds(1f);
    _FirstVideoRawImage.texture = renderTextureFirstVideo;
    _FirstVideo.targetTexture = _FirstVideoRawImage.texture as RenderTexture;
    _FirstVideo.gameObject.SetActive(true);
    _FirstVideo.Play();

    yield return Timing.WaitForSeconds((float)time);

    _LoopVideoRawImage.texture = renderTextureLoopVideo;
    _LoopVideo.targetTexture = _LoopVideoRawImage.texture as RenderTexture;
    _LoopVideo.gameObject.SetActive(true);
    _LoopVideo.Play();
}

恳请各位告知如何解决该问题,让视频能够正常启动。


内容的提问来源于stack exchange,提问作者Urba

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.15 23:25:17