Page 1 of 1

VLC for Unity skips first second

Posted: 21 Sep 2024 21:43
by Odyssey
Hi all!

I'm trying to play some Bink video via VLC in Unity and faced a problem, for which unable to found solution.
Player works fine, however by unknown reason it skips nearly second (900 - 1000 milliseconds) with normal rate before starting to play video (this values reports first Time call in Update() during first frame receiving). Tried to change file caching time, enable hardware decoding, change a way media provided, etc - nothing worked.
However, when I tried to change playback rate, situation changed: with 0.125 rate skipped just 100 milliseconds, so no video plays from the start but really slow.

Player implementation based on basic examples from https://github.com/videolan/vlc-unity (based currently on demo version of VLC for Unity), for output used VisualElement background,
Media created from byte array: new(new StreamMediaInput(new MemoryStream(value))), tried also with file - situation is the same.

Did I missed some option or anything else in setup of player/media assignment while checking docs, examples and code?

Re: VLC for Unity skips first second

Posted: 07 Oct 2024 11:13
by mfkl
do you have this issue when playing a media from a URL as well?

Re: VLC for Unity skips first second

Posted: 07 Oct 2024 13:46
by Odyssey
do you have this issue when playing a media from a URL as well?
No, will try later today and provide test results, thank you!

Re: VLC for Unity skips first second

Posted: 08 Oct 2024 00:49
by Odyssey
do you have this issue when playing a media from a URL as well?

Used link from example and used the easiest way to set it:

Code: Select all

player.Media = new(new Uri("https://download.blender.org/peach/bigbuckbunny_movies/big_buck_bunny_1080p_stereo.avi"));

Yes, first player.Time value has range from 1000 to 1200.

Re: VLC for Unity skips first second

Posted: 08 Oct 2024 06:39
by mfkl
If you need more precise time, I think you will need to write some custom code.
First read https://code.videolan.org/videolan/vlc/ ... uests/2312 comments and commits. Then see how to use these functions from libvlcsharp in unity.

Re: VLC for Unity skips first second

Posted: 09 Oct 2024 23:54
by Odyssey
Thank you, will try this approach.