Search code examples
flutterdartmobilevlcflutter-video-player

Flutter VLC Player with options


import 'package:flutter/material.dart';
import 'package:flutter_vlc_player/flutter_vlc_player.dart';

class Home extends StatefulWidget {
  @override
  _ExampleVideoState createState() => _ExampleVideoState();
}

class _ExampleVideoState extends State<Home> {

  final VlcPlayerController controller = new VlcPlayerController.network(url);


  @override
  Widget build(BuildContext context) {
    return Scaffold(
        body: SizedBox(
            height: 100,
            width: 40,
            child: new VlcPlayer(
                aspectRatio: 16 / 9,
             options : VlcPlayeroptions(),
                controller: controller,
                placeholder: Center(child: CircularProgressIndicator()),
            )
        )
    );
  }
} 

this is my example where video is playing good, but i need to add options to it like play and pause, "options" is not working

i need to add play and pause button on vlc player in flutter app


Solution

  • Add a widget that sends play/pause through the controller class. Check out the other available methods too for the VlcPlayerController class.

    ElevatedButton.icon(
                onPressed: () => controller.pause(),
                icon: const Icon(Icons.pause),
                label: const Text('Pause'))