Navigation
API > API/Runtime > API/Runtime/MediaAssets
Implements a media player asset that can play movies and other media sources.
| Name | UMediaPlayer |
| Type | class |
| Header File | /Engine/Source/Runtime/MediaAssets/Public/MediaPlayer.h |
| Include Path | #include "MediaPlayer.h" |
Syntax
UCLASS (BlueprintType, HideCategories=(Object), MinimalAPI)
class UMediaPlayer :
public UObject ,
public IAudioProxyDataFactory
Inheritance Hierarchy
- UObjectBase → UObjectBaseUtility → UObject → UMediaPlayer
Implements Interfaces
Constructors
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
UMediaPlayer
(
const FObjectInitializer& ObjectInitializer |
MediaPlayer.h |
Classes
| Name | Remarks |
|---|---|
| FOnMediaEvent | Get an event delegate that is invoked when a media event occurred. |
Constants
| Name | Type | Remarks | Include Path |
|---|---|---|---|
| MediaInfoNameKeyframeInterval | FLazyName | Keyframe interval. Int32. | MediaPlayer.h |
| MediaInfoNameSourceNumMips | FLazyName | These are possible common information for use with GetMediaInfo. | MediaPlayer.h |
| MediaInfoNameSourceNumTiles | FLazyName | Number of tiles (X and Y) in the source. IntPoint. | MediaPlayer.h |
| MediaInfoNameStartTimecodeFrameRate | FLazyName | Start Timecode frame rate. String. | MediaPlayer.h |
| MediaInfoNameStartTimecodeValue | FLazyName | Start Timecode. SMPTE format (ex: HH:MM:SS:FF) string. | MediaPlayer.h |
Variables
Public
| Name | Type | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|---|
| AffectedByPIEHandling | bool | Whether this player should stop when entering or exiting PIE. | MediaPlayer.h |
|
| CacheAhead | FTimespan | Duration of samples to cache ahead of the play head. | MediaPlayer.h |
|
| CacheBehind | FTimespan | Duration of samples to cache behind the play head (when not running as game). | MediaPlayer.h |
|
| CacheBehindGame | FTimespan | Duration of samples to cache behind the play head (when running as game). | MediaPlayer.h |
|
| NativeAudioOut | bool | Output any audio via the operating system's sound mixer instead of a Sound Wave asset. | MediaPlayer.h |
|
| OnBufferingCompleted | FOnMediaPlayerMediaEvent | A delegate that may be invoked when the player completes buffering data. | MediaPlayer.h |
|
| OnBufferingStart | FOnMediaPlayerMediaEvent | A delegate that is invoked when the player starts buffering data. | MediaPlayer.h |
|
| OnEndReached | FOnMediaPlayerMediaEvent | A delegate that is invoked when playback has reached the end of the media. | MediaPlayer.h |
|
| OnMediaClosed | FOnMediaPlayerMediaEvent | A delegate that is invoked when a media source has been closed. | MediaPlayer.h |
|
| OnMediaOpened | FOnMediaPlayerMediaOpened | A delegate that is invoked when a media source has been opened. | MediaPlayer.h |
|
| OnMediaOpenFailed | FOnMediaPlayerMediaOpenFailed | A delegate that is invoked when a media source has failed to open. | MediaPlayer.h |
|
| OnMetadataChanged | FOnMediaPlayerMediaEvent | A delegate that is invoked when the media metadata changed. | MediaPlayer.h |
|
| OnPlaybackResumed | FOnMediaPlayerMediaEvent | A delegate that is invoked when media playback has been resumed. | MediaPlayer.h |
|
| OnPlaybackSuspended | FOnMediaPlayerMediaEvent | A delegate that is invoked when media playback has been suspended. | MediaPlayer.h |
|
| OnSeekCompleted | FOnMediaPlayerMediaEvent | A delegate that is invoked when a seek operation completed successfully. | MediaPlayer.h |
|
| OnTracksChanged | FOnMediaPlayerMediaEvent | A delegate that is invoked when the media track collection changed. | MediaPlayer.h |
|
| PlayOnOpen | bool | Automatically start playback after media opened successfully. | MediaPlayer.h |
|
| Shuffle | uint32 | Whether playback should shuffle media sources in the play list. | MediaPlayer.h |
|
Protected
| Name | Type | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|---|
| MediaEvent | FOnMediaEvent | An event delegate that is invoked when a media event occurred. | MediaPlayer.h | |
| PlayerFacade | TSharedPtr< FMediaPlayerFacade, ESPMode::ThreadSafe > | The player facade. | MediaPlayer.h | |
| PlayerGuid | FGuid | The player's globally unique identifier. | MediaPlayer.h | |
| PlayOnNext | bool | Automatically start playback of next item in play list. | MediaPlayer.h | |
| Proxy | FMediaPlayerProxyPtr | Proxy instance for integration with Metasound | MediaPlayer.h | |
| RegisteredWithMediaModule | bool | Has registered with the media module | MediaPlayer.h | |
| WasPlayingInPIE | bool | Whether the player was playing in PIE/SIE. | MediaPlayer.h |
Functions
Public
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
bool CanPause () |
Check whether media playback can be paused right now. | MediaPlayer.h |
|
bool CanPlaySource
(
UMediaSource* MediaSource |
Check whether the specified media source can be played by this player. | MediaPlayer.h |
|
bool CanPlayUrl
(
const FString& Url |
Check whether the specified URL can be played by this player. | MediaPlayer.h |
|
void CleanUpBeforeDestroy () |
Clean up before this object is destroyed. | MediaPlayer.h | |
void Close () |
Close the currently open media, if any. | MediaPlayer.h |
|
int32 GetAudioTrackChannels
(
int32 TrackIndex, |
Get the number of channels in the specified audio track. | MediaPlayer.h |
|
int32 GetAudioTrackSampleRate
(
int32 TrackIndex, |
Get the sample rate of the specified audio track. | MediaPlayer.h |
|
FString GetAudioTrackType
(
int32 TrackIndex, |
Get the type of the specified audio track format. | MediaPlayer.h |
|
| Get the name of the current desired native player. | MediaPlayer.h |
|
|
| Get the media's current playback time as appropriate for display. | MediaPlayer.h |
|
|
| Get the media's current playback timestamp as appropriate for display. | MediaPlayer.h |
|
|
| Get the media's duration. | MediaPlayer.h |
|
|
const FGuid & GetGuid() |
Get the Guid associated with this media player | MediaPlayer.h | |
float GetHorizontalFieldOfView () |
Get the current horizontal field of view (only for 360 videos). | MediaPlayer.h |
|
bool GetMediaInfo
(
T& Result, |
Templated version of GetMediaInfo. No need to deal with variants. | MediaPlayer.h | |
FVariant GetMediaInfo
(
FName InfoName |
Get information about the media that is playing. | MediaPlayer.h | |
TSharedPtr< TMap< FString, TArray< TUniquePtr< IMediaMetadataItem > > >, ESPMode::ThreadSafe > GetMediaMetadata () |
Get meta data contained in the current stream | MediaPlayer.h | |
| This is the blueprint accessible version of the GetMediaMetadata. | MediaPlayer.h |
|
|
virtual FText GetMediaName () |
Get the human readable name of the currently loaded media source. | MediaPlayer.h |
|
int32 GetNumTrackFormats
(
EMediaPlayerTrack TrackType, |
Get the number of formats of the specified track. | MediaPlayer.h |
|
int32 GetNumTracks
(
EMediaPlayerTrack TrackType |
Get the number of tracks of the given type. | MediaPlayer.h |
|
TRange< FTimespan > GetPlaybackTimeRange
(
EMediaTimeRangeType InRangeToGet |
Returns the current playback range of the media. | MediaPlayer.h | |
FFloatInterval GetPlaybackTimeRange
(
EMediaTimeRangeBPType InRangeToGet |
Blueprint accessible version of GetPlaybackTimeRange. | MediaPlayer.h |
|
TSharedRef< FMediaPlayerFacade, ESPMode::ThreadSafe > GetPlayerFacade() |
Get the media player facade that manages low-level media players | MediaPlayer.h | |
| Get the name of the current native media player. | MediaPlayer.h |
|
|
| Get the current play list. | MediaPlayer.h |
|
|
int32 GetPlaylistIndex () |
Get the current play list index. | MediaPlayer.h |
|
| Get the current play list. | MediaPlayer.h | ||
float GetRate () |
Get the media's current playback rate. | MediaPlayer.h |
|
int32 GetSelectedTrack
(
EMediaPlayerTrack TrackType |
Get the index of the currently selected track of the given type. | MediaPlayer.h |
|
void GetSupportedRates
(
TArray< FFloatRange >& OutRates, |
Get the supported playback rates. | MediaPlayer.h |
|
| Get the media's current playback time. | MediaPlayer.h |
|
|
| Delay of the player's time. | MediaPlayer.h |
|
|
| Get the media's current playback timestamp. | MediaPlayer.h |
|
|
FText GetTrackDisplayName
(
EMediaPlayerTrack TrackType, |
Get the human readable name of the specified track. | MediaPlayer.h |
|
int32 GetTrackFormat
(
EMediaPlayerTrack TrackType, |
Get the index of the active format of the specified track type. | MediaPlayer.h |
|
FString GetTrackLanguage
(
EMediaPlayerTrack TrackType, |
Get the language tag of the specified track. | MediaPlayer.h |
|
| Get the URL of the currently loaded media, if any. | MediaPlayer.h |
|
|
float GetVerticalFieldOfView () |
Get the current vertical field of view (only for 360 videos). | MediaPlayer.h |
|
| Get the timecode from the video track, if one is available. | MediaPlayer.h | ||
float GetVideoTrackAspectRatio
(
int32 TrackIndex, |
Get the aspect ratio of the specified video track. | MediaPlayer.h |
|
FIntPoint GetVideoTrackDimensions
(
int32 TrackIndex, |
Get the current dimensions of the specified video track. | MediaPlayer.h |
|
float GetVideoTrackFrameRate
(
int32 TrackIndex, |
Get the frame rate of the specified video track. | MediaPlayer.h |
|
FFloatRange GetVideoTrackFrameRates
(
int32 TrackIndex, |
Get the supported range of frame rates of the specified video track. | MediaPlayer.h |
|
FString GetVideoTrackType
(
int32 TrackIndex, |
Get the type of the specified video track format. | MediaPlayer.h |
|
FRotator GetViewRotation () |
Get the current view rotation (only for 360 videos). | MediaPlayer.h |
|
bool HasError () |
Check whether the player is in an error state. | MediaPlayer.h |
|
bool IsBuffering () |
Check whether playback is buffering data. | MediaPlayer.h |
|
bool IsClosed() |
Whether media is currently closed. | MediaPlayer.h |
|
bool IsConnecting () |
Check whether the player is currently connecting to a media source. | MediaPlayer.h |
|
bool IsLooping () |
Check whether playback is looping. | MediaPlayer.h |
|
bool IsPaused () |
Check whether playback is currently paused. | MediaPlayer.h |
|
bool IsPlaying () |
Check whether playback has started. | MediaPlayer.h |
|
bool IsPreparing () |
Check whether the media is currently opening or buffering. | MediaPlayer.h |
|
bool IsReady () |
Check whether media is ready for playback. | MediaPlayer.h |
|
bool Next () |
Open the next item in the current play list. | MediaPlayer.h |
|
UMediaPlayer::FOnMediaEvent TBaseMulticastDelegate_OneParam OnMediaEvent() |
MediaPlayer.h | ||
| Opens the specified media file path. | MediaPlayer.h |
|
|
bool OpenPlaylist
(
UMediaPlaylist* InPlaylist |
Open the first media source in the specified play list. | MediaPlayer.h |
|
bool OpenPlaylistIndex
(
UMediaPlaylist* InPlaylist, |
Open a particular media source in the specified play list. | MediaPlayer.h |
|
bool OpenSource
(
UMediaSource* MediaSource |
Open the specified media source. | MediaPlayer.h |
|
void OpenSourceLatent
(
const UObject* WorldContextObject, |
Open the specified media source with options using a latent action. | MediaPlayer.h |
|
bool OpenSourceWithOptions
(
UMediaSource* MediaSource, |
Open the specified media source with supplied options applied. | MediaPlayer.h |
|
| Opens the specified media URL. | MediaPlayer.h |
|
|
bool Pause () |
Pauses media playback.This is the same as setting the playback rate to 0.0. | MediaPlayer.h |
|
void PausePIE () |
Called when PIE has been paused. | MediaPlayer.h | |
bool Play () |
Starts media playback.This is the same as setting the playback rate to 1.0. | MediaPlayer.h |
|
void PlayAndSeek() |
Starts playback from the media opened event, but can be used elsewhere. | MediaPlayer.h |
|
bool Previous () |
Open the previous item in the current play list. | MediaPlayer.h |
|
void RegisterWithMediaModule() |
Register player with media module to be ticked | MediaPlayer.h | |
bool Reopen () |
Reopens the currently opened media or play list. | MediaPlayer.h |
|
void ResumePIE () |
Called when PIE has been resumed. | MediaPlayer.h | |
bool Rewind () |
Rewinds the media to the beginning.This is the same as seeking to zero time. | MediaPlayer.h |
|
| Seeks to the specified playback time as soon as possible. | MediaPlayer.h |
|
|
| Seeks to the specified playback time. | MediaPlayer.h |
|
|
bool SelectTrack
(
EMediaPlayerTrack TrackType, |
Select the active track of the given type. | MediaPlayer.h |
|
void SetBlockOnTime
(
const FTimespan& Time |
Set the time on which to block. | MediaPlayer.h |
|
void SetBlockOnTimeRange
(
const TRange< FTimespan >& TimeRange |
Set the time range on which to block. | MediaPlayer.h | |
void SetDesiredPlayerName
(
FName PlayerName |
Set the name of the desired native player. | MediaPlayer.h |
|
bool SetLooping
(
bool Looping |
Enables or disables playback looping. | MediaPlayer.h |
|
void SetMediaOptions
(
const UMediaSource* Options |
Sets the media options used by the player. | MediaPlayer.h |
|
bool SetNativeVolume
(
float Volume |
Set the volume on the native player if not mixing with Sound Wave asset. | MediaPlayer.h |
|
bool SetPlaybackTimeRange
(
const TRange< FTimespan >& InTimeRange |
Sets a new media playback range. | MediaPlayer.h | |
bool SetPlaybackTimeRange
(
FFloatInterval InTimeRange |
Blueprint accessible version of SetPlaybackTimeRange(). | MediaPlayer.h |
|
bool SetRate
(
float Rate |
Changes the media's playback rate. | MediaPlayer.h |
|
void SetTimeDelay
(
FTimespan TimeDelay |
Delay of the player's time. | MediaPlayer.h |
|
bool SetTrackFormat
(
EMediaPlayerTrack TrackType, |
Set the format on the specified track. | MediaPlayer.h |
|
bool SetVideoTrackFrameRate
(
int32 TrackIndex, |
Set the frame rate of the specified video track. | MediaPlayer.h |
|
bool SetViewField
(
float Horizontal, |
Set the field of view (only for 360 videos). | MediaPlayer.h |
|
bool SetViewRotation
(
const FRotator& Rotation, |
Set the view's rotation (only for 360 videos). | MediaPlayer.h |
|
bool SupportsPlaybackTimeRange () |
Check whether the player supports playing back of range within the media. | MediaPlayer.h |
|
bool SupportsRate
(
float Rate, |
Check whether the specified playback rate is supported. | MediaPlayer.h |
|
bool SupportsScrubbing () |
Check whether the currently loaded media supports scrubbing. | MediaPlayer.h |
|
bool SupportsSeeking () |
Check whether the currently loaded media can jump to a certain position. | MediaPlayer.h |
|
void UnregisterWithMediaModule() |
When the player goes out of scope, make sure to clean up the clock sink | MediaPlayer.h |
Overridden from UObject
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
virtual void BeginDestroy() |
MediaPlayer.h | ||
virtual FString GetDesc() |
MediaPlayer.h | ||
virtual void PostDuplicate
(
bool bDuplicateForPIE |
MediaPlayer.h | ||
virtual void PostEditChangeProperty
(
FPropertyChangedEvent& PropertyChangedEvent |
MediaPlayer.h | ||
virtual void PostInitProperties() |
MediaPlayer.h | ||
virtual void PostLoad() |
MediaPlayer.h |
Overridden from IAudioProxyDataFactory
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
virtual TSharedPtr< Audio::IProxyData > CreateProxyData
(
const Audio::FProxyDataInitParams& InitParams |
IAudioProxyDataFactory interface (for Meta Sound support) | MediaPlayer.h |