UMediaPlayer

Implements a media player asset that can play movies and other media sources.

Windows
MacOS
Linux

Inheritance Hierarchy

References

Module

MediaAssets

Header

/Engine/Source/Runtime/MediaAssets/Public/MediaPlayer.h

Include

#include "MediaPlayer.h"

Syntax

class UMediaPlayer : public UObject

Remarks

Implements a media player asset that can play movies and other media sources.

Variables

Name Description

Public variable

bool

 

AffectedByPIEHandling

Whether this player should stop when entering or exiting PIE.

Public variable

FTimespan

 

CacheAhead

Duration of samples to cache ahead of the play head.

Public variable

FTimespan

 

CacheBehind

Duration of samples to cache behind the play head (when not running as game).

Public variable

FTimespan

 

CacheBehindGame

Duration of samples to cache behind the play head (when running as game).

Protected variable

float

 

HorizontalFieldOfView

The initial horizontal field of view (in Euler degrees; default = 90).

Protected variable

uint32: 1

 

Loop

Whether the player should loop when media playback reaches the end.

Public variable

bool

 

NativeAudioOut

Output any audio via the operating system's sound mixer instead of a Sound Wave asset.

Public variable

FOnMediaPlayerM...

 

OnEndReached

A delegate that is invoked when playback has reached the end of the media.

Public variable

FOnMediaPlayerM...

 

OnMediaClosed

A delegate that is invoked when a media source has been closed.

Public variable

FOnMediaPlayerM...

 

OnMediaOpened

A delegate that is invoked when a media source has been opened.

Public variable

FOnMediaPlayerM...

 

OnMediaOpenFailed

A delegate that is invoked when a media source has failed to open.

Public variable

FOnMediaPlayerM...

 

OnPlaybackResumed

A delegate that is invoked when media playback has been resumed.

Public variable

FOnMediaPlayerM...

 

OnPlaybackSuspended

A delegate that is invoked when media playback has been suspended.

Public variable

FOnMediaPlayerM...

 

OnSeekCompleted

A delegate that is invoked when a seek operation completed successfully.

Public variable

FOnMediaPlayerM...

 

OnTracksChanged

A delegate that is invoked when the media track collection changed.

Protected variable

UMediaPlaylist ...

 

Playlist

The play list to use, if any.

Protected variable

int32

 

PlaylistIndex

The current index of the source in the play list being played.

Public variable

bool

 

PlayOnOpen

Automatically start playback after media opened successfully.

Public variable

uint32: 1

 

Shuffle

Whether playback should shuffle media sources in the play list.

Protected variable

FTimespan

 

TimeDelay

Delay of the player's time.

Protected variable

float

 

VerticalFieldOfView

The initial vertical field of view (in Euler degrees; default = 60).

Protected variable

FRotator

 

ViewRotation

The initial view rotation.

Constructors

Name Description

Public function

UMediaPlayer

(
    const FObjectInitializer& ObjectIn...
)

Functions

Name Description

Public function Const

bool

 

CanPause()

Check whether media playback can be paused right now.

Public function

bool

 

CanPlaySource

(
    UMediaSource* MediaSource
)

Check whether the specified media source can be played by this player.

Public function

bool

 

CanPlayUrl

(
    const FString& Url
)

Check whether the specified URL can be played by this player.

Public function

void

 

Close()

Close the currently open media, if any.

Public function Const

int32

 

GetAudioTrackChannels

(
    int32 TrackIndex,
    int32 FormatIndex
)

Get the number of channels in the specified audio track.

Public function Const

int32

 

GetAudioTrackSampleRate

(
    int32 TrackIndex,
    int32 FormatIndex
)

Get the sample rate of the specified audio track.

Public function Const

FString

 

GetAudioTrackType

(
    int32 TrackIndex,
    int32 FormatIndex
)

Get the type of the specified audio track format.

Public function Const

FName

 

GetDesiredPlayerName()

Get the name of the current desired native player.

Public function Const

FTimespan

 

GetDuration()

Get the media's duration.

Public function

const FGuid ...

 

GetGuid()

Get the Guid associated with this media player

Public function Const

float

 

GetHorizontalFieldOfView()

Get the current horizontal field of view (only for 360 videos).

Public function Virtual Const

FText

 

GetMediaName()

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

Public function Const

int32

 

GetNumTrackFormats

(
    EMediaPlayerTrack TrackType,
    int32 TrackIndex
)

