unoplatform/uno · error · NotSupportedException

StepBackwardOneFrame is not supported

Error message

StepBackwardOneFrame is not supported

What it means

The WebAssembly MediaPlayer extension (Uno.UI.Media.MediaPlayerExtension) unconditionally throws NotSupportedException from StepBackwardOneFrame(). Frame-accurate backward stepping has no equivalent in the HTML5 <video> element that backs the WASM player, so the IMediaPlayerExtension contract method is a no-op stub. The method is part of the shared Windows.Media.Playback.MediaPlayer surface; only some platform extensions implement it (Skia/macOS does via native uno_mediaplayer_step_by; WASM, Skia.X11, and Skia.Wasm.Browser do not). Calling MediaPlayer.StepBackwardOneFrame() on a WASM target always throws.

Source

Thrown at src/AddIns/Uno.UI.MediaPlayer.WebAssembly/MediaPlayerExtension.cs:489

	public void SetSurfaceSize(Size size)
		=> throw new NotSupportedException($"SetSurfaceSize is not supported");

	public void SetUriSource(Uri uri)
	{
		if (this.Log().IsEnabled(LogLevel.Debug))
		{
			this.Log().Debug($"MediaPlayerExtension.SetUriSource({uri})");
		}

		if (_player is not null)
		{
			_player.Source = uri.OriginalString;
		}
	}

	public void StepBackwardOneFrame()
		=> throw new NotSupportedException($"StepBackwardOneFrame is not supported");

	public void StepForwardOneFrame()
		=> throw new NotSupportedException($"StepForwardOneFrame is not supported");

	public void Stop()
	{
		if (this.Log().IsEnabled(LogLevel.Debug))
		{
			this.Log().Debug($"MediaPlayerExtension.Stop()");
		}

		if (_owner.PlaybackSession.PlaybackState == MediaPlaybackState.Playing
			|| _owner.PlaybackSession.PlaybackState == MediaPlaybackState.Paused)
		{
			_player?.Pause(); // Do not call stop, otherwise player will need to be prepared again
			_owner.PlaybackSession.Position = TimeSpan.Zero;
			_owner.PlaybackSession.PlaybackState = MediaPlaybackState.None;
		}

View on GitHub (pinned to 0418340488)

Solutions

  1. Gate the call behind a platform check: only invoke StepBackwardOneFrame() when the active IMediaPlayerExtension supports it (e.g. guard with OperatingSystem.IsMacOS() for the Skia/macOS extension, or query a capability flag).
  2. Wrap the call in try/catch (NotSupportedException) and disable/hide the frame-step-back affordance in the UI on catch.
  3. If you own the UI, bind the visibility/enabled state of the step-back button to a property that reflects platform capability, so the call is never made on WASM.

Example fix

// before
mediaPlayer.StepBackwardOneFrame();

// after
try { mediaPlayer.StepBackwardOneFrame(); }
catch (NotSupportedException) { /* backward frame step unsupported on this platform */ }
Defensive patterns

Strategy: type-guard

Validate before calling

// Only call when the platform extension implements backward stepping
if (OperatingSystem.IsMacOS()) // Skia/macOS implements it
{
	mediaPlayer.StepBackwardOneFrame();
}

Type guard

static bool SupportsBackwardFrameStep() => OperatingSystem.IsMacOS(); // add other known-supporting runtimes

Try / catch

try { mediaPlayer.StepBackwardOneFrame(); }
catch (NotSupportedException) { /* frame-step-back unavailable on WASM */ }

Prevention

When it happens

Trigger: Calling mediaPlayer.StepBackwardOneFrame() (directly or via a media control's frame-step-back button) while running on the WebAssembly target, where the resolved IMediaPlayerExtension is Uno.UI.Media.MediaPlayerExtension.

Common situations: Porting a WinUI media app whose UI exposes a 'previous frame' control to WASM; shared view-model code that invokes StepBackwardOneFrame unconditionally; automated runtime tests that exercise the full MediaPlayer API surface on every platform.

Related errors


AI-assisted analysis of unoplatform/uno@0418340488 (2026-08-13). Data as JSON: /api/errors/268642f4edc06d5b. Report an issue: GitHub.