Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice
  2. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  3. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

[5.6.0b1] VideoPlayer API go to specific frame

Discussion in '5.6 Beta' started by Bulwark-Studios, Dec 16, 2016.

  1. Bulwark-Studios

    Bulwark-Studios

    Joined:
    Sep 20, 2013
    Posts:
    18
    Hello!

    Thanks for the new VideoPlayer API.

    I'm trying to jump in a video at some specifics frames (forward or backward of the current frame) of a video with an UIButton.

    The problem is when I try to set the VideoPlayer.frame or VideoPlayer.time property, the RawImage that display the video is not updated. Only the first frame of the video is displayed.
    When I log the player.frame and player.time, their values are correctly updated.
    Also I tried to use the StepForward() method and it works great.

    Is there a way to update the render when setting a specific frame ?

    There is my test script :
    Code (CSharp):
    1. public class VideoAPITest : MonoBehaviour {
    2.  
    3.     public VideoPlayer player;
    4.  
    5.     public RawImage rawImage;
    6.  
    7.     void Start () {
    8.         player.prepareCompleted += PrepareCompleted;
    9.         player.Prepare();
    10.         player.playbackSpeed = 1f;
    11.     }
    12.  
    13.     void PrepareCompleted(VideoPlayer videoPlayer) {
    14.  
    15.         player.prepareCompleted -= PrepareCompleted;
    16.         Debug.Log("frameCount " + player.frameCount);
    17.  
    18.         player.frame = 200;
    19.         //player.Play();
    20.         player.Pause();
    21.         //player.Stop();
    22.     }
    23.  
    24.     public void OnBtnClick() {
    25.  
    26.         Debug.Log("frame " + player.frame);
    27.         Debug.Log("time " + player.time);
    28.  
    29.         player.frame += 30;
    30.         //player.Pause();
    31.         //player.time += 1d;
    32.         //player.StepForward();
    33.  
    34.     }
    35.  
    36. }
    Thank you!

    Bulwark Studios
     
  2. DominiqueLrx

    DominiqueLrx

    Unity Technologies

    Joined:
    Dec 14, 2016
    Posts:
    260
    Hi!

    On Windows (for H.264-based codecs) and for all platforms (for webm), we did find that the seek was broken in a recent test pass. This will be fix in a future beta. Can you let us know what platform you are working on, just so we're sure this really is the same bug?

    Thanks for reporting this!

    Dominique
     
  3. Bulwark-Studios

    Bulwark-Studios

    Joined:
    Sep 20, 2013
    Posts:
    18
    Hi!

    I tried on a Windows 10 64bits machine in the Unity Editor and a PC Standalone build and it doesn't work.

    I launched the same project on a Mac and it works so I assume it's the same bug.

    Thanks
    Bulwark Studios
     
  4. shawww

    shawww

    Joined:
    Sep 30, 2014
    Posts:
    43
    It's been a few months -- any update on this? We really, really need this feature, and it's silly that it works fine on the Mac in development but not at all on our PC builds.
     
    lorella124, J-Luna and fightthestroke like this.