unreal.BinkMediaPlayer

class unreal.BinkMediaPlayer(outer: Object | None = None, name: Name | str = 'None')

Bases: Object

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

This class is represents a media URL along with a corresponding media player for exposing media playback functionality to the Engine and to Blueprints.

C++ Source:

  • Plugin: BinkMedia

  • Module: BinkMediaPlayer

  • File: BinkMediaPlayer.h

Editor Properties: (see get_editor_property/set_editor_property)

  • bink_buffer_mode (BinkMediaPlayerBinkBufferModes): [Read-Write] Used to specify the how the video should be buffered.

  • bink_destination_lower_right (Vector2D): [Read-Write] Used to specify the sounds to open at playback.

  • bink_destination_upper_left (Vector2D): [Read-Write] Used to specify the sounds to open at playback.

  • bink_draw_style (BinkMediaPlayerBinkDrawStyle): [Read-Write] Used to specify how the movie is drawn.

  • bink_layer_depth (int32): [Read-Write] Used to specify the render order.

  • bink_sound_track (BinkMediaPlayerBinkSoundTrack): [Read-Write] Used to specify the sounds to open at playback.

  • bink_sound_track_start (int32): [Read-Write] Used to specify the sounds to open at playback.

  • delayed_open (bool): [Read-Write] To reduce memory use, don’t immediately open the bink until it is first played.

  • looping (bool): [Read-Write] Whether playback should loop when it reaches the end.

  • on_media_closed (OnBinkMediaPlayerMediaClosed): [Read-Write] Holds a delegate that is invoked when a media source has been closed.

  • on_media_opened (OnBinkMediaPlayerMediaOpened): [Read-Write] Holds a delegate that is invoked when a media source has been opened.

  • on_media_reached_end (OnBinkMediaPlayerMediaReachedEnd): [Read-Write] Holds a delegate that is invoked when a media source has been opened.

  • on_playback_suspended (OnBinkMediaPlayerMediaEvent): [Read-Write] A delegate that is invoked when media playback has been suspended.

  • start_immediately (bool): [Read-Write] Whether playback start immediately, or wait for blueprint to start it.

  • url (str): [Read-Write] The path or URL to the media file to be played.

property bink_buffer_mode: BinkMediaPlayerBinkBufferModes

[Read-Only] Used to specify the how the video should be buffered.

Type:

(BinkMediaPlayerBinkBufferModes)

property bink_draw_style: BinkMediaPlayerBinkDrawStyle

[Read-Only] Used to specify how the movie is drawn.

Type:

(BinkMediaPlayerBinkDrawStyle)

property bink_layer_depth: int

[Read-Only] Used to specify the render order.

Type:

(int32)

property bink_sound_track: BinkMediaPlayerBinkSoundTrack

[Read-Only] Used to specify the sounds to open at playback.

Type:

(BinkMediaPlayerBinkSoundTrack)

property bink_sound_track_start: int

[Read-Only] Used to specify the sounds to open at playback.

Type:

(int32)

can_pause() bool

Checks whether media playback can be paused right now.

Playback can be paused if the media supports pausing and if it is currently playing. see: CanPlay, Pause

Returns:

true if pausing playback can be paused, false otherwise.

Return type:

bool

can_play() bool

Checks whether media playback can be started right now. see: CanPause, Play

Returns:

true if playback can be started, false otherwise.

Return type:

bool

close_url() None

Closes the specified media URL. see: GetUrl

draw(texture, tonemap=False, out_nits=10000, alpha=1.000000, srgb_decode=False, hdr=False) None

Draws this bink to the specified texture

Parameters:
get_duration() Timespan

Gets the media’s duration. see: GetTime, Seek

Returns:

A time span representing the duration.

Return type:

Timespan

get_rate() float

Gets the media’s current playback rate. see: SetRate, SupportsRate

Returns:

The playback rate.

Return type:

float

get_time() Timespan

Gets the media’s current playback time. see: GetDuration, Seek

Returns:

Playback time.

Return type:

Timespan

get_url() str

Gets the URL of the currently loaded media, if any. see: OpenUrl

Returns:

