Native Media Player for Android & iOS

how to start

1. If you are using StreamingAssets, create a new folder named ‘StreamingAssets’ under Assets. Put your media sources in this folder.
2. Import NativeMediaPlayer prefab to your scene.
3. Configure NMPSettings, MediaEventListener, AndroidSettings, iOSSettings attached to the prefab using the inspector.
4. Import MediaSource prefab to your scene.

Choose which media source you want the initiate the player with

5. Import necessary media source prefabs (Playlist or MediaItem) to your scene and attach them to the MediaSource. Configure media items using the inspector of the prefabs. 
6. When adding an album art image, click the texture and check ‘Read/Write Enabled’ under Advanced in the inspector.

Check Read/Write Enabled

7. Set the MediaSource to NMPSettings's Media Source under Core Components.

Put your MediaSource in the Core Components

 

C# Scripts with Custom Inspector

NMPSettings.cs

Automates general configurations and default settings for NativeMediaPlayer, which is a bridge class that controls the native APIs.

💡 Included in NativeMediaPlayer.prefab

 

See this page for the details

https://codeqo.tistory.com/category/Native%20Media%20Player/NativeMediaPlayer

Easy-to-use custom inspector. No code required.


MediaEventListener.cs

Listens to the playback events from the native side and invokes callback events.

💡 Included in NativeMediaPlayer.prefab

 

See this page for the details

https://codeqo.tistory.com/category/Native%20Media%20Player/MediaEventListener


AndroidSettings.cs

Manages Android native settings.

💡 Included in NativeMediaPlayer.prefab

 

See this page for the details

https://codeqo.tistory.com/category/Native%20Media%20Player/Android

Android MediaStyleNotification preview in the custom inspector


iOSSettings.cs

Manages iOS native settings.

💡 Included in NativeMediaPlayer.prefab

 

See this page for the details

https://codeqo.tistory.com/category/Native%20Media%20Player/iOS


Playlist.cs

The playlist is implemented by all NativeMediaPlayer implementations. It enables sequential playback of multiple media items.

💡 public static class NativeMediaController is an extender class for Playlist management. This simplifies the implementation of multiple playlists.

💡 Included in Playlist.prefab

 

See this page for the details

https://codeqo.tistory.com/category/Native%20Media%20Player/Playlist


MediaSource.cs

A required script for NMPSettings.cs as a default media source. It offers 3 different media types.

  1. A MediaItem
  2. A Playlist
  3. Multiple Playlists

💡 Included in MediaSource.prefab

Supports multiple playlists (version 1.9.3+)