feat: Implement native video player screen for IPTV streams using media_kit with extensive playback optimizations.

This commit is contained in:
Michael committed 2025-12-26 10:03:12 +01:00
1 parent 9a0bda4b7d
commit 4d93cc246d
2 files changed
+177 -157

No files matched your search

@@ -71,6 +71,7 @@ class _LitePlayerScreenState extends ConsumerState<LitePlayerScreen>
bool _isStabilizing = false;
Timer? _stabilizationTimer;
Timer? _controlsTimer;
int _loadId = 0;
// Focus
final FocusNode _playPauseFocusNode = FocusNode();
@@ -164,8 +165,11 @@ class _LitePlayerScreenState extends ConsumerState<LitePlayerScreen>
_isLoading = true;
_errorMessage = null;
_isStabilizing = true;
_loadId++;
});
final currentLoadId = _loadId;
try {
final currentStreamId =
widget.channels != null && widget.channels!.isNotEmpty
@@ -215,7 +219,7 @@ class _LitePlayerScreenState extends ConsumerState<LitePlayerScreen>
_resetControlsTimer();
controller.addListener(_videoListener);
} catch (e) {
if (mounted)
if (mounted && currentLoadId == _loadId)
setState(() {
_isLoading = false;
_errorMessage = "Playback Error: $e";
@@ -235,6 +239,7 @@ class _LitePlayerScreenState extends ConsumerState<LitePlayerScreen>
// Force hide loader immediately when playing
if (value.isPlaying) {
if (_isLoading) setState(() => _isLoading = false);
if (_errorMessage != null) setState(() => _errorMessage = null);
if (_isStabilizing) _isStabilizing = false;
_stabilizationTimer?.cancel();
} else {