alexmercerind/dart_vlc

setVolume not working at all

MazenxELGayar opened this issue · 0 comments

player.setVolume(0.1); not working, it just set the slider to 10% but the volume is still a 100%, sometimes it works, sometimes it doesn't, sometimes i have to keep repeating the function by putting it in build of the stateful widget so it keeps on rebuilding and repeating it until it works but this makes me unable to change the volume at all.


import 'dart:io';

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


class VideoPlayer extends StatefulWidget {
  @override
  _VideoPlayerState createState() => _VideoPlayerState();
}

class _VideoPlayerState extends State<VideoPlayer> {
  late Player player;
  bool isPlaying = false;

  @override
  void initState() {
    super.initState();
    player = Player(id: 0);
    player.open(
      Media.file(File(r"I:\F.r.i.e.n.d.s\[EgyBest].Friends.The.Reunion.2021.WEB-DL.1080p.x264.mp4")),
    );
    player.playbackStream.listen((event) {
      setState(() {
        isPlaying = event.isPlaying;
      });
    });
    player.setVolume(0.1);

  }

  @override
  void dispose() {
    player.dispose();
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {


    return Video(
      player: player,
      height: MediaQuery.of(context).size.height,
      width: MediaQuery.of(context).size.width,
    );
  }
}