fix: create render context before file load

This commit is contained in:
edde746
2026-02-24 00:07:09 +01:00
parent 3d9c6b203f
commit a1a030a130
+5
View File
@@ -139,6 +139,11 @@ static void mpv_plugin_handle_method_call(FlMethodChannel* channel,
fl_texture_registrar_register_texture( fl_texture_registrar_register_texture(
self->texture_registrar, FL_TEXTURE(self->texture)); self->texture_registrar, FL_TEXTURE(self->texture));
// Create the render context eagerly — mpv needs it BEFORE any
// file is loaded, otherwise VO init fails with "No render context
// set" and the video track is dropped entirely.
self->player->InitRenderContext();
// Set redraw callback: when mpv has a frame, mark texture available // Set redraw callback: when mpv has a frame, mark texture available
MpvTexture* tex = self->texture; MpvTexture* tex = self->texture;
self->player->SetRedrawCallback([tex]() { self->player->SetRedrawCallback([tex]() {