Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions lib/mpv/player/player_native.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import 'dart:async';
import 'dart:io' show Platform;

import 'package:flutter/widgets.dart';
import 'package:flutter/services.dart';

import '../models.dart';
Expand Down Expand Up @@ -99,6 +101,14 @@ class PlayerNative extends PlayerBase {
// Show the video layer
await setVisible(true);

// Linux: wait one frame so texture populate() runs and creates MPV render context before loadfile.
if (Platform.isLinux) {
WidgetsBinding.instance.scheduleFrame();
final c = Completer<void>();
WidgetsBinding.instance.addPostFrameCallback((_) => c.complete());
await c.future;
}

// Set HTTP headers for Plex authentication and profile
if (media.headers != null && media.headers!.isNotEmpty) {
final headerList = media.headers!.entries.map((e) => '${e.key}: ${e.value}').toList();
Expand Down