MediaEvents

The MediaEvents class provides a set of events and methods for handling media-related events in your application. Below is a detailed reference for each property, event, and method available in the MediaEvents class.

Properties

Error

  • Description: Gets the last error message from the native plugin.

  • Type: string

  • Usage:

    string errorMessage = MediaEvents.Error;

IsInitialized

  • Description: Indicates whether the media player is initialized.

  • Type: bool

  • Usage:

    bool isInitialized = MediaEvents.IsInitialized;

Events

onIsBufferingChanged

  • Description: Event triggered when the buffering state changes.

  • Type: Action<bool>

  • Usage:

    MediaEvents.onIsBufferingChanged += (isBuffering) => {
        // Handle buffering state change
    };

onIsPlayingChanged

  • Description: Event triggered when the playing state changes.

  • Type: Action<bool>

  • Usage:

onIsLoadingChanged

  • Description: Event triggered when the loading state changes.

  • Type: Action<bool>

  • Usage:

onInitialized

  • Description: Event triggered when the media player initialization state changes.

  • Type: Action<bool>

  • Usage:

onPrepared

  • Description: Event triggered when the media player is prepared.

  • Type: Action

  • Usage:

onComplete

  • Description: Event triggered when the media playback is complete.

  • Type: Action

  • Usage:

onError

  • Description: Event triggered when an error occurs.

  • Type: Action<string>

  • Usage:

onDownloadProgress

  • Description: Event triggered to report download progress.

  • Type: Action<string, float>

  • Usage:

onPlaylistUpdated

  • Description: Internal event triggered when the playlist is updated.

  • Type: Action

  • Usage:

Methods

SyncMediaDataOnReturn

  • Description: Syncs media data when returning to the app.

  • Usage:

GetPlayerName

  • Description: Gets the name of the player based on the platform and URI type.

  • Type: string

  • Usage:

OnUnityReceiveMessage

  • Description: Handles messages received from Unity.

  • Usage:

OnIsBufferingChangedFalse

  • Description: Manually triggers the buffering state to false.

  • Usage:

OnError

  • Description: Manually triggers an error event.

  • Usage:

OnDownloadProgress

  • Description: Manually triggers a download progress event.

  • Usage:

Example Usage

Here's an example of how you might use the MediaEvents class in your application:

This API reference provides detailed information on each property, event, and method available in the MediaEvents class, along with their usage examples. This should help users understand and utilize the features of your media player effectively.

Last updated