bleonard252 / just_audio_mpv

MIT License
5 stars 3 forks source link

Player starts immediately on load #12

Open japostoles opened 7 months ago

japostoles commented 7 months ago

It seems that audio playback immediately starts once setFilePath() is called on an AudioPlayer.

To reproduce:

AudioPlayer player = AudioPlayer();
Duration? duration = await player.setFilePath('/some/file.mp3');

The audio will begin playing immediately after the call to setFilePath.

(Similar issue: #11)

japostoles commented 7 months ago

Adding 'pause=yes' to the options passed to mpv.load() fixes this issue, although I don't see an interface to manage that currently without modifying this library.

bleonard252 commented 7 months ago

That's odd. I tried that (against the example) and it didn't work.

japostoles commented 7 months ago

That's odd. I tried that (against the example) and it didn't work.

Meaning you tried the pause=yes and it didn't pause? Or that the example in the first post didn't autoplay?

Here's the tweak I made in mpv_player.dart:

await mpv.load((request.audioSourceMessage as UriAudioSourceMessage).uri, options: ['pause=yes']);
                                                                        ^^^^^^^^^^^^^^^^^^^^^^^^

I'm using mpv v0.35.1 on Debian 12.