UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
IMediaPlayer Class Referenceabstract

#include <IMediaPlayer.h>

Classes

class  IAsyncResourceReleaseNotification
 

Public Types

enum class  EFeatureFlag {
  AllowShutdownOnClose = 0 , UsePlaybackTimingV2 , UseRealtimeWithVideoOnly , AlwaysPullNewestVideoFrame ,
  PlayerUsesInternalFlushOnSeek , IsTrackSwitchSeamless , PlayerSelectsDefaultTracks
}
 
typedef TSharedRef< IAsyncResourceReleaseNotification, ESPMode::ThreadSafeIAsyncResourceReleaseNotificationRef
 

Public Member Functions

virtual void Close ()=0
 
virtual IMediaCacheGetCache ()=0
 
virtual IMediaControlsGetControls ()=0
 
virtual FString GetInfo () const =0
 
virtual FGuid GetPlayerPluginGUID () const =0
 
virtual IMediaSamplesGetSamples ()=0
 
virtual FString GetStats () const =0
 
virtual IMediaTracksGetTracks ()=0
 
virtual FString GetUrl () const =0
 
virtual IMediaViewGetView ()=0
 
virtual bool Open (const FString &Url, const IMediaOptions *Options)=0
 
virtual bool Open (const TSharedRef< FArchive, ESPMode::ThreadSafe > &Archive, const FString &OriginalUrl, const IMediaOptions *Options)=0
 
virtual bool Open (const FString &Url, const IMediaOptions *Options, const FMediaPlayerOptions *PlayerOptions)
 
virtual FVariant GetMediaInfo (FName InfoName) const
 
virtual TSharedPtr< TMap< FString, TArray< TUniquePtr< IMediaMetadataItem > > >, ESPMode::ThreadSafeGetMediaMetadata () const
 
virtual FText GetMediaName () const
 
virtual void SetGuid (const FGuid &Guid)
 
virtual bool SetNativeVolume (float Volume)
 
virtual void SetLastAudioRenderedSampleTime (FTimespan SampleTime)
 
virtual void TickAudio ()
 
virtual void TickFetch (FTimespan DeltaTime, FTimespan Timecode)
 
virtual void TickInput (FTimespan DeltaTime, FTimespan Timecode)
 
virtual bool FlushOnSeekStarted () const
 
virtual bool FlushOnSeekCompleted () const
 
virtual bool GetPlayerFeatureFlag (EFeatureFlag) const
 
virtual bool SetAsyncResourceReleaseNotification (IAsyncResourceReleaseNotificationRef AsyncDestructNotification)
 
virtual uint32 GetNewResourcesOnOpen () const
 
virtual ~IMediaPlayer ()
 

Detailed Description

Interface for media players.

See also
IMediaPlayerFactory

Member Typedef Documentation

◆ IAsyncResourceReleaseNotificationRef

Member Enumeration Documentation

◆ EFeatureFlag

Enumerator
AllowShutdownOnClose 

Allow player to be shutdown right after 'close' event is received from it.

UsePlaybackTimingV2 

Use v2 playback timing and AV sync.

UseRealtimeWithVideoOnly 

Use realtime rather then game deltatime to control video playback if no audio is present.

AlwaysPullNewestVideoFrame 

Mediaframework will not gate video frame output with its own timing, but assumes "ASAP" as output time for every sample.

PlayerUsesInternalFlushOnSeek 

The player implements an internal flush logic on seeks and Mediaframework will not issue an explicit Flush() call to it on seeks.

IsTrackSwitchSeamless 

If track switching is seamless then a flush of sinks is not necessary.

PlayerSelectsDefaultTracks 

Whether or not the player selects suitable track defaults.

Constructor & Destructor Documentation

◆ ~IMediaPlayer()

virtual IMediaPlayer::~IMediaPlayer ( )
inlinevirtual

Virtual destructor.

Member Function Documentation

◆ Close()

virtual void IMediaPlayer::Close ( )
pure virtual

Close a previously opened media source.

Call this method to free up all resources associated with an opened media source. If no media is open, this function has no effect.

The media may not necessarily be closed after this function succeeds, because closing may happen asynchronously. Subscribe to the MediaClosed event to detect when the media finished closing. This events is only triggered if Close returns true.

