C# Google VR SDK(Unity)-GvrVideoPlayerTexture交换URL

C# Google VR SDK(Unity)-GvrVideoPlayerTexture交换URL,c#,android,unity3d,google-vr,google-vr-sdk,C#,Android,Unity3d,Google Vr,Google Vr Sdk,我正在尝试使用SDK附带的组件构建一个简单的360视频查看器。我试图扩展他们的PanoVideoSample,以便在用户从菜单导航时动态更改源视频 我无法通过代码更改GVRVideoPlayerText的URL。在他们的演示场景(VideoDemo)中,他们有一个包含视频球体的PanoVideoSample,您可以在inspector面板中编辑GVRVideoPlayerText脚本,以指向正确的视频URL 我想在C#中动态设置视频URL,而不是硬编码一堆单独的视频球体,然后隐藏/显示它们。我几

我正在尝试使用SDK附带的组件构建一个简单的360视频查看器。我试图扩展他们的PanoVideoSample,以便在用户从菜单导航时动态更改源视频

我无法通过代码更改GVRVideoPlayerText的URL。在他们的演示场景(VideoDemo)中,他们有一个包含视频球体的PanoVideoSample,您可以在inspector面板中编辑GVRVideoPlayerText脚本,以指向正确的视频URL

我想在C#中动态设置视频URL,而不是硬编码一堆单独的视频球体,然后隐藏/显示它们。我几乎已经用下面的代码实现了这一点

public void SwapVideo(int index){

    videoSphere.GetComponentInChildren<GvrVideoPlayerTexture> ().videoURL = urls [index];// my new url 
    videoSphere.GetComponentInChildren<GvrVideoPlayerTexture>().ReInitializeVideo ();
    videoSphere.SetActive (true);

}

public void ReturnToMainMenu(){

    videoSphere.GetComponentInChildren<GvrVideoPlayerTexture>().CleanupVideo();
    videoSphere.SetActive (false);

    this.gameObject.SetActive (true);

}
publicsvoidswapvideo(int索引){
videoSphere.GetComponentChildren().videoURL=url[index];//我的新url
videoSphere.getComponentChildren().ReInitializeVideo();
videoSphere.SetActive(true);
}
public void ReturnToMainMenu(){
videoSphere.getComponentChildren().CleanupVideo();
videoSphere.SetActive(false);
this.gameObject.SetActive(true);
}
上面的代码似乎可以工作,但问题是设置url并重新初始化纹理后,视频球体上的纹理会变为白色。我可以看到新视频加载,我可以听到新视频的音频,但场景只是显示了白色纹理。


我想知道我是否错过了GvrVideoPlayerTexture上的一个关键步骤,或者可能缺少更新用于渲染场景的StereopanSphereMaterial的其他调用。这个SDK是非常新的,似乎没有多少人在写它,所以任何帮助都是非常感谢的

我最终在谷歌VR文档()上找到了我问题的答案。 我仍然不完全清楚我在第一次尝试中做错了什么,但这是对我有用的代码

videoSphere.GetComponentInChildren<GvrVideoPlayerTexture> ().videoURL = urls [index];
    videoSphere.GetComponentInChildren<GvrVideoPlayerTexture> ().videoType = GvrVideoPlayerTexture.VideoType.Other;
    videoSphere.GetComponentInChildren<GvrVideoPlayerTexture> ().videoProviderId = string.Empty;
    videoSphere.GetComponentInChildren<GvrVideoPlayerTexture> ().videoContentID = string.Empty;
    videoSphere.GetComponentInChildren<GvrVideoPlayerTexture> ().CleanupVideo ();
    videoSphere.GetComponentInChildren<GvrVideoPlayerTexture> ().ReInitializeVideo ();
videoSphere.getComponentChildren().videoURL=URL[index];
videoSphere.getComponentChildren().videoType=gvrvideoplayerText.videoType.Other;
videoSphere.GetComponentChildren().videoProviderId=string.Empty;
videoSphere.GetComponentChildren().videoContentID=string.Empty;
videoSphere.getComponentChildren().CleanupVideo();
videoSphere.getComponentChildren().ReInitializeVideo();

我最终在谷歌VR文档()中找到了我问题的答案。 我仍然不完全清楚我在第一次尝试中做错了什么,但这是对我有用的代码

videoSphere.GetComponentInChildren<GvrVideoPlayerTexture> ().videoURL = urls [index];
    videoSphere.GetComponentInChildren<GvrVideoPlayerTexture> ().videoType = GvrVideoPlayerTexture.VideoType.Other;
    videoSphere.GetComponentInChildren<GvrVideoPlayerTexture> ().videoProviderId = string.Empty;
    videoSphere.GetComponentInChildren<GvrVideoPlayerTexture> ().videoContentID = string.Empty;
    videoSphere.GetComponentInChildren<GvrVideoPlayerTexture> ().CleanupVideo ();
    videoSphere.GetComponentInChildren<GvrVideoPlayerTexture> ().ReInitializeVideo ();
videoSphere.getComponentChildren().videoURL=URL[index];
videoSphere.getComponentChildren().videoType=gvrvideoplayerText.videoType.Other;
videoSphere.GetComponentChildren().videoProviderId=string.Empty;
videoSphere.GetComponentChildren().videoContentID=string.Empty;
videoSphere.getComponentChildren().CleanupVideo();
videoSphere.getComponentChildren().ReInitializeVideo();