bluefireteam / audioplayers

A Flutter package to play multiple audio files simultaneously (Android/iOS/web/Linux/Windows/macOS)
https://pub.dartlang.org/packages/audioplayers
MIT License
2.01k stars 845 forks source link

Linux: Setting position via play() shortcut doesn't work #1751

Closed japostoles closed 9 months ago

japostoles commented 9 months ago

Checklist

Current bug behaviour

Passing a position in play() doesn't seem to apply.

Expected behaviour

The clip should start playing at the position passed, instead it starts playing from 0:00.

Steps to reproduce

Run the code sample. Compare the two methods of seeking.

Code sample

Code sample ```dart import 'package:audioplayers/audioplayers.dart'; import 'package:flutter/material.dart'; class SampleApp extends StatelessWidget { AudioPlayer player = AudioPlayer(); final SampleAudioFile = '/home/jonathan/Documents/music/2855.mp3'; @override Widget build(BuildContext context) { return MaterialApp( home: Container( color: Colors.black, child: Column(children: [ DefaultTextStyle( style: TextStyle(fontSize: 12, color: Colors.white), child: Text( 'Click prepare, wait, then click play\nCompare to hitting insta-play', textAlign: TextAlign.center, )), TextButton(onPressed: playShortcut, child: Text('play()')), TextButton(onPressed: playThenSeek, child: Text('play() then seek()')), TextButton(onPressed: playWithSeek, child: Text('play(position)')), TextButton(onPressed: kill, child: Text('KILL AUDIO')) ]), )); } Future kill() async { await player.stop(); } Future playShortcut() async { player.stop(); player = AudioPlayer(); await player.play(DeviceFileSource(SampleAudioFile)); } Future playThenSeek() async { player.stop(); player = AudioPlayer(); await player.play(DeviceFileSource(SampleAudioFile)); await player.seek(Duration(minutes: 1)); } Future playWithSeek() async { player.stop(); player = AudioPlayer(); await player.play(DeviceFileSource(SampleAudioFile), position: Duration(minutes: 1)); } } void main() async { WidgetsFlutterBinding.ensureInitialized(); runApp(SampleApp()); } ```

Affected platforms

Linux

Platform details

Debian 12

AudioPlayers Version

5.2.1

Build mode

debug

Audio Files/URLs/Sources

No response

Screenshots

No response

Logs

 • Debian clang version 14.0.6
 • cmake version 3.25.1
 • ninja version 1.11.1
 • pkg-config version 1.8.1
Full Logs Flutter doctor: ``` [✓] Flutter (Channel stable, 3.16.5, on Debian GNU/Linux 12 (bookworm) 6.6.6-surface-1, locale en_US.UTF-8) • Flutter version 3.16.5 on channel stable at /home/jonathan/src/flutter • Upstream repository https://github.com/flutter/flutter.git • Framework revision 78666c8dc5 (5 weeks ago), 2023-12-19 16:14:14 -0800 • Engine revision 3f3e560236 • Dart version 3.2.3 • DevTools version 2.28.4 [✓] Linux toolchain - develop for Linux desktop • Debian clang version 14.0.6 • cmake version 3.25.1 • ninja version 1.11.1 • pkg-config version 1.8.1 ```

Related issues / more information

Perhaps related: #1749

Working on PR

no way

Gustl22 commented 9 months ago

This was fixed here: https://github.com/bluefireteam/audioplayers/pull/1695 You can checkout by using these lines in pubspec.yaml: https://github.com/bluefireteam/audioplayers/blob/main/contributing.md#current-development