Navigation
API > API/Runtime > API/Runtime/MediaUtils
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'.
| Name | FMediaPlayerFacade |
| Type | class |
| Header File | /Engine/Source/Runtime/MediaUtils/Public/MediaPlayerFacade.h |
| Include Path | #include "MediaPlayerFacade.h" |
Syntax
class FMediaPlayerFacade :
public IMediaClockSink ,
public IMediaTickable ,
protected IMediaEventSink ,
public TSharedFromThis< FMediaPlayerFacade, ESPMode::ThreadSafe >
Inheritance Hierarchy
- FSharedFromThisBase → TSharedFromThis → FMediaPlayerFacade
Implements Interfaces
Constructors
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
FMediaPlayerFacade
(
TWeakObjectPtr< UMediaPlayer > InMediaPlayer |
Default constructor. | MediaPlayerFacade.h |
Destructors
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
virtual ~FMediaPlayerFacade() |
Virtual destructor. | MediaPlayerFacade.h |
Classes
| Name | Remarks |
|---|---|
| FBlockOnRange | |
| FOnMediaEvent | Get an event delegate that is invoked when a media event occurred. |
Structs
| Name | Remarks |
|---|---|
| FTrackSelection |
Variables
Public
| Name | Type | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|---|
| ActivePlayerOptions | TOptional< FMediaPlayerOptions > | Active media player options. | MediaPlayerFacade.h | |
| DesiredPlayerName | FName | Name of the desired native player, if any. | MediaPlayerFacade.h | |
| TimeDelay | FTimespan | Extra time to reduce from current player's time. | MediaPlayerFacade.h |
Protected
| Name | Type | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|---|
| AudioSampleAvailability | int32 | MediaPlayerFacade.h | ||
| AudioSampleSinks | FMediaAudioSampleSinks | MediaPlayerFacade.h | ||
| bAreEventsSafeForAnyThread | bool | If true, then we can send out events even if we are not on the game thread. | MediaPlayerFacade.h | |
| bDidRecentPlayerHaveError | bool | Latch for error state of the most recently used player to be queried after it may have been closed. | MediaPlayerFacade.h | |
| bHaveActiveAudio | bool | Flag indicating that we have an active audio setup | MediaPlayerFacade.h | |
| BlockOnRange | FBlockOnRange | MediaPlayerFacade.h | ||
| BlockOnRangeDisabled | bool | Flag to indicate block on range feature as disabled for the current playback session due to previous timeout | MediaPlayerFacade.h | |
| Cache | FMediaSampleCache * | Media sample cache. | MediaPlayerFacade.h | |
| CaptionSampleSinks | FMediaOverlaySampleSinks | Caption sample sinks. | MediaPlayerFacade.h | |
| CriticalSection | FCriticalSection | Synchronizes access to Player. | MediaPlayerFacade.h | |
| CurrentFrameAudioTimeStamp | FMediaTimeStamp | Timestamp for audio considered "current" for this frame (use ONLY for return to outside code) | MediaPlayerFacade.h | |
| CurrentFrameVideoDisplayTimeStamp | FMediaTimeStamp | Timestamp for video considered "current" for this frame for GUI / display purposes (stays valid even after a flush, until new data comes in) | MediaPlayerFacade.h | |
| CurrentFrameVideoTimeStamp | FMediaTimeStamp | Timestamp for video considered "current" for this frame (stays valid even after a flush, until new data comes in) | MediaPlayerFacade.h | |
| CurrentRate | float | The last rate set with the facade (unfiltered by player). | MediaPlayerFacade.h | |
| CurrentUrl | FString | The URL of the currently loaded media source. | MediaPlayerFacade.h | |
| LastAudioRenderedSampleTime | FMediaTimeStampSample | Time of last audio sample played. | MediaPlayerFacade.h | |
| LastAudioSampleProcessedTime | FMediaTimeStampSample | Time of last audio sample decoded. | MediaPlayerFacade.h | |
| LastRate | float | The last used non-zero play rate (zero if playback never started). | MediaPlayerFacade.h | |
| LastVideoSampleProcessedTimeRange | TRange< FMediaTimeStamp > | Time/Range of last video sample decoded. | MediaPlayerFacade.h | |
| LifecycleManagerDelegateControl | IMediaPlayerLifecycleManagerDelegate::IControlRef | Control interface for lifecycle manager delegate | MediaPlayerFacade.h | |
| MediaEvent | FOnMediaEvent | An event delegate that is invoked when a media event occurred. | MediaPlayerFacade.h | |
| MediaModule | IMediaModule * | Mediamodule we are working in | MediaPlayerFacade.h | |
| MediaPlayer | TWeakObjectPtr< UMediaPlayer > | UMediaplayer we are working with | MediaPlayerFacade.h | |
| MetadataSampleSinks | FMediaBinarySampleSinks | Metadata sample sinks. | MediaPlayerFacade.h | |
| MostRecentlyDeliveredVideoFrameTimecode | TOptional< FTimecode > | Timecode of the video frame most recently delivered to the video sinks | MediaPlayerFacade.h | |
| NextEstVideoTimeAtFrameStart | FMediaTimeStampSample | Estimation for next frame's video timestamp (used when no audio present or active in stream) | MediaPlayerFacade.h | |
| NextSeekTime | TOptional< FTimespan > | When multiple consecutive seek are issued while seeking, we keep track of the most recent request. | MediaPlayerFacade.h | |
| NextSequenceIndex | TOptional< int32 > | The next sequence index value we expect to see on the samples provided by a v2 timing enabled player. | MediaPlayerFacade.h | |
| NextVideoSampleTime | FTimespan | Time of the next expected video sample (used for block on fetch). | MediaPlayerFacade.h | |
| Player | TSharedPtr< IMediaPlayer, ESPMode::ThreadSafe > | The low-level player used to play the media source. | MediaPlayerFacade.h | |
| PlayerGuid | FGuid | Media player Guid | MediaPlayerFacade.h | |
| PlayerInstanceID | uint64 | Low level player instance ID | MediaPlayerFacade.h | |
| PlayerUsesResourceReleaseNotification | bool | Low level player will use callback to notify of resource release | MediaPlayerFacade.h | |
| PrimaryAudioSink | TWeakPtr< FMediaAudioSampleSink, ESPMode::ThreadSafe > | Audio sample sinks. | MediaPlayerFacade.h | |
| QueuedEventBroadcasts | TQueue< EMediaEvent, EQueueMode::Spsc > | Queue to hold events that we could not broadcast yet. | MediaPlayerFacade.h | |
| QueuedEvents | TQueue< EMediaEvent, EQueueMode::Mpsc > | Media player event queue. | MediaPlayerFacade.h | |
| SeekTargetTime | FMediaTimeStamp | Timestamp of seek target location if seek is pending | MediaPlayerFacade.h | |
| SubtitleSampleSinks | FMediaOverlaySampleSinks | Subtitle sample sinks. | MediaPlayerFacade.h | |
| TimeValueLock | FCriticalSection | CS to make last time values below thread safe | MediaPlayerFacade.h | |
| TrackSelection | FMediaPlayerFacade::FTrackSelection | MediaPlayerFacade.h | ||
| VideoSampleAvailability | int32 | Flag indicating the current availability of media samples. | MediaPlayerFacade.h | |
| VideoSampleSinks | FMediaVideoSampleSinks | Video sample sinks. | MediaPlayerFacade.h |
Functions
Public
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
void AddAudioSampleSink
(
const TSharedRef< FMediaAudioSampleSink, ESPMode::ThreadSafe >& SampleSink |
Add the given audio sample sink to this player. | MediaPlayerFacade.h | |
void AddCaptionSampleSink
(
const TSharedRef< FMediaOverlaySampleSink, ESPMode::ThreadSafe >& SampleSink |
Add the given audio sample sink to this player. | MediaPlayerFacade.h | |
void AddMetadataSampleSink
(
const TSharedRef< FMediaBinarySampleSink, ESPMode::ThreadSafe >& SampleSink |
Add the given audio sample sink to this player. | MediaPlayerFacade.h | |
void AddSubtitleSampleSink
(
const TSharedRef< FMediaOverlaySampleSink, ESPMode::ThreadSafe >& SampleSink |
Add the given audio sample sink to this player. | MediaPlayerFacade.h | |
void AddVideoSampleSink
(
const TSharedRef< FMediaTextureSampleSink, ESPMode::ThreadSafe >& SampleSink |
Add the given audio sample sink to this player. | MediaPlayerFacade.h | |
bool CanPause () |
Whether playback can be paused. | MediaPlayerFacade.h | |
bool CanPlayUrl
(
const FString& Url, |
Whether the specified URL can be played by this player. | MediaPlayerFacade.h | |
bool CanResume () |
Whether playback can be resumed. | MediaPlayerFacade.h | |
bool CanScrub () |
Whether playback can be scrubbed. | MediaPlayerFacade.h | |
bool CanSeek () |
Whether playback can jump to a position. | MediaPlayerFacade.h | |
void Close() |
Close the currently open media, if any. | MediaPlayerFacade.h | |
uint32 GetAudioTrackChannels
(
int32 TrackIndex, |
Get the number of channels in the specified audio track. | MediaPlayerFacade.h | |
uint32 GetAudioTrackSampleRate
(
int32 TrackIndex, |
Get the sample rate of the specified audio track. | MediaPlayerFacade.h | |
FString GetAudioTrackType
(
int32 TrackIndex, |
Get the type of the specified audio track format. | MediaPlayerFacade.h | |
| Get the media's current playback time stamp in a "display" version | MediaPlayerFacade.h | ||
| Get the media's duration. | MediaPlayerFacade.h | ||
| Get the player's globally unique identifier. | MediaPlayerFacade.h | ||
| Get debug information about the player and currently opened media. | MediaPlayerFacade.h | ||
FTimespan GetLastAudioRenderedSampleTime() |
Get time of last audio sample played | MediaPlayerFacade.h | |
TRange< FMediaTimeStamp > GetLastProcessedVideoSampleTimeRange() |
Returns the last video sample time range that has been enqueued in the video sink. | MediaPlayerFacade.h | |
FVariant GetMediaInfo
(
FName InfoName |
Get information about the media that is playing. | MediaPlayerFacade.h | |
TSharedPtr< TMap< FString, TArray< TUniquePtr< IMediaMetadataItem > > >, ESPMode::ThreadSafe > GetMediaMetadata () |
Get meta data contained in the current stream | MediaPlayerFacade.h | |
| Get the human readable name of the currently loaded media source. | MediaPlayerFacade.h | ||
int32 GetNumTrackFormats
(
EMediaTrackType TrackType, |
Get the number of formats of the specified track. | MediaPlayerFacade.h | |
int32 GetNumTracks
(
EMediaTrackType TrackType |
Get the number of tracks of the given type. | MediaPlayerFacade.h | |
TRange< FTimespan > GetPlaybackTimeRange
(
EMediaTimeRangeType InRangeToGet |
Returns the current playback range of the media. | MediaPlayerFacade.h | |
TSharedPtr< IMediaPlayer, ESPMode::ThreadSafe > GetPlayer() |
Get the low-level player associated with this object. | MediaPlayerFacade.h | |
| Get the name of the current native media player. | MediaPlayerFacade.h | ||
float GetRate () |
Get the media's current playback rate. | MediaPlayerFacade.h | |
| If valid, returns the current seek request. | MediaPlayerFacade.h | ||
int32 GetSelectedTrack
(
EMediaTrackType TrackType |
Get the index of the currently selected track of the given type. | MediaPlayerFacade.h | |
| Get playback statistics information. | MediaPlayerFacade.h | ||
TRangeSet< float > GetSupportedRates
(
bool Unthinned |
Get the supported playback rates. | MediaPlayerFacade.h | |
| Get the media's current playback time. | MediaPlayerFacade.h | ||
FMediaTimeStamp GetTimeStamp() |
Get the media's current playback time stamp. | MediaPlayerFacade.h | |
FText GetTrackDisplayName
(
EMediaTrackType TrackType, |
Get the human readable name of the specified track. | MediaPlayerFacade.h | |
int32 GetTrackFormat
(
EMediaTrackType TrackType, |
Get the index of the active format of the specified track. | MediaPlayerFacade.h | |
FString GetTrackLanguage
(
EMediaTrackType TrackType, |
Get the language tag of the specified track. | MediaPlayerFacade.h | |
const FString & GetUrl() |
Get the URL of the currently loaded media, if any. | MediaPlayerFacade.h | |
| Get the timecode from the video track, if one is available. | MediaPlayerFacade.h | ||
float GetVideoTrackAspectRatio
(
int32 TrackIndex, |
Get the aspect ratio of the specified video track. | MediaPlayerFacade.h | |
FIntPoint GetVideoTrackDimensions
(
int32 TrackIndex, |
Get the width and height of the specified video track. | MediaPlayerFacade.h | |
float GetVideoTrackFrameRate
(
int32 TrackIndex, |
Get frame rate of the specified video track. | MediaPlayerFacade.h | |
TRange< float > GetVideoTrackFrameRates
(
int32 TrackIndex, |
Get the supported range of frame rates of the specified video track. | MediaPlayerFacade.h | |
FString GetVideoTrackType
(
int32 TrackIndex, |
Get the type of the specified video track format. | MediaPlayerFacade.h | |
bool GetViewField
(
float& OutHorizontal, |
Get the field of view. | MediaPlayerFacade.h | |
bool GetViewOrientation
(
FQuat& OutOrientation |
Get the view's orientation. | MediaPlayerFacade.h | |
bool HasError () |
Check whether the player is in an error state. | MediaPlayerFacade.h | |
bool IsBuffering () |
Whether the player is currently buffering data. | MediaPlayerFacade.h | |
bool IsClosed() |
Whether media is currently closed. | MediaPlayerFacade.h | |
bool IsConnecting () |
Whether the player is currently connecting to a media source. | MediaPlayerFacade.h | |
bool IsLooping () |
Whether playback is looping. | MediaPlayerFacade.h | |
bool IsPaused () |
Whether playback is currently paused. | MediaPlayerFacade.h | |
bool IsPlaying () |
Whether playback is in progress. | MediaPlayerFacade.h | |
bool IsPreparing () |
Whether the media is currently opening or buffering. | MediaPlayerFacade.h | |
bool IsReady () |
Whether media is ready for playback. | MediaPlayerFacade.h | |
bool IsSeeking () |
A seek has been requested, waiting to receive samples. | MediaPlayerFacade.h | |
FMediaPlayerFacade::FOnMediaEvent TBaseMulticastDelegate_OneParam OnMediaEvent() |
MediaPlayerFacade.h | ||
bool Open
(
const FString& Url, |
Open a media source from a URL with optional parameters. | MediaPlayerFacade.h | |
void QueryCacheState
(
EMediaTrackType TrackType, |
Query the time ranges of cached media samples for the specified caching state. | MediaPlayerFacade.h | |
| Seeks to the specified playback time. | MediaPlayerFacade.h | ||
bool SelectTrack
(
EMediaTrackType TrackType, |
Select the active track of the given type. | MediaPlayerFacade.h | |
void SetAreEventsSafeForAnyThread
(
bool bInAreEventsSafeForAnyThread |
Sets whether the player can broadcast events when running on a thread other than the game thread. | MediaPlayerFacade.h | |
void SetBlockOnTime
(
const FTimespan& Time |
Set the time on which to block. | MediaPlayerFacade.h | |
void SetBlockOnTimeRange
(
const TRange< FTimespan >& TimeRange |
Set the time range on which to block. | MediaPlayerFacade.h | |
| Set sample caching options. | MediaPlayerFacade.h | ||
| Set the player's globally unique identifier. | MediaPlayerFacade.h | ||
void SetLastAudioRenderedSampleTime
(
FTimespan SampleTime |
Record last audio sample played to track audio sync (for automated tests) | MediaPlayerFacade.h | |
bool SetLooping
(
bool Looping |
Enables or disables playback looping. | MediaPlayerFacade.h | |
void SetMediaOptions
(
const IMediaOptions* Options |
Changes media ooptions on the player. | MediaPlayerFacade.h | |
bool SetNativeVolume
(
float Volume |
Changes the media's native volume. | MediaPlayerFacade.h | |
void SetNextSeek
(
const FTimespan& InTime |
Set seek to be done after current seek is completed. | MediaPlayerFacade.h | |
bool SetPlaybackTimeRange
(
const TRange< FTimespan >& InTimeRange |
Sets a new media playback range. | MediaPlayerFacade.h | |
bool SetRate
(
float Rate |
Changes the media's playback rate. | MediaPlayerFacade.h | |
bool SetTrackFormat
(
EMediaTrackType TrackType, |
Set the format on the specified track. | MediaPlayerFacade.h | |
bool SetVideoTrackFrameRate
(
int32 TrackIndex, |
Set the frame rate of the specified video track. | MediaPlayerFacade.h | |
bool SetViewField
(
float Horizontal, |
Set the field of view. | MediaPlayerFacade.h | |
bool SetViewOrientation
(
const FQuat& Orientation, |
Set the view's orientation. | MediaPlayerFacade.h | |
bool SupportsPlaybackTimeRange () |
Check whether the player supports playing back of range within the media. | MediaPlayerFacade.h | |
bool SupportsRate
(
float Rate, |
Whether the specified playback rate is supported. | MediaPlayerFacade.h |
Overridden from IMediaClockSink
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
| MediaPlayerFacade.h | |||
| MediaPlayerFacade.h | |||
| MediaPlayerFacade.h |
Overridden from IMediaTickable
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
virtual void TickTickable() |
MediaPlayerFacade.h |
Protected
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
bool BlockOnFetch() |
Whether sample fetching should block. | MediaPlayerFacade.h | |
void Flush
(
bool bExcludePlayer, |
Flush all media sample sinks & player plugin. | MediaPlayerFacade.h | |
bool GetAudioTrackFormat
(
int32 TrackIndex, |
Get details about the specified audio track format. | MediaPlayerFacade.h | |
IMediaPlayerFactory * GetPlayerFactoryForUrl
(
const FString& Url, |
Get a player that can play the specified media URL. | MediaPlayerFacade.h | |
FMediaTimeStamp GetTimeStampInternal
(
bool bForDisplay |
Internal function to retrieve the current timestamp | MediaPlayerFacade.h | |
float GetUnpausedRate() |
MediaPlayerFacade.h | ||
bool GetVideoTrackFormat
(
int32 TrackIndex, |
Get details about the specified audio track format. | MediaPlayerFacade.h | |
bool HaveAudioPlayback() |
MediaPlayerFacade.h | ||
bool HaveVideoPlayback() |
MediaPlayerFacade.h | ||
void ProcessEvent
(
EMediaEvent Event, |
Process the given media event. | MediaPlayerFacade.h |
Overridden from IMediaEventSink
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
virtual void ReceiveMediaEvent
(
EMediaEvent Event |
MediaPlayerFacade.h |