import 'dart:math'; import 'package:dart_vlc/dart_vlc.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; class VideoScreenDesktop extends StatefulWidget { const VideoScreenDesktop({Key? key, required this.url}) : super(key: key); final String url; @override State createState() => _VideoScreenDesktopState(); } class _VideoScreenDesktopState extends State { Player _player = Player(id: Random().nextInt(0x7fffffff)); @override Widget build(BuildContext context) { return Video( player: _player, scale: 1.0, // default showControls: true); } @override void initState() { super.initState(); final media2 = Media.network(widget.url); _player.open( media2, autoStart: true, // default ); RawKeyboard.instance.addListener((value) { if (value.logicalKey == LogicalKeyboardKey.arrowRight) { _player.seek(_player.position.position! + const Duration(seconds: 5)); } else if (value.logicalKey == LogicalKeyboardKey.arrowLeft) { _player.seek(_player.position.position! + const Duration(seconds: -5)); } }); } @override void dispose() { super.dispose(); _player.dispose(); } }