Back to API Reference
Struct

MediaContent

sealed

Media offered to a MediaReceived hook — from a clipboard paste, a drag-and-drop, or a picker (see Source), before the text-adapter pipeline runs. A handler probes the formats it cares about — image blobs via GetData, files via GetFiles / ReadFile — and sets Handled to consume it; left unhandled, a paste falls through to the normal text channels. MediaInputBehavior is the inherit-and-override entry point.

public UniTextEditable Editable{ get }

The editor the media is going into.

public MediaSource Source{ get }

Whether this arrived by paste, drop, or picker.

public bool Handled{ get; set }

Set to consume the media and skip the text channels. Sticky once set.

public bool HasFiles{ get }

Whether file references are present.

public bool Has()

Whether format is present.

public byte[] GetData()

Raw bytes for format, or if absent.

public string[] GetFiles()

File references (paths or URIs), or if none. Get one's bytes with ReadFile.

public byte[] ReadFile()

Reads the bytes behind a reference from GetFiles, resolved the way the platform requires. if unreadable.

public Task<byte[]> ReadFileAsync()

Async variant of ReadFile — the right call for anything that can be large (video, archives): the file IO runs off the main thread. Resolves to if unreadable.