Wrong video plays when setting a new MediaPlayer.Media twice in a row, then playing that.
- Start with a mediaplayer in stopped state. (Not playing, not paused.)
- From there, set _mediaPlayer.Media = new Media([video A]);
- Do NOT Play() that video A. Instead, set a new one (can be on the same frame or much later): _mediaPlayer.Media = new Media([video B]);
- Play() that.
Expected result: video B plays. Actual result: video A plays.
This happens on vlc-unity 0.1.3 and 0.1.4, at least.
For an easy repro, I just took the vlc-unity MinimalPlayback demo, plopped a local video "subnautica_trailer_1.mp4" in the root of Assets, then added this line on MinimalPlayback.cs:68 just before the original line that sets the .Media:
_mediaPlayer.Media = new Media(_libVLC
, Application.dataPath.Replace('/', '\\') + "\\subnautica_trailer_1.mp4"
, FromType.FromPath); // From a stopped state, set new media A
Then play that scene and bam, that local video plays instead of the BigBuckBunny video that is set immediately afterwards.
Note: A very stupid workaround for this bug is to set the new video twice in a row, rather than once.
- Buggy: [set video A, set video B, play]
- Correct result: [set video A, set video B, set video B, play]
Edited by Louis Paquin