Skip to main content

media kit

16 tools. Generated from the plugin source; do not edit by hand.

Guide​

Use this kit for persistent UMediaPlayer, UMediaPlaylist and UMediaSource assets plus synchronous controls on a player that already has media open.

Recipe​

media.create_player {"folder":"/Game/Media","name":"MP_Screen"}
media.create_source {"folder":"/Game/Media","name":"MS_Intro","kind":"file","url":"Movies/Intro.mp4"}
media.create_source {"folder":"/Game/Media","name":"MS_Live","kind":"stream","url":"rtsp://camera.local/stream"}
media.create_playlist {"folder":"/Game/Media","name":"MPL_Loop"}
media.add_playlist_source {"asset":"/Game/Media/MPL_Loop","source":"/Game/Media/MS_Intro"}
media.list_playlist {"asset":"/Game/Media/MPL_Loop"}
media.get_state {"asset":"/Game/Media/MP_Screen"}
  • create_source kinds: file (path absolute or relative to the project Content folder; the file is not checked or opened) and stream (any URL). Creation never opens media.
  • add_playlist_source appends with index -1 (default) or inserts at index; remove_playlist_source removes by zero-based index.
  • get_source returns the source URL; audit_assets reports the state of a player, the entries of a playlist or the URL of a source.

Playback​

play, seek and set_rate act on media the player has already opened; with nothing open they fail with an explicit error (E_EDITOR_STATE / E_INVALID_ARG). pause, rewind, set_loop and close are safe on a closed player. Opening a source is asynchronous and is not exposed yet.

Gotchas​

  • Names are bare; an existing asset at the path is E_CONFLICT.
  • Seek ranges and rates depend on the media backend of the opened file.

Tools​

Legend. risk 0 = read-only, 1 = harmless editor op, 2 = modifies asset, 3 = deletes/replaces asset, 4 = project/config/build op, 5 = potentially destructive (calls above MaxAutoRisk need "_confirm": true). mutates = runs in a transaction (edit.undo reverts). requires PIE / requires world = refused without a PIE session / an open level. requires plugin = unavailable while the plugin is disabled. dryRun = honours the dryRun argument. smoke = covered by edit.self_test.

media.add_playlist_source (risk 2, mutates, smoke)​

Appends (index -1) or inserts a MediaSource asset into a MediaPlaylist.

ArgumentTypeDescription
sourcestringMediaSource asset path (required to add).
indexintegerPlaylist index; -1 appends when adding. Default -1.

Returns: media, sources.

media.audit_assets (risk 0, smoke)​

Resolves a media asset and reports its class and, for players, playlists and sources, their state or entries.

ArgumentTypeDescription
assetstringrequired.

Returns: media, sources.

media.close (risk 2, mutates, smoke)​

Closes the media opened by the player.

ArgumentTypeDescription
assetstringrequired.

Returns: media, sources.

media.create_player (risk 2, mutates, smoke)​

Creates a MediaPlayer asset. Returns the player state.

ArgumentTypeDescription
folderstringrequired.
namestringrequired.

Returns: media, sources.

media.create_playlist (risk 2, mutates, smoke)​

Creates an empty MediaPlaylist asset.

ArgumentTypeDescription
folderstringrequired.
namestringrequired.

Returns: media, sources.

media.create_source (risk 2, mutates, smoke)​

Creates a MediaSource asset: kind 'file' (url = file path, absolute or relative to the project Content folder) or 'stream' (url = stream URL). The media is not opened.

ArgumentTypeDescription
folderstringrequired. Content folder under /Game.
namestringrequired. Bare asset name.
kindstringfile or stream. Default TEXT("file").
urlstringrequired. File path (file) or stream URL (stream).

Returns: media, sources.

media.get_source (risk 0, smoke)​

Returns the URL of a MediaSource asset.

ArgumentTypeDescription
assetstringrequired.

Returns: media, sources.

media.get_state (risk 0, smoke)​

Returns ready/playing/paused/looping state, time, duration and rate of a MediaPlayer.

ArgumentTypeDescription
assetstringrequired.

Returns: media, sources.

media.list_playlist (risk 0, smoke)​

Lists the media sources of a MediaPlaylist in order.

ArgumentTypeDescription
assetstringrequired.

Returns: media, sources.

media.pause (risk 2, mutates, smoke)​

Pauses the player (rate 0). Harmless on a closed player.

ArgumentTypeDescription
assetstringrequired.

Returns: media, sources.

media.play (risk 2, mutates)​

Starts playback of the media currently opened by the player; fails when nothing is open.

ArgumentTypeDescription
assetstringrequired.

Returns: media, sources.

media.remove_playlist_source (risk 2, mutates, smoke)​

Removes the playlist entry at index.

ArgumentTypeDescription
sourcestringMediaSource asset path (required to add).
indexintegerPlaylist index; -1 appends when adding. Default -1.

Returns: media, sources.

media.rewind (risk 2, mutates, smoke)​

Rewinds the player to the start of the opened media.

ArgumentTypeDescription
assetstringrequired.

Returns: media, sources.

media.seek (risk 2, mutates)​

Seeks the opened media to a time in seconds.

ArgumentTypeDescription
secondsnumberrequired.

Returns: media, sources.

media.set_loop (risk 2, mutates, smoke)​

Enables or disables looping on the player.

ArgumentTypeDescription
valuebooleanrequired.

Returns: media, sources.

media.set_rate (risk 2, mutates)​

Sets the playback rate of the opened media (1 = normal, 0 = paused).

ArgumentTypeDescription
ratenumberrequired.

Returns: media, sources.