Saltar al contenido principal

Kit media

16 herramientas. Generado a partir del código fuente del plugin; no lo edites a mano.

Las descripciones de las herramientas y de los argumentos se muestran en inglés porque reflejan el schema de las herramientas (el mismo texto que el agente recibe en tools/list).

Guía​

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.

Herramientas​

Leyenda. riesgo 0 = solo lectura, 1 = operación inofensiva del editor, 2 = modifica un asset, 3 = elimina/reemplaza un asset, 4 = proyecto/configuración/build, 5 = potencialmente destructivo (las llamadas por encima de MaxAutoRisk requieren "_confirm": true). modifica = se ejecuta en una transacción (edit.undo la revierte). requiere PIE / requiere mundo = se rechaza sin una sesión PIE / sin un nivel abierto. requiere el plugin = no disponible cuando el plugin está desactivado. dryRun = acepta el argumento dryRun. smoke = cubierto por edit.self_test.

media.add_playlist_source (riesgo 2, modifica, smoke)​

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

ArgumentoTipoDescripción
sourcestringMediaSource asset path (required to add).
indexintegerPlaylist index; -1 appends when adding. Valor predeterminado -1.

Devuelve: media, sources.

media.audit_assets (riesgo 0, smoke)​

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

ArgumentoTipoDescripción
assetstringobligatorio.

Devuelve: media, sources.

media.close (riesgo 2, modifica, smoke)​

Closes the media opened by the player.

ArgumentoTipoDescripción
assetstringobligatorio.

Devuelve: media, sources.

media.create_player (riesgo 2, modifica, smoke)​

Creates a MediaPlayer asset. Returns the player state.

ArgumentoTipoDescripción
folderstringobligatorio.
namestringobligatorio.

Devuelve: media, sources.

media.create_playlist (riesgo 2, modifica, smoke)​

Creates an empty MediaPlaylist asset.

ArgumentoTipoDescripción
folderstringobligatorio.
namestringobligatorio.

Devuelve: media, sources.

media.create_source (riesgo 2, modifica, 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.

ArgumentoTipoDescripción
folderstringobligatorio. Content folder under /Game.
namestringobligatorio. Bare asset name.
kindstringfile or stream. Valor predeterminado TEXT("file").
urlstringobligatorio. File path (file) or stream URL (stream).

Devuelve: media, sources.

media.get_source (riesgo 0, smoke)​

Returns the URL of a MediaSource asset.

ArgumentoTipoDescripción
assetstringobligatorio.

Devuelve: media, sources.

media.get_state (riesgo 0, smoke)​

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

ArgumentoTipoDescripción
assetstringobligatorio.

Devuelve: media, sources.

media.list_playlist (riesgo 0, smoke)​

Lists the media sources of a MediaPlaylist in order.

ArgumentoTipoDescripción
assetstringobligatorio.

Devuelve: media, sources.

media.pause (riesgo 2, modifica, smoke)​

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

ArgumentoTipoDescripción
assetstringobligatorio.

Devuelve: media, sources.

media.play (riesgo 2, modifica)​

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

ArgumentoTipoDescripción
assetstringobligatorio.

Devuelve: media, sources.

media.remove_playlist_source (riesgo 2, modifica, smoke)​

Removes the playlist entry at index.

ArgumentoTipoDescripción
sourcestringMediaSource asset path (required to add).
indexintegerPlaylist index; -1 appends when adding. Valor predeterminado -1.

Devuelve: media, sources.

media.rewind (riesgo 2, modifica, smoke)​

Rewinds the player to the start of the opened media.

ArgumentoTipoDescripción
assetstringobligatorio.

Devuelve: media, sources.

media.seek (riesgo 2, modifica)​

Seeks the opened media to a time in seconds.

ArgumentoTipoDescripción
secondsnumberobligatorio.

Devuelve: media, sources.

media.set_loop (riesgo 2, modifica, smoke)​

Enables or disables looping on the player.

ArgumentoTipoDescripción
valuebooleanobligatorio.

Devuelve: media, sources.

media.set_rate (riesgo 2, modifica)​

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

ArgumentoTipoDescripción
ratenumberobligatorio.

Devuelve: media, sources.