{"record":{"id":"268642f4edc06d5b","repo":"unoplatform/uno","slug":"stepbackwardoneframe-is-not-supported","errorCode":null,"errorMessage":"StepBackwardOneFrame is not supported","messagePattern":"StepBackwardOneFrame is not supported","errorType":"exception","errorClass":"NotSupportedException","httpStatus":null,"severity":"error","filePath":"src/AddIns/Uno.UI.MediaPlayer.WebAssembly/MediaPlayerExtension.cs","lineNumber":489,"sourceCode":"\n\tpublic void SetSurfaceSize(Size size)\n\t\t=> throw new NotSupportedException($\"SetSurfaceSize is not supported\");\n\n\tpublic void SetUriSource(Uri uri)\n\t{\n\t\tif (this.Log().IsEnabled(LogLevel.Debug))\n\t\t{\n\t\t\tthis.Log().Debug($\"MediaPlayerExtension.SetUriSource({uri})\");\n\t\t}\n\n\t\tif (_player is not null)\n\t\t{\n\t\t\t_player.Source = uri.OriginalString;\n\t\t}\n\t}\n\n\tpublic void StepBackwardOneFrame()\n\t\t=> throw new NotSupportedException($\"StepBackwardOneFrame is not supported\");\n\n\tpublic void StepForwardOneFrame()\n\t\t=> throw new NotSupportedException($\"StepForwardOneFrame is not supported\");\n\n\tpublic void Stop()\n\t{\n\t\tif (this.Log().IsEnabled(LogLevel.Debug))\n\t\t{\n\t\t\tthis.Log().Debug($\"MediaPlayerExtension.Stop()\");\n\t\t}\n\n\t\tif (_owner.PlaybackSession.PlaybackState == MediaPlaybackState.Playing\n\t\t\t|| _owner.PlaybackSession.PlaybackState == MediaPlaybackState.Paused)\n\t\t{\n\t\t\t_player?.Pause(); // Do not call stop, otherwise player will need to be prepared again\n\t\t\t_owner.PlaybackSession.Position = TimeSpan.Zero;\n\t\t\t_owner.PlaybackSession.PlaybackState = MediaPlaybackState.None;\n\t\t}","sourceCodeStart":471,"sourceCodeEnd":507,"githubUrl":"https://github.com/unoplatform/uno/blob/04183404888ea21b4e5bfa3493e8d5f15e972c3a/src/AddIns/Uno.UI.MediaPlayer.WebAssembly/MediaPlayerExtension.cs#L471-L507","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["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).","Wrap the call in try/catch (NotSupportedException) and disable/hide the frame-step-back affordance in the UI on catch.","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."],"exampleFix":"// before\nmediaPlayer.StepBackwardOneFrame();\n\n// after\ntry { mediaPlayer.StepBackwardOneFrame(); }\ncatch (NotSupportedException) { /* backward frame step unsupported on this platform */ }","handlingStrategy":"type-guard","validationCode":"// Only call when the platform extension implements backward stepping\nif (OperatingSystem.IsMacOS()) // Skia/macOS implements it\n{\n\tmediaPlayer.StepBackwardOneFrame();\n}","typeGuard":"static bool SupportsBackwardFrameStep() => OperatingSystem.IsMacOS(); // add other known-supporting runtimes","tryCatchPattern":"try { mediaPlayer.StepBackwardOneFrame(); }\ncatch (NotSupportedException) { /* frame-step-back unavailable on WASM */ }","preventionTips":["Bind step-back control visibility to a platform-capability flag.","Never assume the full MediaPlayer API is implemented on every Uno runtime.","Audit shared media transport code for platform-unsupported methods before targeting WASM."],"tags":["media","wasm","notsupported","mediaplayer"],"backgroundTag":null,"analyzedSha":"04183404888ea21b4e5bfa3493e8d5f15e972c3a","analyzedAt":"2026-08-13T21:08:11.651Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}