mirror of
https://github.com/R0m1k3/xtremflow.git
synced 2026-10-12 01:36:20 +02:00
feat: Implement web-based video player screen with playback controls and stream type handling.
This commit is contained in:
1 parent
4ecfd4f48c
commit
1547b376e0
1 file changed
+11
-1
@@ -61,7 +61,9 @@ class _PlayerScreenState extends ConsumerState<PlayerScreen> {
|
||||
String? _currentStreamUrl;
|
||||
String _statusMessage = 'Loading...';
|
||||
String? _errorMessage;
|
||||
String? _errorMessage;
|
||||
bool _isMuted = false;
|
||||
bool _ignoreStatusUpdates = false;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
@@ -209,7 +211,9 @@ class _PlayerScreenState extends ConsumerState<PlayerScreen> {
|
||||
);
|
||||
}
|
||||
} else if (type == 'playback_status') {
|
||||
setState(() => _isPlaying = data['status'] == 'playing');
|
||||
if (!_ignoreStatusUpdates) {
|
||||
setState(() => _isPlaying = data['status'] == 'playing');
|
||||
}
|
||||
} else if (type == 'user_activity') {
|
||||
_onHover();
|
||||
}
|
||||
@@ -256,6 +260,12 @@ class _PlayerScreenState extends ConsumerState<PlayerScreen> {
|
||||
// Optimistic update to make UI responsive immediately
|
||||
setState(() => _isPlaying = !_isPlaying);
|
||||
|
||||
// Ignore incoming status updates for 2 seconds to prevent fighting
|
||||
_ignoreStatusUpdates = true;
|
||||
Future.delayed(const Duration(seconds: 2), () {
|
||||
if (mounted) _ignoreStatusUpdates = false;
|
||||
});
|
||||
|
||||
if (_isPlaying) {
|
||||
_sendMessage({'type': 'play'});
|
||||
} else {
|
||||
|
||||
Reference in new issue
Block a user