Failed to retrieve OpenGL context on Android.
Summary
When running on Android devices, no video texture is presented and the logs specify that an OpenGL context was not created. Audio plays in the background, it also works fine on Windows.
I have created a sample repo: https://gitlab.com/KieranDevvs/vlc-unity-issue-sample I might have included more than what is necessary in the git repo as I'm not sure what is necessary for unity (1st time uploading a unity project to git).
Minimal project and steps to reproduce
- Build the VLC-unity plugin manually to get all the binaries.
- Create a new VR template project in Unity.
- Create a folder under
AssetscalledPlugins - Drop the following assemblies into the root of
Plugins- libvlc.dll
- libvlccore.dll
- LibVLCSharp.dll
- System.Buffers.dll
- System.Memory.dll
- System.Numerics.Vectors.dll
- System.Runtime.CompilerServices.Unsafe.dll
- VLCUnityPlugin.dll
- Copy the
pluginsfolder from the VLC nightly build intoPluginsso it should look likeAssets/Plugins/plugins - Copy the
arm64-v8aassemblies for Android intoAssets/Plugins - Create a folder under
AssetsnamedScriptsand create a new script with the following contents: https://code.videolan.org/videolan/vlc-unity/-/blob/master/Assets/VLCUnity/Demos/Scripts/VLCMinimalPlayback.cs - Comment out
TextureHelper.FlipTextures(transform);(not necessary for reproducing the issue). - Create a new plane in the unity scene facing the camera and attach the script created in the previous step
- Build and run the project on an android device.
- Disable VR if running on a non-VR device by going to `Project Settings -> XR Plugin Management -> uncheck Inizialize XR on startup and unselect all providers for all platforms
What is the current bug behavior?
Audio of from the media stream but no video presented on the texture of the attached script object.
What is the expected correct behavior?
The relevant game texture is updated with the video image of the media that is currently playing.
Does it work on other plaforms? Does it work with the official VLC apps?
Works on Windows, ive not tried any other platform other than Androud & Windows.
Relevant logs and/or screenshots
Using catlog you will see the following issue:
04-17 13:20:38.314 12211 12253 D VLC : [b4000071b2b41760/0] libvlc libvlc: configured with ../configure '--host=aarch64-linux-android' '--build=x86_64-unknown-linux' '--with-contrib=/builds/KieranDevvs/vlc-unity/vlc-android/vlc/contrib/aarch64-linux-android' '--prefix=/builds/KieranDevvs/vlc-unity/vlc-android/vlc/build-android-aarch64-linux-android/install/' '--with-pic' '--disable-nls' '--enable-live555' '--enable-realrtsp' '--enable-avformat' '--enable-swscale' '--enable-avcodec' '--enable-opus' '--enable-opensles' '--enable-matroska' '--enable-taglib' '--enable-dvbpsi' '--disable-vlc' '--disable-shared' '--disable-update-check' '--disable-vlm' '--disable-dbus' '--enable-lua' '--disable-vcd' '--disable-v4l2' '--enable-dvdread' '--enable-dvdnav' '--enable-bluray' '--disable-linsys' '--disable-decklink' '--disable-libva' '--disable-dv1394' '--enable-mod' '--disable-sid' '--disable-gme' '--disable-tremor' '--disable-mad' '--enable-mpg123' '--disable-dca' '--disable-sdl-image' '--enable-zvbi' '--disable-fluidsynth' '--enable-fluidlite' '--disable-
04-17 13:20:38.314 12211 12253 I Unity : [VLC] Toggling Play Pause !
04-17 13:20:38.316 12211 12253 I VLCUnity: [VLC-Unity] ENTERED RENDERAPI_ANDROID.CPP -> JNI_ONLOAD
04-17 13:20:38.316 12211 12253 I VLCUnity: [VLC-Unity] (JNI_OnLoad_pf) dlsym(handle, JNI_OnLoad);
04-17 13:20:38.316 12211 12253 I VLCUnity: [VLC-Unity] [Android] initialize jni env 0xb400007215102500
04-17 13:20:38.316 12211 12253 I VLCUnity: [VLC-Unity] Exiting...
04-17 13:20:38.317 12211 12253 I VLCUnity: [VLC-Unity] UnityPluginLoad
04-17 13:20:38.317 12211 12253 I VLCUnity: [VLC-Unity] Initialise Render API
04-17 13:20:38.317 12211 12253 I VLCUnity: [VLC-Unity] s_Graphics->GetRenderer()
04-17 13:20:38.317 12211 12253 I VLCUnity: [VLC-Unity] CreateRenderAPI(s_DeviceType)
04-17 13:20:38.317 12211 12253 I VLCUnity: [VLC-Unity] Entering RenderAPI_OpenGLBase ctor
04-17 13:20:38.317 12211 12253 I VLCUnity: [VLC-Unity] Exiting RenderAPI_OpenGLBase ctor
04-17 13:20:38.317 12211 12253 I VLCUnity: [VLC-Unity] LAUNCH
04-17 13:20:38.318 12211 12253 I VLCUnity: [VLC-Unity] Calling... Initialize Render API
04-17 13:20:38.318 12211 12253 I VLCUnity: [VLC-Unity] Calling... CreateRenderAPI
04-17 13:20:38.318 12211 12253 I VLCUnity: [VLC-Unity] Entering RenderAPI_OpenGLBase ctor
04-17 13:20:38.318 12211 12253 I VLCUnity: [VLC-Unity] Exiting RenderAPI_OpenGLBase ctor
04-17 13:20:38.318 12211 12253 I VLCUnity: [VLC-Unity] Calling... ProcessDeviceEvent
04-17 13:20:38.318 12211 12253 I VLCUnity: [VLC-Unity] [EGL] Entering ProcessDeviceEvent with kUnityGfxDeviceEventInitialize
04-17 13:20:38.318 12211 12253 I VLCUnity: [VLC-Unity] [EGL] Failed to retrieve OpenGL Context... aborting.
04-17 13:20:38.318 12211 12253 I VLCUnity: [VLC-Unity] Calling... setVlcContext s_CurrentAPI=0xb4000071b2ca5ce0 mp=0xb4000071b2c5c4f0
04-17 13:20:38.318 12211 12253 I VLCUnity: [VLC-Unity] [Android] No OpenGL context retrieved
04-17 13:20:38.335 12211 12253 D Unity : Sensor : Accelerometer ( 1) ; 0.001196 / 0.00s ; bmi160 Accelerometer Non-wakeup / BOSCH
04-17 13:20:38.379 12211 12253 D Unity : Choreographer available: Enabling VSYNC timing
04-17 13:20:38.724 12211 12253 I VLCUnity: [VLC-Unity] get Video Frame 0
04-17 13:20:38.740 12211 12253 I VLCUnity: [VLC-Unity] get Video Frame 0
04-17 13:20:38.759 12211 12253 I VLCUnity: [VLC-Unity] get Video Frame 0
04-17 13:20:38.771 12211 12253 I VLCUnity: [VLC-Unity] get Video Frame 0
04-17 13:20:38.788 12211 12253 I VLCUnity: [VLC-Unity] get Video Frame 0
04-17 13:20:38.806 12211 12253 I VLCUnity: [VLC-Unity] get Video Frame 0
04-17 13:20:38.822 12211 12253 I VLCUnity: [VLC-Unity] get Video Frame 0
Environment
- OS: Android
- Version 31
- Device: RealMe 7 Pro & Oculus Quest 2
- LibVLC version and architecture: 4.0.0-dev-19100-g6ffd460903
- LibVLCSharp version: 4.0.0.0
- VLC Unity plugin version: Not tagged, built from the master branch as of 2 days ago.
- Scripting backend used: IL2CPP
