Pular para o conteúdo principal

Kit media

16 ferramentas. Gerado a partir do código-fonte do plugin; não edite manualmente.

As descrições das ferramentas e dos argumentos são exibidas em inglês porque espelham o schema das ferramentas (o mesmo texto que o agente recebe em tools/list).

Guia​

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.

Ferramentas​

Legenda. risco 0 = somente leitura, 1 = operação inofensiva do editor, 2 = altera asset, 3 = apaga/substitui asset, 4 = projeto/config/build, 5 = potencialmente destrutivo (chamadas acima de MaxAutoRisk exigem "_confirm": true). altera = roda numa transação (edit.undo reverte). requer PIE / requer mundo = recusado sem sessão PIE / sem nível aberto. requer plugin = indisponível quando o plugin está desativado. dryRun = aceita o argumento dryRun. smoke = coberto por edit.self_test.

media.add_playlist_source (risco 2, altera, smoke)​

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

ArgumentoTipoDescrição
sourcestringMediaSource asset path (required to add).
indexintegerPlaylist index; -1 appends when adding. Padrão -1.

Retorna: media, sources.

media.audit_assets (risco 0, smoke)​

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

ArgumentoTipoDescrição
assetstringobrigatório.

Retorna: media, sources.

media.close (risco 2, altera, smoke)​

Closes the media opened by the player.

ArgumentoTipoDescrição
assetstringobrigatório.

Retorna: media, sources.

media.create_player (risco 2, altera, smoke)​

Creates a MediaPlayer asset. Returns the player state.

ArgumentoTipoDescrição
folderstringobrigatório.
namestringobrigatório.

Retorna: media, sources.

media.create_playlist (risco 2, altera, smoke)​

Creates an empty MediaPlaylist asset.

ArgumentoTipoDescrição
folderstringobrigatório.
namestringobrigatório.

Retorna: media, sources.

media.create_source (risco 2, altera, 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.

ArgumentoTipoDescrição
folderstringobrigatório. Content folder under /Game.
namestringobrigatório. Bare asset name.
kindstringfile or stream. Padrão TEXT("file").
urlstringobrigatório. File path (file) or stream URL (stream).

Retorna: media, sources.

media.get_source (risco 0, smoke)​

Returns the URL of a MediaSource asset.

ArgumentoTipoDescrição
assetstringobrigatório.

Retorna: media, sources.

media.get_state (risco 0, smoke)​

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

ArgumentoTipoDescrição
assetstringobrigatório.

Retorna: media, sources.

media.list_playlist (risco 0, smoke)​

Lists the media sources of a MediaPlaylist in order.

ArgumentoTipoDescrição
assetstringobrigatório.

Retorna: media, sources.

media.pause (risco 2, altera, smoke)​

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

ArgumentoTipoDescrição
assetstringobrigatório.

Retorna: media, sources.

media.play (risco 2, altera)​

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

ArgumentoTipoDescrição
assetstringobrigatório.

Retorna: media, sources.

media.remove_playlist_source (risco 2, altera, smoke)​

Removes the playlist entry at index.

ArgumentoTipoDescrição
sourcestringMediaSource asset path (required to add).
indexintegerPlaylist index; -1 appends when adding. Padrão -1.

Retorna: media, sources.

media.rewind (risco 2, altera, smoke)​

Rewinds the player to the start of the opened media.

ArgumentoTipoDescrição
assetstringobrigatório.

Retorna: media, sources.

media.seek (risco 2, altera)​

Seeks the opened media to a time in seconds.

ArgumentoTipoDescrição
secondsnumberobrigatório.

Retorna: media, sources.

media.set_loop (risco 2, altera, smoke)​

Enables or disables looping on the player.

ArgumentoTipoDescrição
valuebooleanobrigatório.

Retorna: media, sources.

media.set_rate (risco 2, altera)​

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

ArgumentoTipoDescrição
ratenumberobrigatório.

Retorna: media, sources.