See also
IsReady, Open

◆ FlushOnSeekCompleted()

virtual bool IMediaPlayer::FlushOnSeekCompleted ( ) const
inlinevirtual

Flush sinks when seek ends

Returns
true if sinks should be flushed when a seek finishes

◆ FlushOnSeekStarted()

virtual bool IMediaPlayer::FlushOnSeekStarted ( ) const
inlinevirtual

Flush sinks when seek begins

Returns
true if sinks should be flushed when a seek starts

◆ GetCache()

virtual IMediaCache & IMediaPlayer::GetCache ( )
pure virtual

Get the player's cache controls.

The interface returned by this method must remain valid for the player's life time.

Returns
Cache controls.
See also
GetControls, GetSamples, GetTracks, GetView

◆ GetControls()

virtual IMediaControls & IMediaPlayer::GetControls ( )
pure virtual

Get the player's playback controls.

The interface returned by this method must remain valid for the player's life time.

Returns
Playback controls.
See also
GetCache, GetSamples, GetTracks, GetView

◆ GetInfo()

virtual FString IMediaPlayer::GetInfo ( ) const
pure virtual

Get debug information about the player and currently opened media.

Returns
Information string.
See also
GetStats

◆ GetMediaInfo()

virtual FVariant IMediaPlayer::GetMediaInfo ( FName  InfoName) const
inlinevirtual

Get information about the media that is playing.

Parameters
InfoNameName of the information we want.
Returns
Requested information, or empty if not available.
See also
UMediaPlayer::GetMediaInfo.

◆ GetMediaMetadata()

virtual TSharedPtr< TMap< FString, TArray< TUniquePtr< IMediaMetadataItem > > >, ESPMode::ThreadSafe > IMediaPlayer::GetMediaMetadata ( ) const
inlinevirtual

Gets the current metadata of the media source.

Metadata is optional and if present is typically a collection of key/value items without a well defined meaning. It may contain information on copyright, album name, artist and such, but the availability of any item is not mandatory and the representation will vary with the type of media. Interpretation therefor requires the application to be aware of the type of media being loaded and the possible metadata it may carry.

Metadata may change over time. Its presence or change is reported by a MetadataChanged event.

◆ GetMediaName()

virtual FText IMediaPlayer::GetMediaName ( ) const
inlinevirtual

Get the human readable name of the currently loaded media source.

Depending on the type of media source, this might be the name of a file, the display name of a capture device, or some other identifying string. If the player does not provide a specialized implementation for this method, the media name will be derived from the current media URL.

Returns
Media source name, or empty text if no media is opened
See also
GetPlayerName, GetUrl

◆ GetNewResourcesOnOpen()

virtual uint32 IMediaPlayer::GetNewResourcesOnOpen ( ) const
inlinevirtual

◆ GetPlayerFeatureFlag()

virtual bool IMediaPlayer::GetPlayerFeatureFlag ( EFeatureFlag  ) const
inlinevirtual

◆ GetPlayerPluginGUID()

virtual FGuid IMediaPlayer::GetPlayerPluginGUID ( ) const
pure virtual

Get the GUID for this player plugin.

Returns
Media player GUID (usually corresponds to a player name)
See also
GetPlayerName

◆ GetSamples()

virtual IMediaSamples & IMediaPlayer::GetSamples ( )
pure virtual

Get the player's sample queue.

The interface returned by this method must remain valid for the player's life time.

Returns
Cache interface.
See also
GetCache, GetControls, GetTracks, GetView

◆ GetStats()

virtual FString IMediaPlayer::GetStats ( ) const
pure virtual

Get playback statistics information.

Returns
Information string.
See also
GetInfo

◆ GetTracks()

virtual IMediaTracks & IMediaPlayer::GetTracks ( )
pure virtual

Get the player's track collection.

The interface returned by this method must remain valid for the player's life time.

Returns
Tracks interface.
See also
GetCache, GetControls, GetSamples, GetView

◆ GetUrl()

virtual FString IMediaPlayer::GetUrl ( ) const
pure virtual

Get the URL of the currently loaded media.

Returns
Media URL.

◆ GetView()

virtual IMediaView & IMediaPlayer::GetView ( )
pure virtual

Get the player's view settings.