Get the number of formats of the specified track.

Public function Const

int32

 

GetNumTracks

(
    EMediaPlayerTrack TrackType
)

Get the number of tracks of the given type.

Public function Const

TSharedRef< ...

 

GetPlayerFacade()

Get the media player facade that manages low-level media players

Public function Const

FName

 

GetPlayerName()

Get the name of the current native media player.

Public function Const

UMediaPlayli...

 

GetPlaylist()

Get the current play list.

Public function Const

int32

 

GetPlaylistIndex()

Get the current play list index.

Public function Const

UMediaPlayli...

 

GetPlaylistRef()

Get the current play list.

Public function Const

float

 

GetRate()

Get the media's current playback rate.

Public function Const

int32

 

GetSelectedTrack

(
    EMediaPlayerTrack TrackType
)

Get the index of the currently selected track of the given type.

Public function Const

void

 

GetSupportedRates

(
    TArray< FFloatRange >& OutRates,
    bool Unthinned
)

Get the supported playback rates.

Public function Const

FTimespan

 

GetTime()

Get the media's current playback time.

Public function Const

FTimespan

 

GetTimeDelay()

Delay of the player's time.

Public function Const

UMediaTimeSt...

 

GetTimeStamp()

Get the media's current playback timestamp.

Public function Const

FText

 

GetTrackDisplayName

(
    EMediaPlayerTrack TrackType,
    int32 TrackIndex
)

Get the human readable name of the specified track.

Public function Const

int32

 

GetTrackFormat

(
    EMediaPlayerTrack TrackType,
    int32 TrackIndex
)

Get the index of the active format of the specified track type.

Public function Const

FString

 

GetTrackLanguage

(
    EMediaPlayerTrack TrackType,
    int32 TrackIndex
)

Get the language tag of the specified track.

Public function Const

const FStrin...

 

GetUrl()

Get the URL of the currently loaded media, if any.

Public function Const

float

 

GetVerticalFieldOfView()

Get the current vertical field of view (only for 360 videos).

Public function Const

float

 

GetVideoTrackAspectRatio

(
    int32 TrackIndex,
    int32 FormatIndex
)

Get the aspect ratio of the specified video track.

Public function Const

FIntPoint

 

GetVideoTrackDimensions

(
    int32 TrackIndex,
    int32 FormatIndex
)

Get the current dimensions of the specified video track.

Public function Const

float

 

GetVideoTrackFrameRate

(
    int32 TrackIndex,
    int32 FormatIndex
)

Get the frame rate of the specified video track.

Public function Const

FFloatRange

 

GetVideoTrackFrameRates

(
    int32 TrackIndex,
    int32 FormatIndex
)

Get the supported range of frame rates of the specified video track.

Public function Const

FString

 

GetVideoTrackType

(
    int32 TrackIndex,
    int32 FormatIndex
)

Get the type of the specified video track format.

Public function Const

FRotator

 

GetViewRotation()

Get the current view rotation (only for 360 videos).

Public function Const

bool

 

HasError()

Check whether the player is in an error state.

Public function Const

bool

 

IsBuffering()

Check whether playback is buffering data.

Public function Const

bool

 

IsClosed()

Whether media is currently closed.

Public function Const

bool

 

IsConnecting()

Check whether the player is currently connecting to a media source.

Public function Const

bool

 

IsLooping()

Check whether playback is looping.

Public function Const

bool

 

IsPaused()

Check whether playback is currently paused.

Public function Const

bool

 

IsPlaying()

Check whether playback has started.

Public function Const

bool

 

IsPreparing()

Check whether the media is currently opening or buffering.

Public function Const

bool

 

IsReady()

Check whether media is ready for playback.

Public function

bool

 

Next()

Open the next item in the current play list.

Public function

UMediaPlayer...

 

OnMediaEvent()

Public function

bool

 

OpenFile

(
    const FString& FilePath
)

Opens the specified media file path.

Public function

bool

 

OpenPlaylist

(
    UMediaPlaylist* InPlaylist
)

Open the first media source in the specified play list.

Public function

bool

 

OpenPlaylistIndex

(
    UMediaPlaylist* InPlaylist,
    int32 Index
)

Open a particular media source in the specified play list.

Public function

bool

 

OpenSource

(
    UMediaSource* MediaSource
)

Open the specified media source.

Public function

void

 

OpenSourceLatent

