Follow the steps below to initialize the plugin manually.
Make sure the AutoInit options is set to false in the preferences.
Manually create a Playlist instance, and initialize MediaPlayer with the playlist.
// Create a media itemMediaItem mediaItem =newMediaItem("audioPath");List<MediaItem> mediaItems =new() {mediaItem};Playlist playlist =newPlaylist(UriType.StreamingAssets, mediaItems);MediaPlayer.Initialize(playlist);// or...MediaItem mediaItem =newMediaItem("audioPath");MediaPlayer.Initialize(mediaItem);
Even if you are initializing the plugin manually, you must have NativeMediaPlayer object in the root of the scene. NativeMediaPlayer communicates with the native plugins in order to execute callbacks.
Extended Example with Code Integration
Here is an extended example using additional functionality to manage selected paths and playlists.