NativeMediaPlayer
NativeMediaPlayer is a bridge class that calls native APIs. It can be initiated manually by using the NativeMediaPlayer API below, or automatically by using MNPSettings.
Namespace
using NativeMediaPlayerCenter;
Methods
void | Init(Playlist playlist, string listenerName, bool playWhenReady) | Initiate the plugin with a default playlist listenerName is name of the GameObject which has MediaEventListener.cs, and playWhenReady is player starts playing upon the plugin initiation |
void | Prepare(Playlist playlist, string listenerName, bool playWhenReady) | Prepare a new playlist |
void | Play() | Starts or resumes playback |
void | Pause() | Pauses playback |
void | Stop() | Stops playback |
void | Previous() | Seeks to the previous MediaItem |
void | Next() | Seeks to the next MediaItem |
void | FastForward() | Seeks forward in the current MediaItem by SeekIncrement (seconds) |
void | Rewind() | Seeks backward in the current MediaItem by SeekIncrement (seconds) |
void | SeekTo(float time) | Seeks to a position specified in seconds in the current MediaItem |
float | GetDuration() | Get the total duration of your current media item |
float | GetCurrentPosition() | Get the current position of your current media item |
bool | HasPreviousMediaItem() | Returns whether a previous media item exists, which may depend on the current repeat mode and whether shuffle mode is enabled |
bool | HasNextMediaItem() | Returns whether a next media item exists, which may depend on the current repeat mode and whether shuffle mode is enabled |
string | RetrieveAlbumTitle() | Returns a natively retrieved AlbumTitle of the current MediaItem |
string | RetrieveAlbumArtist() | Returns a natively retrieved AlbumArtist of the current MediaItem |
string | RetrieveTitle() | Returns a natively retrieved Title of the current MediaItem |
string | RetrieveArtist() | Returns a natively retrieved Artist of the current MediaItem |
string | RetrieveGenre() | Returns a natively retrieved Genre of the current MediaItem |
string | RetrieveReleaseDate() | Returns a natively retrieved ReleaseDate of the current MediaItem |
string | RetrieveArtwork() | Returns a natively retrieved Artwork data of the current MediaItem in base64 string format |
Variables
bool | isInit (read-only) | Returns true if the plugin has been initiated |
bool | AutoSave | Set this true if you want the player to automatically save and load following variables float NativeMediaPlayer.Volume int NativeMediaPlayer.RepeatMode bool NativeMediaPlayer.ShuffleModeEnabled int NativeMediaPlayer.CurrentMediaItemIndex |
bool | isPlaying (read-only) | Returns true if the player is playing |
bool | isLoading (read-only) | Returns true if the player is loading a MediaItem |
int | RepeatMode | Get or set the repeat mode int RepeatMode.Disabled = 0 int RepeatMode.RepeatOne = 1 int RepeatMode.RepeatAll = 2 |
bool | ShuffleModeEnabled | Get or set the shuffle mode |
float | Volume | Get or set the player volume |
Playlist | CurrentPlaylist (read-only) | Returns the current playlist |
UriType | CurrentUriType (read-only) | Returns the current UriType of the current playlist |
int | GetCurrentMediaItemIndex (read-only) | Returns the index number of the current MediaItem |
int[] | GetShuffleOrder (read-only) | Returns the current play order |
string | Error (read-only) | Returns the lastest error message |
int | SeekIncrement (read-only) | Returns the seek increment |
int | PreBufferDuration (read-only) | Returns the pre-buffer duration |
NMPSettings
NMPSettings automates the initiation process of the NativeMediaPlayer, and also configure its default values.