Skip to content

After setting MediaPlayer.Media twice, then playing, the video incorrectly plays twice.

  • Start with a MediaPlayer in stopped state (not playing)
  • Set _mediaPlayer.Media([some video])
  • Repeat that: Set _mediaPlayer.Media([the same video])
  • _mediaPlayer.Play();

Expected result: the video plays once.

Actual result: the video plays twice.

Quick repro:

if (Input.GetKeyDown(KeyCode.C)) {
	_mediaPlayer.Media = new Media(_libVLC
		, Application.dataPath.Replace('/', '\\') + "\\HitboxCrime.mp4"
		, FromType.FromPath);
	_mediaPlayer.Media = new Media(_libVLC
		, Application.dataPath.Replace('/', '\\') + "\\HitboxCrime.mp4"
		, FromType.FromPath);
	_mediaPlayer.Play();
	playing = true;
}
  • Play MinimumPlayback
  • Stop the auto-playing video
  • Press C.