Media URL, or empty string if no media was loaded.

Return type:

str

is_initialized() bool

Checks whether this player has been initialized with a media source. see: OpenUrl

Returns:

true if a media source is associated with this player.

Return type:

bool

is_looping() bool

Checks whether playback is looping. see: SetLooping

Returns:

true if looping, false otherwise.

Return type:

bool

is_paused() bool

Checks whether playback is currently paused. see: CanPause, IsPlaying, IsStopped, Pause

Returns:

true if playback is paused, false otherwise.

Return type:

bool

is_playing() bool

Checks whether playback has started. see: CanPlay, IsPaused, IsStopped, Play

Returns:

true if playback has started, false otherwise.

Return type:

bool

is_stopped() bool

Checks whether playback has stopped. see: IsPaused, IsPlaying, Stop

Returns:

true if playback has stopped, false otherwise.

Return type:

bool

property on_media_closed: OnBinkMediaPlayerMediaClosed

[Read-Write] Holds a delegate that is invoked when a media source has been closed.

Type:

(OnBinkMediaPlayerMediaClosed)

property on_media_opened: OnBinkMediaPlayerMediaOpened

[Read-Write] Holds a delegate that is invoked when a media source has been opened.

Type:

(OnBinkMediaPlayerMediaOpened)

property on_media_reached_end: OnBinkMediaPlayerMediaReachedEnd

[Read-Write] Holds a delegate that is invoked when a media source has been opened.

Type:

(OnBinkMediaPlayerMediaReachedEnd)

property on_playback_suspended: OnBinkMediaPlayerMediaEvent

[Read-Write] A delegate that is invoked when media playback has been suspended.

Type:

(OnBinkMediaPlayerMediaEvent)

open_url(new_url) bool

Opens the specified media URL. see: GetUrl

Parameters:

new_url (str) – The URL to open.

Returns:

true on success, false otherwise.

Return type:

bool

pause() bool

Pauses media playback.

This is the same as setting the playback rate to 0.0. see: CanPause, Play, Rewind, Seek, SetRate

Returns:

true if playback is being paused, false otherwise.

Return type:

bool

play() bool

Starts media playback.

This is the same as setting the playback rate to 1.0. see: CanPlay, Pause, Rewind, Seek, SetRate

Returns:

true if playback is starting, false otherwise.

Return type:

bool

rewind() bool

Rewinds the media to the beginning.

This is the same as seeking to zero time. see: GetTime, Pause, Play, Seek

Returns:

true if rewinding, false otherwise.

Return type:

bool

seek(time) bool

Seeks to the specified playback time. see: GetTime, Rewind

Parameters:

time (Timespan) – The playback time to set.

Returns:

true on success, false otherwise.

Return type:

bool

set_looping(looping) bool

Enables or disables playback looping. see: IsLooping

Parameters:

looping (bool) –

Returns:

true on success, false otherwise.

Return type:

bool

set_rate(rate) bool

Changes the media’s playback rate. see: GetRate, SupportsRate

Parameters:

rate (float) – The playback rate to set.

Returns:

true on success, false otherwise.

Return type:

bool

set_volume(rate) None

Changes the media’s volume

Parameters:

rate (float) – The playback volume to set. 0 to 1

stop() None

Stops playback and unloads the video from memory. If you want to start the video again you’ll need to call InitializePlayer. MediaEvent will broadcast EMediaEvent::MediaClosed. see: InitializePlayer, IsStopped, Play

supports_rate(rate, unthinned) bool

Checks whether the specified playback rate is supported. see: SupportsScrubbing, SupportsSeeking

Parameters:
  • rate (float) – The playback rate to check.

  • unthinned (bool) – Whether no frames should be dropped at the given rate.

Return type:

bool

supports_scrubbing() bool

Checks whether the currently loaded media supports scrubbing. see: SupportsRate, SupportsSeeking

Returns:

true if scrubbing is supported, false otherwise.

Return type:

bool

supports_seeking() bool

Checks whether the currently loaded media can jump to a certain position. see: SupportsRate, SupportsScrubbing

Returns:

true if seeking is supported, false otherwise.

Return type:

bool