2017-01-23 5 views
0

Google VR SDK for Unity과 함께 제공되는 SDK와 함께 제공되는 구성 요소를 사용하여 간단한 360 비디오 뷰어를 제작하고 있습니다. 사용자가 메뉴에서 탐색 할 때 소스 비디오를 동적으로 변경하기 위해 PanoVideoSample을 확장하려고합니다.Google VR SDK (Unity) - GvrVideoPlayerTexture 스왑 URL

코드를 통해 GvrVideoPlayerTexture의 URL을 변경하는 데 문제가 있습니다. 데모 장면 (VideoDemo)에는 Video Sphere가 포함 된 PanoVideoSample이 있습니다.이 Sphere는 인스펙터 패널의 GVRVideoPlayerTexture 스크립트를 편집하여 적절한 비디오 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); 

} 

위의 코드는 작동하는 것 같다,하지만 URL을 설정 한 후 videoSphere 흰색으로 변하고 텍스처가 다시 ​​초기화에 문제가 질감입니다. 새로운 비디오가로드되고 새 비디오의 오디오를들을 수 있지만 장면에는 흰색 텍스처가 표시됩니다. 나는이 장면을 렌더링하는 데 사용되는 StereoPanoSphereMaterial를 업데이트 GvrVideoPlayerTexture 혹은 추가 통화에 중요한 단계를 누락하는 경우 See the output here

궁금하네요. 이 SDK는 꽤 새로 워서 많은 사람들이 그것에 대해 글을 쓰고있는 것 같지 않으므로 어떤 도움을 주시면 감사하겠습니다.

답변

0

결국 Google VR 문서 (Streaming Video Support)의 설명서에서 제 질문에 대한 답변을 찾았습니다. 첫 번째 시도에서 내가 뭘 잘못하고 있었는지 아직 명확히 알 수는 없지만 이것이 저에게 효과가있는 코드입니다.

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();