The interface returned by this method must remain valid for the player's life time.

Returns
View interface.
See also
GetCache, GetControls, GetSamples, GetTracks

◆ Open() [1/3]

virtual bool IMediaPlayer::Open ( const FString &  Url,
const IMediaOptions Options 
)
pure virtual

Open a media source from a URL with optional parameters.

The media may not necessarily be opened after this function succeeds, because opening may happen asynchronously. Subscribe to the MediaOpened and MediaOpenFailed events to detect when the media finished or failed to open. These events are only triggered if Open returns true.

The optional parameters can be used to configure aspects of media playback and are specific to the type of media source and the underlying player. Check their documentation for available keys and values.

Parameters
UrlThe URL of the media to open (file name or web address).
OptionsOptional media parameters.
Returns
true if the media is being opened, false otherwise.
See also
Close, IsReady, OnOpen, OnOpenFailed

◆ Open() [2/3]

virtual bool IMediaPlayer::Open ( const FString &  Url,
const IMediaOptions Options,
const FMediaPlayerOptions PlayerOptions 
)
inlinevirtual

Open a media source from a URL with optional asset and player parameters.

◆ Open() [3/3]

virtual bool IMediaPlayer::Open ( const TSharedRef< FArchive, ESPMode::ThreadSafe > &  Archive,
const FString &  OriginalUrl,
const IMediaOptions Options 
)
pure virtual

Open a media source from a file or memory archive with optional parameters.

The media may not necessarily be opened after this function succeeds, because opening may happen asynchronously. Subscribe to the MediaOpened and MediaOpenFailed events to detect when the media finished or failed to open. These events are only triggered if Open returns true.

The optional parameters can be used to configure aspects of media playback and are specific to the type of media source and the underlying player. Check their documentation for available keys and values.

Parameters
ArchiveThe archive holding the media data.
OriginalUrlThe original URL of the media that was loaded into the buffer.
OptionsOptional media parameters.
Returns
true if the media is being opened, false otherwise.
See also
Close, IsReady, OnOpen, OnOpenFailed

◆ SetAsyncResourceReleaseNotification()

virtual bool IMediaPlayer::SetAsyncResourceReleaseNotification ( IAsyncResourceReleaseNotificationRef  AsyncDestructNotification)
inlinevirtual

Set async resource release notification for use with IMediaPlayerLifecycleManagerDelegate

◆ SetGuid()

virtual void IMediaPlayer::SetGuid ( const FGuid Guid)
inlinevirtual

Set the player's globally unique identifier.

Parameters
GuidThe GUID to set.

◆ SetLastAudioRenderedSampleTime()

virtual void IMediaPlayer::SetLastAudioRenderedSampleTime ( FTimespan  SampleTime)
inlinevirtual

Notify player of last sample time of audio used.

Parameters
SampleTimeThe last audio sample dequeued by one of the audio sinks.

◆ SetNativeVolume()

virtual bool IMediaPlayer::SetNativeVolume ( float  Volume)
inlinevirtual

Set the player's native volume if supported.

Parameters
VolumeThe volume to set.
Returns
true on success, false otherwise.

◆ TickAudio()

virtual void IMediaPlayer::TickAudio ( )
inlinevirtual

Tick the player's audio related code.

This is a high-frequency tick function. Media players override this method to fetch and process audio samples, or to perform other time critical tasks.

See also
TickInput, TickFetch

◆ TickFetch()

virtual void IMediaPlayer::TickFetch ( FTimespan  DeltaTime,
FTimespan  Timecode 
)
inlinevirtual

Tick the player in the Fetch phase.

Media players may override this method to fetch newly decoded input samples before they are rendered on textures or audio components.

Parameters
DeltaTimeTime since last tick.
TimecodeThe current media time code.
See also
TickAudio, TickInput

◆ TickInput()

virtual void IMediaPlayer::TickInput ( FTimespan  DeltaTime,
FTimespan  Timecode 
)
inlinevirtual

Tick the player in the Input phase.

Media players may override this method to update their state before the Engine is being ticked, or to initiate the processing of input samples.

Parameters
DeltaTimeTime since last tick.
TimecodeThe current media time code.
See also
TickAudio, TickFetch

The documentation for this class was generated from the following file: