Navigation
API > API/Runtime > API/Runtime/MediaAssets
Inheritance Hierarchy
- UObjectBase
- UObjectBaseUtility
- UObject
- UMediaPlayer
References
| Module | MediaAssets |
| Header | /Engine/Source/Runtime/MediaAssets/Public/MediaPlayer.h |
| Include | #include "MediaPlayer.h" |
Syntax
class UMediaPlayer :
public UObject,
public IAudioProxyDataFactory
Remarks
Implements a media player asset that can play movies and other media sources.
Variables
| Type | Name | Description | |
|---|---|---|---|
| bool | AffectedByPIEHandling | Whether this player should stop when entering or exiting PIE. | |
| FTimespan | CacheAhead | Duration of samples to cache ahead of the play head. | |
| FTimespan | CacheBehind | Duration of samples to cache behind the play head (when not running as game). | |
| FTimespan | CacheBehindGame | Duration of samples to cache behind the play head (when running as game). | |
| float | HorizontalFieldOfView | The initial horizontal field of view (in Euler degrees; default = 90). | |
| uint32: 1 | Loop | Whether the player should loop when media playback reaches the end. | |
| bool | NativeAudioOut | Output any audio via the operating system's sound mixer instead of a Sound Wave asset. | |
| FOnMediaPlayerMediaEvent | OnEndReached | A delegate that is invoked when playback has reached the end of the media. | |
| FOnMediaPlayerMediaEvent | OnMediaClosed | A delegate that is invoked when a media source has been closed. | |
| FOnMediaPlayerMediaOpened | OnMediaOpened | A delegate that is invoked when a media source has been opened. | |
| FOnMediaPlayerMediaOpenFailed | OnMediaOpenFailed | A delegate that is invoked when a media source has failed to open. | |
| FOnMediaPlayerMediaEvent | OnMetadataChanged | A delegate that is invoked when the media metadata changed. | |
| FOnMediaPlayerMediaEvent | OnPlaybackResumed | A delegate that is invoked when media playback has been resumed. | |
| FOnMediaPlayerMediaEvent | OnPlaybackSuspended | A delegate that is invoked when media playback has been suspended. | |
| FOnMediaPlayerMediaEvent | OnSeekCompleted | A delegate that is invoked when a seek operation completed successfully. | |
| FOnMediaPlayerMediaEvent | OnTracksChanged | A delegate that is invoked when the media track collection changed. | |
| TObjectPtr< UMediaPlaylist > | Playlist | The play list to use, if any. | |
| int32 | PlaylistIndex | The current index of the source in the play list being played. | |
| bool | PlayOnOpen | Automatically start playback after media opened successfully. | |
| uint32: 1 | Shuffle | Whether playback should shuffle media sources in the play list. | |
| FTimespan | TimeDelay | Delay of the player's time. | |
| float | VerticalFieldOfView | The initial vertical field of view (in Euler degrees; default = 60). | |
| FRotator | ViewRotation | The initial view rotation. |
Constructors
| Type | Name | Description | |
|---|---|---|---|
UMediaPlayer
(
const FObjectInitializer& ObjectInitializer |
Functions
| Type | Name | Description | |
|---|---|---|---|
| bool | CanPause () |
Check whether media playback can be paused right now. | |
| bool | CanPlaySource
(
UMediaSource* MediaSource |
Check whether the specified media source can be played by this player. | |
| bool | CanPlayUrl
(
const FString& Url |
Check whether the specified URL can be played by this player. | |
| void | Clean up before this object is destroyed. | ||
| void | Close () |
Close the currently open media, if any. | |
| int32 | GetAudioTrackChannels
(
int32 TrackIndex, |
Get the number of channels in the specified audio track. | |
| int32 | 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. | |
| FName | Get the name of the current desired native player. | ||
| FTimespan | Get the media's current playback time as appropriate for display. | ||
| UMediaTimeStampInfo * | Get the media's current playback timestamp as appropriate for display. | ||
| FTimespan | GetDuration () |
Get the media's duration. | |
| const FGuid & | GetGuid () |
Get the Guid associated with this media player | |
| float | Get the current horizontal field of view (only for 360 videos). | ||
| FVariant | GetMediaInfo
(
FName InfoName |
Get information about the media that is playing. | |
| bool | GetMediaInfo
(
T& Result, |
Templated version of GetMediaInfo. No need to deal with variants. | |
| TSharedPtr< TMap< FString, TArray< TUniquePtr< IMediaMetadataItem > > >, ESPMode::ThreadSafe > | Get meta data contained in the current stream | ||
| TMap< FString, FMediaMetadataItemsBPT > | This is the blueprint accessible version of the GetMediaMetadata. | ||
| FText | GetMediaName () |
Get the human readable name of the currently loaded media source. | |
| int32 | GetNumTrackFormats
(
EMediaPlayerTrack TrackType, |
Get the number of formats of the specified track. | |
| int32 | GetNumTracks
(
EMediaPlayerTrack TrackType |
Get the number of tracks of the given type. | |
| TSharedRef< FMediaPlayerFacade, ESPMode::ThreadSafe > | Get the media player facade that manages low-level media players | ||
| FName | Get the name of the current native media player. | ||
| UMediaPlaylist * | GetPlaylist () |
Get the current play list. | |
| int32 | Get the current play list index. | ||
| UMediaPlaylist & | Get the current play list. | ||
| float | GetRate () |
Get the media's current playback rate. | |
| int32 | GetSelectedTrack
(
EMediaPlayerTrack TrackType |
Get the index of the currently selected track of the given type. | |
| void | GetSupportedRates
(
TArray< FFloatRange >& OutRates, |
Get the supported playback rates. | |
| FTimespan | GetTime () |
Get the media's current playback time. | |
| FTimespan | GetTimeDelay () |
Delay of the player's time. | |
| UMediaTimeStampInfo * | GetTimeStamp () |
Get the media's current playback timestamp. | |
| FText | GetTrackDisplayName
(
EMediaPlayerTrack TrackType, |
Get the human readable name of the specified track. | |
| int32 | GetTrackFormat
(
EMediaPlayerTrack TrackType, |
Get the index of the active format of the specified track type. | |
| FString | GetTrackLanguage
(
EMediaPlayerTrack TrackType, |
Get the language tag of the specified track. | |
| const FString & | GetUrl () |
Get the URL of the currently loaded media, if any. | |
| float | Get the current vertical field of view (only for 360 videos). | ||
| float | GetVideoTrackAspectRatio
(
int32 TrackIndex, |
Get the aspect ratio of the specified video track. | |
| FIntPoint | GetVideoTrackDimensions
(
int32 TrackIndex, |
Get the current dimensions of the specified video track. | |
| float | GetVideoTrackFrameRate
(
int32 TrackIndex, |
Get the frame rate of the specified video track. | |
| FFloatRange | 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. | |
| FRotator | Get the current view rotation (only for 360 videos). | ||
| bool | HasError () |
Check whether the player is in an error state. | |
| bool | IsBuffering () |
Check whether playback is buffering data. | |
| bool | IsClosed () |
Whether media is currently closed. | |
| bool | IsConnecting () |
Check whether the player is currently connecting to a media source. | |
| bool | IsLooping () |
Check whether playback is looping. | |
| bool | IsPaused () |
Check whether playback is currently paused. | |
| bool | IsPlaying () |
Check whether playback has started. | |
| bool | IsPreparing () |
Check whether the media is currently opening or buffering. | |
| bool | IsReady () |
Check whether media is ready for playback. | |
| bool | Next () |
Open the next item in the current play list. | |
| UMediaPlayer::FOnMediaEvent TBaseMulticastDelegate_OneParam | OnMediaEvent () |
||
| bool | Opens the specified media file path. | ||
| bool | OpenPlaylist
(
UMediaPlaylist* InPlaylist |
Open the first media source in the specified play list. | |
| bool | OpenPlaylistIndex
(
UMediaPlaylist* InPlaylist, |
Open a particular media source in the specified play list. | |
| bool | OpenSource
(
UMediaSource* MediaSource |
Open the specified media source. | |
| void | OpenSourceLatent
(
const UObject* WorldContextObject, |
Open the specified media source with options using a latent action. | |
| bool | OpenSourceWithOptions
(
UMediaSource* MediaSource, |
Open the specified media source with supplied options applied. | |
| bool | Opens the specified media URL. | ||
| bool | Pause () |
Pauses media playback.This is the same as setting the playback rate to 0.0. | |
| void | PausePIE () |
Called when PIE has been paused. | |
| bool | Play () |
Starts media playback.This is the same as setting the playback rate to 1.0. | |
| void | PlayAndSeek () |
Starts playback from the media opened event, but can be used elsewhere. | |
| bool | Previous () |
Open the previous item in the current play list. | |
| void | Register player with media module to be ticked | ||
| bool | Reopen () |
Reopens the currently opened media or play list. | |
| void | ResumePIE () |
Called when PIE has been resumed. | |
| bool | Rewind () |
Rewinds the media to the beginning.This is the same as seeking to zero time. | |
| bool | Seeks to the specified playback time. | ||
| bool | SelectTrack
(
EMediaPlayerTrack TrackType, |
Select the active track of the given type. | |
| 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 | SetDesiredPlayerName
(
FName PlayerName |
Set the name of the desired native player. | |
| bool | SetLooping
(
bool Looping |
Enables or disables playback looping. | |
| void | SetMediaOptions
(
const UMediaSource* Options |
Sets the media options used by the player. | |
| bool | SetNativeVolume
(
float Volume |
Set the volume on the native player if not mixing with Sound Wave asset. | |
| bool | SetRate
(
float Rate |
Changes the media's playback rate. | |
| void | SetTimeDelay
(
FTimespan TimeDelay |
Delay of the player's time. | |
| bool | SetTrackFormat
(
EMediaPlayerTrack 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 (only for 360 videos). | |
| bool | SetViewRotation
(
const FRotator& Rotation, |
Set the view's rotation (only for 360 videos). | |
| bool | SupportsRate
(
float Rate, |
Check whether the specified playback rate is supported. | |
| bool | Check whether the currently loaded media supports scrubbing. | ||
| bool | Check whether the currently loaded media can jump to a certain position. | ||
| void | When the player goes out of scope, make sure to clean up the clock sink |
Overridden from UObject
| Type | Name | Description | |
|---|---|---|---|
| void | BeginDestroy () |
Called before destroying the object. | |
| FString | GetDesc () |
Return a one line description of an object for viewing in the thumbnail view of the generic browser | |
| void | PostDuplicate
(
bool bDuplicateForPIE |
Called after duplication & serialization and before PostLoad. | |
| void | PostEditChangeProperty
(
FPropertyChangedEvent& PropertyChangedEvent |
Called when a property on this object has been modified externally | |
| void | Called after the C++ constructor and after the properties have been initialized, including those loaded from config. | ||
| void | PostLoad () |
Do any object-specific cleanup required immediately after loading an object. |
Overridden from IAudioProxyDataFactory
| Type | Name | Description | |
|---|---|---|---|
| TSharedPtr< Audio::IProxyData > | CreateProxyData
(
const Audio::FProxyDataInitParams& InitParams |
IAudioProxyDataFactory interface (for Meta Sound support) |
Classes
| Type | Name | Description | |
|---|---|---|---|
| FOnMediaEvent | Get an event delegate that is invoked when a media event occurred. |
Constants
| Name | Description |
|---|---|
| MediaInfoNameSourceNumMips | These are possible common information for use with GetMediaInfo. |
| MediaInfoNameSourceNumTiles | Number of tiles (X and Y) in the source. IntPoint. |