Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question Audio/Video stuttering on WebGL

Discussion in 'Audio & Video' started by Stephen_Zeeko, Mar 8, 2023.

  1. Stephen_Zeeko

    Stephen_Zeeko

    Joined:
    Aug 3, 2018
    Posts:
    6
    In my game, built in WebGL on Unity 2021.2.11f1, I play videos on a texture present in the scene, like on an in-world screen. I have a Render Texture set as the target texture of my Video Player, and then a Raw Image in the scene which has that Render Texture as its texture.

    The issue I'm facing is that there is frequently stuttering on either the audio or visuals causing the two to desync when played on lower power machines. Rarely the audio might play without any visuals, or the entire video might just not play.

    I've tried loading the videos by using both URLs and creating Video Clips of them. I've tried both MP4 files and Webm files, testing with all the codecs available in the Unity importer and with all the settings on the Video Player itself. I've reduced the size and quality of the videos as much as I could without much success. Using VideoPlayer.Prepare also has mixed results.

    Are there any other tricks I could try to improve video player performance, or any alternatives to the stock Video Player I could try which might work better?
     
  2. DevDunk

    DevDunk

    Joined:
    Feb 13, 2020
    Posts:
    4,969
    1. Update Unity, that version is old
    2. Check the profiler if there are any performance concerns