Hi. Looked everywhere through the docs, forums and elsewhere and can’t find the answer to this simple question: does the native Unity Video Player component support true seamless video looping by design?
To be clear, I’m not talking about automatically restarting playback at the end of track. As in automatically calling VideoPlayer.Play() at the end of track. This will inevitably cause visually noticeable hiccups as the codec needs to restart video asset streaming, re-parse video container, pre-cache a portion of decoded video before the first frame is available for rendering.
What I’m talking about is a true seamless loop where Video Player, providing VideoPlayer.Loop is set, after decoding and buffering the last video frame in the track will instantly seek back to frame 0 and start decoding that. So that no artificial visual gaps present when the track restarts.
Specifically asking about a simplified case with local packaged video assets only and no audio, just video.
I obviously tried experimenting before asking here and I couldn’t see any visual gaps when looping a seamless video track. At least it worked perfectly fine in 2022.3 on my Mac and iPhone devices. However it is not clear whether it works because my test devices are powerful enough to handle video stream restart within a duration of one frame or because the Video Player is indeed implementing true seamless looping. Same kind of test used to produce horrible noticeable video stutters when I tried it few years ago with older Unity version. Fear whether this will hold for other platforms and esp older low end h/w.
Any ideas please? Can a Unity dev please confirm whether a true seamless video loop is supported by design as it is not clear from documentation
Nothing in the docs, no response from devs, no access to the sources (unlike UE, Godot and pretty much every other engine out there) to just go and dig the answer out on your own. What else can you try?
Not surprising devs leaving Unitytanic in droves …
I have to say that our small media team is strongly advocating to increase our resources to improve the video player implementation and integration across other Unity features (among numerous other things…).
Understandably, “now” is not exactly the best time for this, but I believe we’re making a good case for this internally. Comments like yours also help us demonstrate some of these cases.
But what would reeeaaally help us…
…is if you could list relevant or cool (or even standard!) usages for Video Player that are not supported or possible yet. We certainly have a small list of our own, but we’re not exactly game designers so we’re certainly missing out on some.
Thanks Seven! The “no” answer is nonetheless an answer. Much appreciated.
Shame proper looping not supported though. I added it to “Audio/Video Public Roadmap - Call for Feedback” sticky thread above.
As for applications - pretty much everywhere you’d use video loops in the game. Honestly not even sure what was the point of having a Video Player loop option w/o properly implementing it. You’d certainly not want the rather noticeable irritating black screen or frozen frame delay when video restarts. Especially noticeable when looping short videos as you see constant hiccups.
Seamless looping and a precise callback on loop point proved to be unachievable on most platforms, at least with the high-level third party APIs we’re going through at the moment (think Media Foundation, AVFoundation, Android/MediaCodec, etc). We found this out during early implementation when we were too far ahead in the release cadence to revise the implementation choice, so a visible hiccup may happen.
There won’t be a black frame, but if the system doesn’t have enough breathing room to restart playback before the previously-buffered content is exhausted, you’ll perceive the transition. We’ve been polishing this over time, but there’s no smoothness guarantee.
It’s not just looping that suffers in this way: transition from one clip to another (in a playlist situation, say) is also quite hard to accomplish with the VideoPlayer in its current state. Doable, but lots of ahead-of-time preparation handling to be done under the hood by the user with a second VideoPlayer instance that you double-buffer with.
So like SeventhString was saying, it’s good for us to know whether there are people for who this is important, because this has also irritated me from the very beginning. If we have data to show there’s traction for this, then it makes it a valid item to put in the design requirements of a future generation implementation.
As for the value of looping without smoothness guarantee, the typical scenario where this won’t matter is if your videos, for example, fade-in/out from/to black, then it’ll go unnoticed. But this admittedly doesn’t cover a very large spectrum of what looping can be used for.
Based on the information available and the lack of explicit documentation regarding seamless looping in Unity’s native Video Player component, it’s advisable to consider a few points:
Experimentation: Your experimentation on Mac and iPhone devices with Unity 2022.3 is a good starting point. If you’re not noticing visual gaps during looping in your specific use case, it’s a positive sign.
Device Variation: Keep in mind that performance and behavior might vary across different devices and platforms. Your test devices may be powerful enough to handle seamless looping, but it’s essential to consider the potential variability on older or lower-end hardware.
Documentation Check: While there may not be explicit documentation stating seamless looping, it’s worth checking the official Unity documentation for any updates or discussions on video looping behavior.
Alternative Solutions: If seamless looping is critical and Unity’s Video Player doesn’t provide the desired behavior, consider exploring alternative solutions or assets from the Unity Asset Store that specialize in video playback and looping.
Unity Updates: Unity may introduce changes or improvements in subsequent updates. Ensure that you’re using the latest version of Unity to take advantage of any enhancements or fixes related to video playback.
while Unity’s Video Player component may not explicitly mention seamless looping in its documentation, your positive results from experimentation are promising. Keep testing on various devices, stay updated with Unity releases, and seek insights from the Unity community for a comprehensive understanding of the behavior across different scenarios.