Home > Enterprise >  how to get only the audio duration from it's url
how to get only the audio duration from it's url

Time:11-18

I have audio with this link:

https://www.soundhelix.com/examples/mp3/SoundHelix-Song-1.mp3

how can I get its duration in my flutter app without getting the whole audio ?

Just it's length duration? I want the quickest possible way to get it.

Thank you.

CodePudding user response:

You could go with the just_audio package.

import 'package:just_audio/just_audio.dart';

final player = AudioPlayer();                   // Create a player
final duration = await player.setUrl(           // Load a URL
    'https://example.com/bar.mp3');             // Schemes: (https: | file: | asset: )
  • Related