[Unity][Android][AAR][Kotlin] nativeplugin ExoPlayer Music/Audio

何を学習するのか?

AAC音楽ファイルの再生の為 Android ExoPlayerをUnityで
利用する為にKotlinを利用してAAR Native Plugin を書いてみます。

Simple Test AAR Unity Plugin Kotlin

Delete App Module
Copy Unity Class Library to Android Studio
Add Kotlin Class
Android Studio
Build Module to Make AAR File
Android Studio Output AAR Path
AAR Drug and Drop to Unity
Unity use AAR Module
Add Logcat Plugin On unity

Unity AAR Plugin ERROR

How to Solve can’t access with argument.

Add Gradle

now can access with argument Unity kotlin native plugin.

Add Android 10 Permission on Unity

ExoPlayer access local music File need permission.

Android Setting Write Permission to External (SDCard)
Android Manifest

For ExoPlayer

Android (ExoPlayerPluginKy.kt)
Android (build.gradle)
Unity (mainTemplate.gradle)
Unity (ExoPlayermanager.cs)

投稿者: yoshimax

Software Engineer #Unity #iOS