Skip to main content
Version: 20 Mar 2024

MLMediaPlayerBehavior

NameSpace: Core

Inherits from:
MonoBehaviour

Public Fields

DurationInMiliseconds


public long DurationInMiliseconds = false { get; set; }


IsBuffering


public bool IsBuffering { get; set; }


IsSeeking


public bool IsSeeking = false { get; set; }


MediaPlayer

MediaPlayer reference


public MLMedia.Player MediaPlayer { get; set; }

TypeDescription
MLMedia.PlayerMedia player script that allows playback of a streaming video (either from file or web URL) This script will update the main texture parameter of the Renderer attached as a sibling with the video frame from playback. Audio is also handled through this class and will playback audio from the file.

Public Methods

void Pause

Pauses the video.

public void Pause()

void Play

Plays the video.

public void Play()

void PrepareMLMediaPlayer

Prepares the MLMediaPlayer with a source.

public void PrepareMLMediaPlayer()

void Reset

Resets the video.

public void Reset()

void Seek

Handler when Timeline Slider has changed value. Moves the play head by a specific percentage of the whole duration.

public void Seek(
float ms
)

Parameters

TypeNameDescription
floatmsMiliseconds to seek to

void SeekTo

Moves the play head to a specific percentage of the whole duration.

public void SeekTo(
float ms
)

Parameters

TypeNameDescription
floatms

void SelectTrack

public void SelectTrack(
MLMedia.Player.Track track
)

Parameters

TypeNameDescription
MLMedia.Player.TracktrackTrack from the prepared source that can be selected by the media player.

void StopMLMediaPlayer

Stops Media Player and destroys it's instance.

public void StopMLMediaPlayer()

void UnselectTrack

public void UnselectTrack(
MLMedia.Player.Track track
)

Parameters

TypeNameDescription
MLMedia.Player.TracktrackTrack from the prepared source that can be selected by the media player.

Public Attributes

IsPlaying


public bool IsPlaying => _mediaPlayer is { IsPlaying: true };


IsPrepared


public bool IsPrepared => _mediaPlayer is { IsPrepared: true };


pathSourceType


public PathSourceType pathSourceType;


source


public string source;


Public Events

OnBufferingUpdate

public Action< float > OnBufferingUpdate()

OnCaptionsText

public Action< string > OnCaptionsText()

OnCompletion

public Action OnCompletion()

OnInfo

public Action< MLMedia.Player.Info > OnInfo()

OnIsBufferingChanged

public Action< bool > OnIsBufferingChanged()

OnPause

public Action OnPause()

OnPlay

public Action OnPlay()

OnPrepared

public Action OnPrepared()

OnReset

public Action OnReset()

OnSeekComplete

public Action OnSeekComplete()

OnStop

public Action OnStop()

OnTrackFound

public Action< MLMedia.Player.Track > OnTrackFound()

OnTrackSelected

public Action< MLMedia.Player.Track > OnTrackSelected()

OnUpdateElapsedTime

public Action< long > OnUpdateElapsedTime()

OnUpdateTimeline

public Action< float > OnUpdateTimeline()

OnVideoRendererInitialized

public Action< MLNativeSurfaceYcbcrRenderer > OnVideoRendererInitialized()

Public Enums

PathSourceType

EnumeratorValueDescription
Web
StreamingAssets
LocalPath