Search Unity

Video stops playing (picture is still) but audio keeps going

Discussion in 'Daydream' started by SpingDeveloper, Feb 5, 2018.

  1. SpingDeveloper

    SpingDeveloper

    Joined:
    Nov 21, 2017
    Posts:
    13
    Hi Guys,

    I have an issue with videoplayback in using the latest GoogleVR SDK and Unity3D version 2017.3.0f3. I'm only using Google Pixel 2's on Android 8.1.0 and Google Daydreams for a project.

    I'm having an issue with the GVRVideoPlayerTexture where the video stops playing due to buffering but the audio keeps playing. So we have over 20 scenes each with a GoogleVR setup and using a sphere with a GVRVideoPlayerTexture script attached which points to a 4k stereoscopic vr video (around 700MB / 800MB). The first time the video is played everything works fine. The user navigates to the next scene and then almost always the video stops playing at around 0:03 seconds (the picture stops moving) but the audio keeps playing. It seems to happen sometimes with the first video played as well. There are no errors in the Android logcat or in the Unity3D console.
    I've tried debugging it by putting a Debug.Log statement in the Update() method of the GvrVideoPlayerTexture.cs class and debugging the BufferedPosition and as I assumed this not updated with a new value. It's like it just stops buffering all together.
    The only way for the user to fix it for now is use our rewind feature in our video controls to rewind the video to the beginning and press play again. Then everything works fine and the video + audio keeps playing.

    During development I did change the following:
    Instead of loading the video from the StreamingAssets i'm loading the video from a folder on the sdcard of the Google Pixel by calling the following code:

    string videoURL = "file://" + GetAndroidInternalFilesDir() + "/PVMMovies/" + videoName; Debug.Log("Trying to load video: " + videoURL); gvrVideoPlayerTexture.videoURL = videoURL;

    GetAndroidInternalFilesDir basically returns the SDCard directory on the device. The videoName is returned from a database. This script is executed before the GVRVideoPlayer script initializes.


    I've also made an issue on the GoogleVR Unity3D github:
    https://github.com/googlevr/gvr-unity-sdk/issues/846

    Anybody has an idea?
     
  2. HeyBishop

    HeyBishop

    Joined:
    Jun 22, 2017
    Posts:
    238
    I was having a similar problem. My h264 mp4 videos were encoded using Main Profile, when I encoded again with Baseline Profile, it worked!
     
  3. HeyBishop

    HeyBishop

    Joined:
    Jun 22, 2017
    Posts:
    238
    Okay... looks like I spoke too soon. My problem wasn't entirely resolved by my above suggestion. It's made things play smooth... when they play.

    For me, I'm frozen on frame 0 - unless I change the Delay to something greater than 0 with the AutoPlayVideo script. If I leave it at the default 2 seconds, then it plays totally fine - but my audio (on other game objects) plays right at frame 0, so I've got a 2 second delay.

    So, my hunch is that the 2sec delay that the AutoPlayVideo script does allows for some sort of important buffering to happen. This leads me to believe I'm having a buffer problem like you, @SpingDeveloper

    Alternatively, I could delay the start of my audio sources. But I'm not sure how to do that.
     
    Last edited: Mar 4, 2018