MonoGame/MonoGame · error · ArgumentNullException

video is null.

Error message

video is null.

What it means

Thrown by VideoPlayer.Play(Video) when the video argument is null. The player needs a Video to initialize the platform playback pipeline, so a null reference is rejected immediately with ArgumentNullException.

Source

Thrown at MonoGame.Framework/Media/VideoPlayer.cs:189

        /// </summary>
        public void Pause()
        {
            if (_currentVideo == null)
                return;

            PlatformPause();

            _state = MediaState.Paused;
        }

        /// <summary>
        /// Plays a <see cref="Video"/>.
        /// </summary>
        /// <param name="video">Video to play.</param>
        public void Play(Video video)
        {
            if (video == null)
                throw new ArgumentNullException("video is null.");

            if (_currentVideo == video)
            {
                var state = State;
							
                // No work to do if we're already
                // playing this video.
                if (state == MediaState.Playing)
                    return;

                // If we try to Play the same video
                // from a paused state, just resume it instead.
                if (state == MediaState.Paused)
                {
                    PlatformResume();
                    _state = MediaState.Playing;
                    return;
                }

View on GitHub (pinned to 1d71bbd0ff)

Solutions

  1. Verify the content path matches the asset name and the video is in the content pipeline.
  2. Null-check the loaded Video before calling Play.
  3. Ensure the Video field is assigned from a successful load.

Example fix

// before
var vid = Content.Load<Video>("intro_bad");
videoPlayer.Play(vid);
// after
var vid = Content.Load<Video>("intro");
if (vid != null) videoPlayer.Play(vid);
Defensive patterns

Strategy: validation

Validate before calling

if (video == null) return;
videoPlayer.Play(video);

Type guard

static bool IsVideoPlayable(Video v) => v != null;

Prevention

When it happens

Trigger: Calling videoPlayer.Play(null), or passing a Video that is null because Content.Load<Video> returned null (missing or misnamed asset) or the field was never assigned.

Common situations: Content asset name typo for the video, the video not included in the content build, or referencing a video field before it is loaded.

Related errors


AI-assisted analysis of MonoGame/MonoGame@1d71bbd0ff (2026-08-13). Data as JSON: /api/errors/5069945fe8a280fe. Report an issue: GitHub.