I had no success on google, developer.android.com and LibVLCSharp/LibVLC.Android documentation. In the LibVLC documentation, it clearly states it supports HDR, but I found no examples in the git repos of how to enable HDR playback. Google and StackOverflow seemed to not have any snippets, documentation nor even questions asking how to enable HDR playback neither in C# nor in Java; neither "raw" code nor using any libraries like LibVLC.
I tested with the normal VLC android app, and it indeed plays HDR content. I am attempting to play local HDR media (more specifically SMB share. Both the normal VLC app and my app has the proper permissions to access and play the media)
The following code snippet does play the video but does not enable HDR, thus the colors in the video become washed up:
_libVLC = new LibVLC();
m_VlcControl = new MediaPlayer(_libVLC);
_videoView = new VideoView(this) { MediaPlayer = m_VlcControl };
AddContentView(_videoView, new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent));
var media = new Media(_libVLC, new Uri(cleanFilePathStr));
m_VlcControl.EnableHardwareDecoding = true;
m_VlcControl.Play(media);
My app does indeed detect that the display supports HDR via Display?.IsHdr
, but it does not auto-enable it when starting the playback.
Device OS: Android 11
(min) Target SDK: 30