audioplayers
audioplayers copied to clipboard
[v1 rc2] play function on remote freeze UI
The play function may be async, but it still freezes the UI until play start.
Full Description
When a widget call play function of a player
instance, with a remote source, this is freezing the UI until the song start to play.
This should not happen as this function is async.
This mean I can't scroll in listview, move the window or click anywere in app until the playing start.
Tried with await or not, even with a FutureBuilder for the UI, still freezing a few seconds until playing.
Code to Reproduce
InkWell(
onTap: () async {
await hp.playTrack();
},
child: Text('Click to play');
)
AudioPlayer player = AudioPlayer();
Future playTrack() async {
final source = UrlSource(
"https://vid.puffyan.us/latest_version?id=h2O6NDk3Qvc&itag=140&local=true&listen=1");
await player.play(source);
}
Log Errors No errors, just an unexpected freeze.
Files/URLs/Sources UI Call: https://git.p2p.legal/poka/fipy/src/branch/kplayer2audioplayer/lib/screens/home.dart#L419 Controller action: https://git.p2p.legal/poka/fipy/src/branch/kplayer2audioplayer/lib/providers/home.dart#L103
Screenshots Just image a UI freeze when choosing a song to play.
Platforms Tried on Windows 10.
- flutter version:
$ flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel beta, 2.13.0-0.3.pre, on Microsoft Windows [version 10.0.19044.1645], locale fr-FR)
[√] Android toolchain - develop for Android devices (Android SDK version 32.1.0-rc1)
[√] Chrome - develop for the web
[√] Visual Studio - develop for Windows (Visual Studio Build Tools 2019 16.11.13)
[√] Android Studio (version 2021.1)
[√] VS Code (version 1.67.0)
[√] Connected device (3 available)
[√] HTTP Host Availability
- audioplayers version: 1.0.0-rc.2
- release or not release: Debug and release mode.
- does the error occur and does it have any peculiarities: No
Please follow the issue template to include necessary information.
Done Let me know is you want me to try on Linux or Android device, but I don't think it's useful, because either you already know that or I'm just going wrong somewhere to use your lib.
did you manage to run the url of an mp3 with HTTP?
with https yes
I tried with http with security (https) and I don't success
any fix for this. My UI freezes completely when playing musics of longer duration with url as source playing youtube music.