(
    const UObject* WorldContextObj...,
    FLatentActionInfo LatentInfo,
    UMediaSource* MediaSource,
    const FMediaPlayerOptions& Options,
    bool& bSuccess
)

Open the specified media source with options using a latent action.

Public function

bool

 

OpenSourceWithOptions

(
    UMediaSource* MediaSource,
    const FMediaPlayerOptions& Options
)

Open the specified media source with supplied options applied.

Public function

bool

 

OpenUrl

(
    const FString& Url
)

Opens the specified media URL.

Public function

bool

 

Pause()

Pauses media playback.

This is the same as setting the playback rate to 0.0.

Public function

void

 

PausePIE()

Called when PIE has been paused.

Public function

bool

 

Play()

Starts media playback.

This is the same as setting the playback rate to 1.0.

Public function

void

 

PlayAndSeek()

Starts playback from the media opened event, but can be used elsewhere.

Public function

bool

 

Previous()

Open the previous item in the current play list.

Public function

void

 

RegisterWithMediaModule()

Register player with media module to be ticked

Public function

bool

 

Reopen()

Reopens the currently opened media or play list.

Public function

void

 

ResumePIE()

Called when PIE has been resumed.

Public function

bool

 

Rewind()

Rewinds the media to the beginning.

This is the same as seeking to zero time.

Public function

bool

 

Seek

(
    const FTimespan& Time
)

Seeks to the specified playback time.

Public function

bool

 

SelectTrack

(
    EMediaPlayerTrack TrackType,
    int32 TrackIndex
)

Select the active track of the given type.

Public function

void

 

SetBlockOnTime

(
    const FTimespan& Time
)

Set the time on which to block.

Public function

void

 

SetBlockOnTimeRange

(
    const TRange< FTimespan >& TimeRan...
)

Set the time range on which to block.

Public function

void

 

SetDesiredPlayerName

(
    FName PlayerName
)

Set the name of the desired native player.

Public function

bool

 

SetLooping

(
    bool Looping
)

Enables or disables playback looping.

Public function

void

 

SetMediaOptions

(
    const UMediaSource* Options
)

Sets the media options used by the player.

Public function

bool

 

SetNativeVolume

(
    float Volume
)

Set the volume on the native player if not mixing with Sound Wave asset.

Public function

bool

 

SetRate

(
    float Rate
)

Changes the media's playback rate.

Public function

void

 

SetTimeDelay

(
    FTimespan TimeDelay
)

Delay of the player's time.

Public function

bool

 

SetTrackFormat

(
    EMediaPlayerTrack TrackType,
    int32 TrackIndex,
    int32 FormatIndex
)

Set the format on the specified track.

Public function

bool

 

SetVideoTrackFrameRate

(
    int32 TrackIndex,
    int32 FormatIndex,
    float FrameRate
)

Set the frame rate of the specified video track.

Public function

bool

 

SetViewField

(
    float Horizontal,
    float Vertical,
    bool Absolute
)

Set the field of view (only for 360 videos).

Public function

bool

 

SetViewRotation

(
    const FRotator& Rotation,
    bool Absolute
)

Set the view's rotation (only for 360 videos).

Public function Const

bool

 

SupportsRate

(
    float Rate,
    bool Unthinned
)

Check whether the specified playback rate is supported.

Public function Const

bool

 

SupportsScrubbing()

Check whether the currently loaded media supports scrubbing.

Public function Const

bool

 

SupportsSeeking()

Check whether the currently loaded media can jump to a certain position.

Overridden from UObject

Name Description

Public function Virtual

void

 

BeginDestroy()

Called before destroying the object.

Public function Virtual

FString

 

GetDesc()

Return a one line description of an object for viewing in the thumbnail view of the generic browser

Public function Virtual

void

 

PostDuplicate

(
    bool bDuplicateForPIE
)

Called after duplication & serialization and before PostLoad.

Public function Virtual

void

 

PostEditChangeProperty

(
    FPropertyChangedEvent& PropertyCha...
)

Called when a property on this object has been modified externally

Public function Virtual

void

 

PostInitProperties()

Called after the C++ constructor and after the properties have been initialized, including those loaded from config.

Public function Virtual

void

 

PostLoad()

Do any object-specific cleanup required immediately after loading an object.

Classes

Name

Description

Public class

FOnMediaEvent

Get an event delegate that is invoked when a media event occurred.

Help shape the future of Unreal Engine documentation! Tell us how we're doing so we can serve you better.
Take our survey
Dismiss