UltraStar-Deluxe / Play

Free and open source singing game with song editor for desktop, mobile, and smart TV
https://ultrastar-play.com
MIT License
389 stars 72 forks source link

Loading songs failed on Android TV (Shield TV), mp4 not working #327

Closed Daviddevits closed 1 year ago

Daviddevits commented 2 years ago

First startup play gets stuck on the loading screen. It could not create a songs dit since the logs said:

UnityEngine.AndroidJavaObject..ctor (System.IntPtr jobject) (at :0) UnityEngine._AndroidJNIHelper.ConvertFromJNIArray[ArrayType] (System.IntPtr array) (at :0) UnityEngine.AndroidJNIHelper.ConvertFromJNIArray[ArrayType] (System.IntPtr array) (at :0) UnityEngine.AndroidJavaObject.FromJavaArrayDeleteLocalRef[ReturnType] (System.IntPtr jobject) (at :0) UnityEngine.AndroidJavaObject._Call[ReturnType] (System.String methodName, System.Object[] args) (at :0) UnityEngine.AndroidJavaObject.Call[ReturnType] (System.String methodName, System.Object[] args) (at :0) AndroidUtils.GetAppSpecificStorageAbsolutePath (System.Boolean sdCard) (at <726881d5c0f2479887e0e6f9887f5454>:0) LoadingSceneControl.CreateInitialSongFolders () (at :0) LoadingSceneControl.Start () (at :0)

Editing the settings.json myself and adding /storage/emulated/0/Android/data/com.Karaoke.UltraStarPlay/Songs to songDirs solved this. (not the app can not access anything other then inside /storage/emulated/0/Android/data/com.Karaoke.UltraStarPlay/ but i guess thats normal recent android behaviour) So nowplay can start but when going in the song dirs setting in the gui: its impossible to choose a song in the input menu with a gamedpad controller.

Then i get erros trying to play a song with the mp4 video with h264

2022-10-05 22:34:20.982 [ERR] VideoPlayer cannot play url : file:///storage/emulated/0/Android/data/com.Karaoke.UltraStarPlay/Songs/SingStar Amped/Alice in Chains - Would/Alice in Chains - Would [VD#0].mp4

path seems corect and the txt, mp3 file and jpg in the same folder get loaded. Any ideas what i'm missing here?

Daviddevits commented 1 year ago

Sorry i just noticed only webm and vp8 are supported in Unity on Android

achimmihca commented 1 year ago

Thanks for the detailed bug report.

mp4 should also work on Android (but not on Linux). See Unity docs. I already tested this successfully.

Shield TV was made for streaming, so I guess it also should support mp4 natively.

AndroidUtils.GetAppSpecificStorageAbsolutePath does some native calls to find the path where the app should be allowed to access files on SD card. File access is restricted on modern Android. I think in your case, it should have returned /storage/emulated/0/Android/data/com.Karaoke.UltraStarPlay.

Any ideas what i'm missing here?

I fear Shield TV may implement things differently from other Android devices, which is why it did not work for you. Not sure what is wrong on your device. Does it work with webm video instead of mp4?

its impossible to choose a song in the input menu with a gamedpad controller.

Well, there is no file browser (#315). The text field is intended for copy&paste.

Also, there were some issues with gamepad navigation that should be better now. But for editing text fields, you still need a keyboard.

basisbit commented 1 year ago

Mp4 is only the container format. It can hold frame data which is for example encoded using VP8, h264 or similar. Unity supports reading mp4 on all platforms. However it relies on the operatong system to provide decoder support. On Android, that very much depends on vendor, drivers and hardware acceleration support. That is nothing we can influence.

achimmihca commented 1 year ago

Media file support will be improved with #362