/shiny:shiny-screenrecorderfrom shiny
Generate code using Shiny.ScreenRecorder for cross-platform screen recording - capturing the screen to an MP4 with optional microphone and system audio, choosing a display or window, pausing and resuming, and handling the OS ending a recording on its own, on Android, iOS, Mac Catalyst, macOS, Windows, Linux, and Blazor WebAssembly
Ships in shiny. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
You are an expert in Shiny.ScreenRecorder, a cross-platform screen recording library covering video capture to a file, microphone and system audio, display/window selection, pause and resume, and the OS ending a recording without being asked.
Invoke this skill when the user wants to:
What "the screen" means is not the same on every platform, and the difference is visible to users. Three facts decide most of the design:
Windows.Graphics.Capture captures pixels and nothing else.
Asking for IncludeMicrophone or IncludeSystemAudio there throws.recorder.Capabilities off the instance at runtime. Never infer it from the target framework.A request asking for something outside Capabilities throws
ScreenRecorderNotSupportedException before any native call happens - by design, because a
recording that silently came out without the microphone is worse than one that refused to start.
Branch on the flags.
| Android | iOS / Mac Catalyst | tvOS | macOS 15+ | macOS 12.3-14 | Windows | Linux | Blazor WASM | |
|---|---|---|---|---|---|---|---|---|
| What is recorded | system screen | this app only | this app only | system screen | system screen | system screen | system screen | user's pick |
| Record | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
| Pause / Resume | ✅ | ✅ synth | ✅ synth | ❌ | ✅ synth | ✅ synth | ❌ | ✅ native |
| Microphone | ✅ | ✅ | ❌ no mic | ✅ | ❌ | ❌ | ✅ | ✅ |
| System audio | ✅ API 29+ (app audio) | ✅ (app audio) | ✅ (app audio) | ✅ | ✅ | ❌ | ✅ | ⚠️ Chromium, tab only |
| Pick a display | ❌ | ❌ | ❌ | ✅ | ✅ | ✅ | portal picker | browser picker |
| Pick a window | ❌ | ❌ | ❌ | ✅ | ✅ | ✅ | portal picker | browser picker |
| Hide the cursor | ❌ | ❌ | ❌ | ✅ | ✅ | ✅ | ✅ | ❌ |
| Frame rate | ✅ | ❌ | ❌ | ✅ | ✅ | ✅ | ✅ | ✅ |
| Bitrate | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
| Downscale | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
| Result has a file path | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ❌ null |
tvOS is the same ReplayKit implementation as iOS. The only difference is the microphone: an Apple TV has none, RPScreenRecorder carries no MicrophoneEnabled on tvOS, so ScreenRecorderCapabilities.Microphone is not advertised and IncludeMicrophone = true is rejected by request validation. Never generate a tvOS recording request that sets it.
Windows.Graphics.Capture has no audio path. Adding it means a
hand-written WASAPI loopback capture, which this library does not do. Capabilities reports
neither audio flag on Windows.| Item | Value |
|---|---|
| GitHub | https://github.com/shinyorg/shiny |
| NuGet | Shiny.ScreenRecorder (its net10.0 build holds the Blazor WebAssembly recorder - Shiny.ScreenRecorder.Blazor no longer exists), plus Shiny.ScreenRecorder.Linux on Linux |
| Namespace | Shiny.ScreenRecorder (types); Shiny (registration extensions) |
| Platforms | Android, iOS, Mac Catalyst, macOS, Windows, Linux, Blazor WebAssembly |
| Platform | Capture | Encoder |
|---|---|---|
| Android | MediaProjection → VirtualDisplay | MediaCodec (H.264 surface + AAC) → MediaMuxer |
| iOS / Mac Catalyst | RPScreenRecorder.startCapture | AVAssetWriter |
| macOS 15+ | SCStream | SCRecordingOutput (ScreenCaptureKit writes the file) |
| macOS 12.3-14 | SCStream + ISCStreamOutput | AVAssetWriter |
| Windows | Direct3D11CaptureFramePool | MediaStreamSource → MediaTranscoder |
| Linux | xdg-desktop-portal ScreenCast → PipeWire | gst-launch-1.0, or ffmpeg -f x11grab |
| Blazor WASM | getDisplayMedia | MediaRecorder |
| plain .NET | none - every call throws | none |
Android uses MediaCodec rather than the much simpler MediaRecorder for one reason:
MediaRecorder.setAudioSource takes a single source and playback capture is not one of them, so
app audio is only reachable through AudioRecord + AudioPlaybackCaptureConfiguration. Wanting
app audio at all forces the whole pipeline down.
builder.Services.AddScreenRecorder(); // IScreenRecorder, singleton
Same call everywhere except Linux. On net10.0, AddScreenRecorder() registers the browser recorder
behind OperatingSystem.IsBrowser() and the not-supported recorder anywhere else. On Linux, reference
Shiny.ScreenRecorder.Linux and call builder.Services.AddLinuxScreenRecorder() instead - it is a separate
package so its Tmds.DBus.Protocol dependency never reaches a WebAssembly app.
On a plain .NET host - a server, console or test project with no screen - AddScreenRecorder() (or
AddNotSupportedScreenRecorder()) registers the recorder that reports ScreenRecorderCapabilities.None.
Android - AndroidManifest.xml:
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_MEDIA_PROJECTION" />
<uses-permission android:name="android.permission.RECORD_AUDIO" /> <!-- only if capturing audio -->
The foreground service and the consent activity are in the package and merge into your manifest automatically. From Android 14 the service must be running before the projection is obtained; the library does that ordering for you.
The consent dialog asks for the entire screen. From Android 14 the system can offer "a single
app" instead and preselects it; with no Target set the request is documented as the primary
display, so the library asks Android for exactly that and the app picker never appears.
The foreground service shows a notification for the whole recording - "Screen recording" with a
Stop action by default. Stop ends the recording exactly like the system's own stop control:
Faulted fires with RevokedByUser and carries the finished file, so handle it the same way.
To reword it (for example into the app's language), register an
IScreenRecordingNotificationDelegate - it receives the builder with the defaults already applied:
#if ANDROID
public class RecordingNotification(AndroidPlatform platform) : IScreenRecordingNotificationDelegate
{
// relabelling Stop means dropping the default action and adding your own with the library's intent
public void Configure(NotificationCompat.Builder builder) => builder
.SetContentTitle("Bildschirmaufnahme")!
.SetContentText("Die Aufnahme läuft")!
.ClearActions()!
.AddAction(0, "Beenden", platform.GetScreenRecordingStopIntent());
}
// next to AddScreenRecorder()
builder.Services.AddSingleton<IScreenRecordingNotificationDelegate, RecordingNotification>();
#endif
iOS / Mac Catalyst - no entitlement to record your own app. Add
NSMicrophoneUsageDescription to Info.plist if using the microphone. The app must be in the
foreground.
macOS - the Screen Recording grant in System Settings. RequestAccess prompts for it, but
macOS only applies a new grant on the next launch - the first RequestAccess after the user
approves still reports Denied, and you must tell them to restart the app. Add
NSMicrophoneUsageDescription, and com.apple.security.device.audio-input when sandboxed.
Windows - Windows 10 1903 or later. Packaged apps declare the graphicsCapture capability.
Linux - a desktop session with xdg-desktop-portal implementing ScreenCast, plus
gstreamer1.0-tools gstreamer1.0-plugins-good gstreamer1.0-plugins-bad gstreamer1.0-pipewire, or
ffmpeg on X11. Audio needs pactl. Flatpak sandboxes are not supported. All of this is
probed at runtime - a machine missing the pieces reports ScreenRecorderCapabilities.None.
Blazor WebAssembly - HTTPS (or localhost) and a user gesture. getDisplayMedia is refused
from OnInitializedAsync; it must run from a button click. In an iframe, add
allow="display-capture; microphone".
public class BugReportRecorder(IScreenRecorder recorder, ILogger<BugReportRecorder> logger)
{
IScreenRecording? session;
public async Task Start(CancellationToken ct)
{
var request = new ScreenRecordingRequest
{
// null lets the library name a file in the platform cache directory
OutputPath = null,
IncludeMicrophone = recorder.Capabilities.HasFlag(ScreenRecorderCapabilities.Microphone),
MaxWidth = 1280, // a phone screen at native resolution is enormous
MaxDuration = TimeSpan.FromMinutes(2)
};
var access = await recorder.RequestAccess(request, ct);
if (access is AccessState.Denied or AccessState.NotSupported)
throw new InvalidOperationException("Screen recording is not available");
// does not return until frames are genuinely being written - the consent dialog, the
// compositor picker and the Android foreground service all complete first
this.session = await recorder.Start(request, ct);
this.session.Faulted += (_, e) =>
logger.LogWarning("The recording ended on its own: {Reason}", e.Reason);
}
public async Task<ScreenRecordingResult> Stop(CancellationToken ct)
{
var result = await this.session!.Stop(ct);
this.session = null;
return result;
}
}
MaxWidth is worth setting on almost every recording. A modern phone or Retina display at
native resolution produces very large files for very little visible gain.
RequestAccess cannot always answer. Android's consent dialog is bound to the projection it
authorises and cannot be pre-granted, and the Linux portal and browser pickers grant per call - all
three report AccessState.Unknown. Treat anything other than Denied / NotSupported as "worth
trying", and let Start surface the real answer.
var result = await session.Stop(ct);
logger.LogInformation(
"{Duration} of {Width}x{Height} {MimeType}, {Bytes} bytes",
result.Duration, result.Width, result.Height, result.MimeType, result.ByteSize
);
// portable - works on every platform including the browser
await using var stream = await result.OpenRead(ct);
await UploadAsync(stream, result.MimeType, ct);
FilePath is null in the browser - there is no filesystem. Use OpenRead() when you want the
bytes and do not care where they came from. MimeType genuinely varies: native platforms all
produce video/mp4, but Firefox produces video/webm;codecs=vp9. Do not hardcode .mp4 when
uploading or naming a download.
On Android the file is in app-private cache - move or share it before the OS reclaims it. On Apple platforms it is inside the app container and is not in Photos until you put it there.
if (recorder.Capabilities.HasFlag(ScreenRecorderCapabilities.PauseResume))
{
await session.Pause(ct);
// ... user does something private ...
await session.Resume(ct);
}
Both calls are idempotent. Only the browser pauses natively; elsewhere the capture keeps running,
frames are dropped, and later timestamps are shifted back so the output has no frozen stretch -
which also means a long pause still costs battery. Elapsed excludes the paused span and matches
the duration of the finished file.
if (recorder.Capabilities.HasFlag(ScreenRecorderCapabilities.DisplaySelection))
{
var targets = await recorder.GetTargets(ct);
var display = targets.FirstOrDefault(t => t.Kind == CaptureTargetKind.Display && t.IsPrimary)
?? targets.First();
await recorder.Start(new ScreenRecordingRequest { Target = display }, ct);
}
else
{
// mobile has no concept of a target; Linux and the browser show their own picker during Start
await recorder.Start(new ScreenRecordingRequest(), ct);
}
CaptureTarget.Id is the platform's own handle and is not stable across reboots or across a
window being closed and reopened. Re-enumerate rather than persisting one. Window titles are often
empty or duplicated - pair Name with ApplicationName when showing a list.
GetTargets throws on Linux and in the browser. Their compositors insist on running their own
picker, which appears during Start. Target must be left null there.
This is not an edge case - it is the normal way a screen recording ends on several platforms.
session.Faulted += (_, e) =>
{
// by now the session is finished; Stop() will return what was salvaged rather than continuing
switch (e.Reason)
{
case ScreenRecordingFaultReason.RevokedByUser:
// Android's cast notification or the recording notification's Stop action, the
// browser's "Stop sharing" bar, macOS's menu-bar stop
break;
case ScreenRecordingFaultReason.InterruptedBySystem:
// an incoming call on iOS, an Android foreground-service timeout, the screen locking
break;
case ScreenRecordingFaultReason.MaxDurationReached:
// stopped cleanly - e.Result always carries a complete file
break;
case ScreenRecordingFaultReason.TargetLost:
// a monitor unplugged, a recorded window closed
break;
case ScreenRecordingFaultReason.EncoderFailed:
// e.Result is usually null and the file is unusable
break;
}
if (e.Result != null)
Save(e.Result);
};
Faulted fires on a native callback thread. Marshal before touching UI. The same is true of
IScreenRecorder.StateChanged.
Start throws ScreenRecorderException while another is in
flight - every platform underneath has the same restriction.Stop cancels and deletes the
partial file.Stop twice returns the same result. Stop after Cancel throws - there is no output.<button @onclick="StartRecording">Record</button> @* must be a user gesture *@
@code {
[Inject] IScreenRecorder Recorder { get; set; } = null!;
IScreenRecording? session;
protected override async Task OnInitializedAsync()
{
// Capabilities is synchronous but browser feature detection is not, so it reports None
// until this has run
await ((BlazorScreenRecorder)this.Recorder).Probe();
}
async Task StartRecording()
=> this.session = await this.Recorder.Start(new ScreenRecordingRequest());
async Task StopRecording()
{
var result = await this.session!.Stop();
// the browser is the only place the recording is not already a file the app can move
var extension = result.MimeType.Contains("mp4") ? "mp4" : "webm";
await this.Recorder.DownloadRecording(result, $"recording.{extension}");
}
}
| Mistake | What happens | Do instead |
|---|---|---|
| Assuming iOS records the whole screen | Only your app is in the file | Say so in the UI; use Android/desktop for full-screen capture |
| Asking for audio on Windows | ScreenRecorderNotSupportedException | Check Capabilities first |
Reading Capabilities off the TFM | Wrong on macOS, where 15+ and 12.3-14 differ | Read it off the instance at runtime |
| Recording at native resolution on a phone | Enormous files | Set MaxWidth |
Calling Start from OnInitializedAsync in Blazor | The browser refuses it | Call it from a button click |
Hardcoding .mp4 in the browser | Firefox produces WebM | Read result.MimeType |
Ignoring Faulted | A recording the user stopped looks like a hang | Subscribe before the first frame |
| Dropping the session without stopping | The file is deleted | Stop(), or Cancel() if you mean to discard it |
Persisting a CaptureTarget.Id | Stale handle on the next run | Re-enumerate with GetTargets |
Expecting RequestAccess to settle Android consent | It reports Unknown | Let Start show the dialog |
| Exception | Meaning |
|---|---|
ScreenRecorderNotSupportedException | The platform cannot do it at all. Retrying never helps; the message names the limit. Check the matching capability flag first. |
ScreenRecorderPermissionException | Fixable - a missing manifest entry, entitlement or usage description, or the user declined a consent dialog. |
ScreenRecorderException | Base type, and everything else: a recording already in flight, an encoder failure, a file that never got written. |
What SKILL.md sets; muted values are Claude Code's defaults
57 skills in this plugin
/localizegenGenerate strongly-typed localization classes from .resx resource files using Shiny.Extensions.Localization.Generator for .NET applications/shiny-accessorysetupGenerate code using Shiny.BluetoothLE.AccessorySetup - the system accessory pairing sheet for BLE devices (AccessorySetupKit on iOS 18+, CompanionDeviceManager on Android) with no MFi, no location prompt and no general Bluetooth prompt on iOS; picked accessories open as Shiny.BluetoothLE peripherals, and Android adds background presence (device appeared / disappeared) events/shiny-actorsGenerate code using Shiny.Actors — Orleans-style virtual actors without the ceremony, AOT/trim-clean, running anywhere .NET runs including .NET MAUI and Blazor WebAssembly. Covers actor interfaces and source-generated proxies, the ShinyActorBuilder (AddShinyActors), persistent state with ETags, named states and auto-save, event-sourced JournaledActor with snapshots, state and event migrations, typed streams (durable, implicit consumers), timers and persistent reminders (background jobs via Shiny.Jobs, on-time OS notifications via Shiny.Notifications), concurrency control ([Reentrant], [AlwaysInterleave], [ReadOnly], [StatelessWorker]), call filters and request context, OpenTelemetry traces and metrics, remoting over HTTP (Shiny.Net.HttpServer server, RemoteActorSystem client), mDNS discovery of actor servers, Shiny.DocumentDb storage (SQLite, PostgreSQL, IndexedDB...), and the ActorTestHost testing kit.npx claudepluginhub shinyorg/skills --plugin shinyOther plugins' skills for the same job