Native Media Player
Glitch9 Inc.Main Docs.
  • Introduction
    • Native Media Player
    • Preparation
    • Initialization
  • Functionalities
    • Media Item
    • Media Metadata
    • Playlist
    • Media Events
    • UI Components
    • Android Settings
    • iOS Settings
  • Advanced
    • Manual Initialization
    • Creating Playlist at Runtime
    • Single Media Item Playlists
  • API Reference
    • MediaPlayer
      • Properties
      • Methods
    • MediaEvents
    • MediaItem
    • MediaMetadata
    • Playlist
    • Configuration Details
  • Support
    • FAQ
    • Troubleshooting
      • SeekTo (Seekbar) doesn't work
      • java.lang.NoClassDefFoundError
      • One of RECEIVER_EXPORTED or RECEIVER_NOT_EXPORTED should be specified
      • AndroidX Build Error: resource android:attr/lStar not found.
    • Update Logs
Powered by GitBook
On this page
  1. API Reference
  2. MediaPlayer

Properties

Some of these can be outdated.

Volume

  • Description: Gets or sets the volume of the media player.

  • Type: float

  • Usage:

    MediaPlayer.Volume = 0.5f;
    float currentVolume = MediaPlayer.Volume;

RepeatMode

  • Description: Gets or sets the repeat mode of the media player.

  • Type: int

  • Usage:

    MediaPlayer.RepeatMode = 1; // Example value
    int repeatMode = MediaPlayer.RepeatMode;

ShuffleModeEnabled

  • Description: Gets or sets whether shuffle mode is enabled.

  • Type: bool

  • Usage:

    MediaPlayer.ShuffleModeEnabled = true;
    bool isShuffleEnabled = MediaPlayer.ShuffleModeEnabled;

IsPlaying

  • Description: Gets whether the media player is currently playing.

  • Type: bool

  • Usage:

    bool isPlaying = MediaPlayer.IsPlaying;

IsLoading

  • Description: Gets whether the media player is currently loading media.

  • Type: bool

  • Usage:

    bool isLoading = MediaPlayer.IsLoading;

IsReady

  • Description: Gets whether the media player is ready to play media.

  • Type: bool

  • Usage:

    bool isReady = MediaPlayer.IsReady;

CurrentMediaItemIndex

  • Description: Gets the index of the current media item.

  • Type: int

  • Usage:

    int currentIndex = MediaPlayer.CurrentMediaItemIndex;

HasPreviousMediaItem

  • Description: Checks if there is a previous media item.

  • Type: bool

  • Usage:

    bool hasPrevious = MediaPlayer.HasPreviousMediaItem;

HasNextMediaItem

  • Description: Checks if there is a next media item.

  • Type: bool

  • Usage:

    bool hasNext = MediaPlayer.HasNextMediaItem;

BackgroundMode

  • Description: Gets or sets whether the media player operates in background mode.

  • Type: bool

  • Usage:

    MediaPlayer.BackgroundMode = true;
    bool backgroundMode = MediaPlayer.BackgroundMode;

BackgroundControls

  • Description: Gets or sets whether background controls are enabled.

  • Type: bool

  • Usage:

    MediaPlayer.BackgroundControls = true;
    bool backgroundControls = MediaPlayer.BackgroundControls;

LastMediaItemIndex

  • Description: Gets the index of the last played media item.

  • Type: int

  • Usage:

    int lastIndex = MediaPlayer.LastMediaItemIndex;

LastDuration

  • Description: Gets the duration of the last played media item.

  • Type: float

  • Usage:

    float lastDuration = MediaPlayer.LastDuration;

LastPosition

  • Description: Gets the last position of the media player.

  • Type: float

  • Usage:

    float lastPosition = MediaPlayer.LastPosition;

IsInitialized

  • Description: Indicates whether the media player is initialized.

  • Type: bool

  • Usage:

    bool isInitialized = MediaPlayer.IsInitialized;

IsPlaylistLoading

  • Description: Indicates whether the playlist is currently loading.

  • Type: bool

  • Usage:

    bool isLoading = MediaPlayer.IsPlaylistLoading;
    MediaPlayer.IsPlaylistLoading = true;

TempPlaylistIndex

  • Description: Gets or sets the temporary playlist index.

  • Type: int

  • Usage:

    int tempIndex = MediaPlayer.TempPlaylistIndex;
    MediaPlayer.TempPlaylistIndex = 1;

LastError

  • Description: Gets the current error message.

  • Type: string

  • Usage:

    string error = MediaPlayer.Error;

CurrentMediaItem

  • Description: Gets the current media item.

  • Type: MediaItem

  • Usage:

    MediaItem currentItem = MediaPlayer.CurrentMediaItem;

CurrentUriType

  • Description: Gets or sets the current URI type.

  • Type: UriType

  • Usage:

    UriType uriType = MediaPlayer.CurrentUriType;
    MediaPlayer.CurrentUriType = UriType.RemoteURL;

SeekIncrement

  • Description: Gets or sets the seek increment value.

  • Type: int

  • Usage:

    int seekIncrement = MediaPlayer.SeekIncrement;
    MediaPlayer.SeekIncrement = 10;

PreBufferDuration

  • Description: Gets or sets the pre-buffer duration value.

  • Type: int

  • Usage:

    int preBufferDuration = MediaPlayer.PreBufferDuration;
    MediaPlayer.PreBufferDuration = 5;

ListenerId

  • Description: Gets or sets the listener ID.

  • Type: string

  • Usage:

    string listenerId = MediaPlayer.ListenerId;
    MediaPlayer.ListenerId = "newListenerId";

BackgroundControlsEnabled

  • Description: Gets or sets whether background controls are enabled.

  • Type: bool

  • Usage:

    bool backgroundControls = MediaPlayer.BackgroundControlsEnabled;
    MediaPlayer.BackgroundControlsEnabled = true;

BackgroundPlayEnabled

  • Description: Gets or sets whether background play is enabled.

  • Type: bool

  • Usage:

    bool backgroundPlay = MediaPlayer.BackgroundPlayEnabled;
    MediaPlayer.BackgroundPlayEnabled = true;

CurrentPlaylistIndex

  • Description: Gets or sets the current playlist index.

  • Type: int

  • Usage:

    int currentIndex = MediaPlayer.CurrentPlaylistIndex;
    MediaPlayer.CurrentPlaylistIndex = 1;

HasNextPlaylist

  • Description: Indicates whether there is a next playlist.

  • Type: bool

  • Usage:

    bool hasNext = MediaPlayer.HasNextPlaylist;

HasPreviousPlaylist

  • Description: Indicates whether there is a previous playlist.

  • Type: bool

  • Usage:

    bool hasPrevious = MediaPlayer.HasPreviousPlaylist;

Playlists

  • Description: Gets the collection of playlists.

  • Type: IReadOnlyDictionary<int, Playlist>

  • Usage:

    var playlists = MediaPlayer.Playlists;

CurrentPlaylist

  • Description: Gets the current playlist.

  • Type: Playlist

  • Usage:

    Playlist currentPlaylist = MediaPlayer.CurrentPlaylist;
PreviousMediaPlayerNextMethods

Last updated 10 months ago