Skip to main content
Version: 20 Mar 2024

IMLMediaPlayer

NameSpace: MagicLeap

Interface for target classes used by MLMediaPlayer Each function must be implemented by the child player type

Inherited by:
UnityEngine.XR.MagicLeap.MLMedia.Player

Public Fields

IsPlaying

Gets a bool indicating if the media player is currently playing or not.


public bool IsPlaying { get; set; }


Public Methods

int GetDurationMilliseconds

Gets the duration of the video in milliseconds

public int GetDurationMilliseconds()

Returns: Duration of the video, -1 on failure.

Reimplemented by: GetDurationMilliseconds


int GetHeight

Get the height of the video in pixels

public int GetHeight()

Returns: The height of the video, -1 on failure.

Reimplemented by: GetHeight


int GetPositionMilliseconds

Gets the current position of the video in milliseconds

public int GetPositionMilliseconds()

Returns: Position of the playback of the video, -1 on failure.

Reimplemented by: GetPositionMilliseconds


int GetWidth

Get the width of the video in pixels

public int GetWidth()

Returns: The width of the video, -1 on failure.

Reimplemented by: GetWidth


MLResult Pause

Pauses the video.

public MLResult Pause()

Returns: MLResult.Result will be MLResult.Code.Ok if operation succeeded.

Reimplemented by: Pause


MLResult Play

Plays the video.

public MLResult Play()

Returns: MLResult.Result will be MLResult.Code.Ok if operation succeeded.

Reimplemented by: Play


MLResult Resume

Resume the video.

public MLResult Resume()

Returns: MLResult.Result will be MLResult.Code.Ok if operation succeeded.

Reimplemented by: Resume


MLResult Seek

Seeks the specified time in the video.

public MLResult Seek(
int positionSeconds,
MLMedia.Player.SeekMode seekMode
)

Parameters

TypeNameDescription
intpositionSecondsAbsolute time to seek to.
MLMedia.Player.SeekModeseekModeMode indicating where exactly to seek to.

Returns: MLResult.Result will be MLResult.Code.Ok if operation succeeded.

Reimplemented by: Seek


MLResult SetLooping

Sets the loop flag for the video.

public MLResult SetLooping(
bool loop
)

Parameters

TypeNameDescription
boolloopFlag to loop

Returns: MLResult.Result will be MLResult.Code.Ok if operation succeeded.

Reimplemented by: SetLooping


MLResult SetSourcePath

Sets the source path that the media player will play content from.

public MLResult SetSourcePath(
string source
)

Parameters

TypeNameDescription
stringsourcePath of the media that's on the device.

Returns: MLResult.Result will be MLResult.Code.Ok if operation succeeded. MLResult.Result will be MLResult.Code.InvalidParam if failed due to an invalid input parameter. MLResult.Result will be MLResult.Code.UnspecifiedFailure if failed due to internal error. MLResult.Result will be MLResult.Code.MediaGenericNoInit if media player was not properly built or initialized. MLResult.Result will be MLResult.Code.PermissionDenied if attempting to access web content without appropriate network permissions

Reimplemented by: SetSourcePath


MLResult SetSourceURI

Sets the source path that the media player will play content from.

public MLResult SetSourceURI(
string source
)

Parameters

TypeNameDescription
stringsourceURI of the media.

Returns: MLResult.Result will be MLResult.Code.Ok if operation succeeded. MLResult.Result will be MLResult.Code.InvalidParam if failed due to an invalid input parameter. MLResult.Result will be MLResult.Code.UnspecifiedFailure if failed due to internal error. MLResult.Result will be MLResult.Code.MediaGenericNoInit if media player was not properly built or initialized. MLResult.Result will be MLResult.Code.PermissionDenied if attempting to access web content without appropriate network permissions

Reimplemented by: SetSourceURI


MLResult SetVolume

Sets the volume of the video.

public MLResult SetVolume(
float vol
)

Parameters

TypeNameDescription
floatvolVolume between 0 and 1.

Returns: MLResult.Result will be MLResult.Code.Ok if operation succeeded.

Reimplemented by: SetVolume


MLResult Stop

Stops the video in the editor.

public MLResult Stop()

Returns: MLResult.Result will be MLResult.Code.Ok if operation succeeded.

Reimplemented by: Stop