Skip to content

Display waves and play content from web url like: https://example.com/example_audio.mp4 #54

Description

@bulgarian-beast

Hey guys, I love this project, could you explain me how to generate waves from an http audio url?
I can't find any doc or example in the pub.dev link or by reading the sources.

To work around the problem I created a temporary file, but it would be nice to have a method to invoke fromUrl.
I'm posting this code to help someone who would like to read voice messages from a database.

ElevatedButton(
    onPressed: () async {
        Response response = await get(Uri.parse(
            "https://www.soundhelix.com/examples/mp3/SoundHelix-Song-1.mp3"));
        Uint8List bytes = response.bodyBytes;
        File file = File('${appDirectory.path}/audio1.mp3');

        if (response.statusCode == 200) {
              await file.writeAsBytes(bytes);
               playerController1.preparePlayer(file.path).then((value) {
                    if (mounted) {
                        setState(() {});
                    }
             });
       }
 },
child: Text("Buf url"),
 ),

Originally posted by @bulgarian-beast in #20 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions