Navigation
API > API/Runtime > API/Runtime/MediaUtils
Inheritance Hierarchy
- IMediaClockSink
- IMediaTickable
- IMediaEventSink
- TSharedFromThis
- FMediaPlayerFacade
References
| Module | MediaUtils |
| Header | /Engine/Source/Runtime/MediaUtils/Public/MediaPlayerFacade.h |
| Include | #include "MediaPlayerFacade.h" |
Syntax
class FMediaPlayerFacade :
public IMediaClockSink,
public IMediaTickable,
protected IMediaEventSink,
public TSharedFromThis< FMediaPlayerFacade, ESPMode::ThreadSafe >
Remarks
Facade for low-level media player objects.
The purpose of this class is to provide a simpler interface to low-level media player implementations. It implements common functionality, such as translating between time codes and play times, and manages the selection and creation of player implementations for a given media source.
Note that, unlike the low-level methods in IMediaTracks, most track and track format related methods in this class allow for INDEX_NONE to be used as track and format indices in order to indicate the 'current selection'.
Variables
| Type | Name | Description | |
|---|---|---|---|
| TOptional< FMediaPlayerOptions > | ActivePlayerOptions | Active media player options. | |
| FName | DesiredPlayerName | Name of the desired native player, if any. | |
| FTimespan | TimeDelay | Extra time to reduce from current player's time. |
Constructors
| Type | Name | Description | |
|---|---|---|---|
FMediaPlayerFacade
(
TWeakObjectPtr< UMediaPlayer > InMediaPlayer |
Default constructor. |
Destructors
| Type | Name | Description | |
|---|---|---|---|
| Virtual destructor. |
Functions
| Type | Name | Description | |
|---|---|---|---|
| void | AddAudioSampleSink
(
const TSharedRef< FMediaAudioSampleSink, ESPMode::ThreadSafe >& SampleSink |
Add the given audio sample sink to this player. | |
| void | AddCaptionSampleSink
(
const TSharedRef< FMediaOverlaySampleSink, ESPMode::ThreadSafe >& SampleSink |
Add the given audio sample sink to this player. | |
| void | AddMetadataSampleSink
(
const TSharedRef< FMediaBinarySampleSink, ESPMode::ThreadSafe >& SampleSink |
Add the given audio sample sink to this player. | |
| void | AddSubtitleSampleSink
(
const TSharedRef< FMediaOverlaySampleSink, ESPMode::ThreadSafe >& SampleSink |
Add the given audio sample sink to this player. | |
| void | AddVideoSampleSink
(
const TSharedRef< FMediaTextureSampleSink, ESPMode::ThreadSafe >& SampleSink |
Add the given audio sample sink to this player. | |
| bool | BlockOnFetch () |
Whether sample fetching should block. | |
| bool | CanPause () |
Whether playback can be paused. | |
| bool | CanPlayUrl
(
const FString& Url, |
Whether the specified URL can be played by this player. | |
| bool | CanResume () |
Whether playback can be resumed. | |
| bool | CanScrub () |
Whether playback can be scrubbed. | |
| bool | CanSeek () |
Whether playback can jump to a position. | |
| void | Close () |
Close the currently open media, if any. | |
| void | Flush
(
bool bExcludePlayer, |
Flush all media sample sinks & player plugin. | |
| uint32 | GetAudioTrackChannels
(
int32 TrackIndex, |
Get the number of channels in the specified audio track. | |
| bool | GetAudioTrackFormat
(
int32 TrackIndex, |
Get details about the specified audio track format. | |
| uint32 | GetAudioTrackSampleRate
(
int32 TrackIndex, |
Get the sample rate of the specified audio track. | |
| FString | GetAudioTrackType
(
int32 TrackIndex, |
Get the type of the specified audio track format. | |
| FMediaTimeStamp | Get the media's current playback time stamp in a "display" version | ||
| FTimespan | GetDuration () |
Get the media's duration. | |
| const FGuid & | GetGuid () |
Get the player's globally unique identifier. | |
| FString | GetInfo () |
Get debug information about the player and currently opened media. | |
| FTimespan | Get time of last audio sample played | ||
| FVariant | GetMediaInfo
(
FName InfoName |
Get information about the media that is playing. | |
| TSharedPtr< TMap< FString, TArray< TUniquePtr< IMediaMetadataItem > > >, ESPMode::ThreadSafe > | Get meta data contained in the current stream | ||
| FText | GetMediaName () |
Get the human readable name of the currently loaded media source. | |
| int32 | GetNumTrackFormats
(
EMediaTrackType TrackType, |
Get the number of formats of the specified track. | |
| int32 | GetNumTracks
(
EMediaTrackType TrackType |
Get the number of tracks of the given type. | |
| TSharedPtr< IMediaPlayer, ESPMode::ThreadSafe > | GetPlayer () |
Get the low-level player associated with this object. | |
| IMediaPlayerFactory * | GetPlayerFactoryForUrl
(
const FString& Url, |
Get a player that can play the specified media URL. | |
| FName | Get the name of the current native media player. | ||
| float | GetRate () |
Get the media's current playback rate. | |
| int32 | GetSelectedTrack
(
EMediaTrackType TrackType |
Get the index of the currently selected track of the given type. | |
| FString | GetStats () |
Get playback statistics information. | |
| TRangeSet< float > | GetSupportedRates
(
bool Unthinned |
Get the supported playback rates. | |
| FTimespan | GetTime () |
Get the media's current playback time. | |
| FMediaTimeStamp | GetTimeStamp () |
Get the media's current playback time stamp. | |
| FMediaTimeStamp | GetTimeStampInternal
(
bool bForDisplay |
Internal function to retrieve the current timestamp | |
| FText | GetTrackDisplayName
(
EMediaTrackType TrackType, |
Get the human readable name of the specified track. | |
| int32 | GetTrackFormat
(
EMediaTrackType TrackType, |
Get the index of the active format of the specified track. | |
| FString | GetTrackLanguage
(
EMediaTrackType TrackType, |
Get the language tag of the specified track. | |
| float | |||
| const FString & | GetUrl () |
Get the URL of the currently loaded media, if any. | |
| float | GetVideoTrackAspectRatio
(
int32 TrackIndex, |
Get the aspect ratio of the specified video track. | |
| FIntPoint | GetVideoTrackDimensions
(
int32 TrackIndex, |
Get the width and height of the specified video track. | |
| bool | GetVideoTrackFormat
(
int32 TrackIndex, |
Get details about the specified audio track format. | |
| float | GetVideoTrackFrameRate
(
int32 TrackIndex, |
Get frame rate of the specified video track. | |
| TRange< float > | GetVideoTrackFrameRates
(
int32 TrackIndex, |
Get the supported range of frame rates of the specified video track. | |
| FString | GetVideoTrackType
(
int32 TrackIndex, |
Get the type of the specified video track format. | |
| bool | GetViewField
(
float& OutHorizontal, |
Get the field of view. | |
| bool | GetViewOrientation
(
FQuat& OutOrientation |
Get the view's orientation. | |
| bool | HasError () |
Check whether the player is in an error state. | |
| bool | |||
| bool | |||
| bool | IsBuffering () |
Whether the player is currently buffering data. | |
| bool | IsClosed () |
Whether media is currently closed. | |
| bool | IsConnecting () |
Whether the player is currently connecting to a media source. | |
| bool | IsLooping () |
Whether playback is looping. | |
| bool | IsPaused () |
Whether playback is currently paused. | |
| bool | IsPlaying () |
Whether playback is in progress. | |
| bool | IsPreparing () |
Whether the media is currently opening or buffering. | |
| bool | IsReady () |
Whether media is ready for playback. | |
| FMediaPlayerFacade::FOnMediaEvent TBaseMulticastDelegate_OneParam | OnMediaEvent () |
||
| bool | Open
(
const FString& Url, |
Open a media source from a URL with optional parameters. | |
| void | ProcessEvent
(
EMediaEvent Event, |
Process the given media event. | |
| void | QueryCacheState
(
EMediaTrackType TrackType, |
Query the time ranges of cached media samples for the specified caching state. | |
| bool | Seeks to the specified playback time. | ||
| bool | SelectTrack
(
EMediaTrackType TrackType, |
Select the active track of the given type. | |
| void | SetAreEventsSafeForAnyThread
(
bool bInAreEventsSafeForAnyThread |
Sets whether the player can broadcast events when running on a thread other than the game thread. | |
| void | SetBlockOnTime
(
const FTimespan& Time |
Set the time on which to block. | |
| void | SetBlockOnTimeRange
(
const TRange< FTimespan >& TimeRange |
Set the time range on which to block. | |
| void | SetCacheWindow
(
FTimespan Ahead, |
Set sample caching options. | |
| void | Set the player's globally unique identifier. | ||
| void | SetLastAudioRenderedSampleTime
(
FTimespan SampleTime |
Record last audio sample played to track audio sync (for automated tests) | |
| bool | SetLooping
(
bool Looping |
Enables or disables playback looping. | |
| void | SetMediaOptions
(
const IMediaOptions* Options |
Changes media ooptions on the player. | |
| bool | SetNativeVolume
(
float Volume |
Changes the media's native volume. | |
| bool | SetRate
(
float Rate |
Changes the media's playback rate. | |
| bool | SetTrackFormat
(
EMediaTrackType TrackType, |
Set the format on the specified track. | |
| bool | SetVideoTrackFrameRate
(
int32 TrackIndex, |
Set the frame rate of the specified video track. | |
| bool | SetViewField
(
float Horizontal, |
Set the field of view. | |
| bool | SetViewOrientation
(
const FQuat& Orientation, |
Set the view's orientation. | |
| bool | SupportsRate
(
float Rate, |
Whether the specified playback rate is supported. |
Overridden from IMediaClockSink
| Type | Name | Description | |
|---|---|---|---|
| void | Called each tick to handle updates after the Engine ticked. | ||
| void | Called each tick to handle input before the Engine is ticked. | ||
| void | TickOutput
(
FTimespan DeltaTime, |
Called each tick to output the rendered frame. |
Overridden from IMediaTickable
| Type | Name | Description | |
|---|---|---|---|
| void | TickTickable () |
Tick the object. |
Overridden from IMediaEventSink
| Type | Name | Description | |
|---|---|---|---|
| void | ReceiveMediaEvent
(
EMediaEvent Event |
Receive the given media event. |
Classes
| Type | Name | Description | |
|---|---|---|---|
| FOnMediaEvent | Get an event delegate that is invoked when a media event occurred. |