📗
sounds
  • Introduction
  • Installing
  • Roadmap
  • API
    • Overview
    • AudioSource
    • Albums
    • Downloader
    • iOSCategory
    • MediaFormat
    • Monitoring
    • Quickplay
    • RecorderPlaybackController
    • SoundPlayer
    • SoundPlayerUI
    • SoundRecorder
    • SoundRecorderUI
    • Track
  • Platforms
    • Overview
    • Android
    • iOS
  • Contributing
    • Overview
    • Building
    • Debugging
    • Logging
  • ETC
    • Migrating from Flutter Sound
Powered by GitBook
On this page

Was this helpful?

  1. API

Downloader

Overview

The Downloader class is used internally and provided to users as a convenient mechanism for pre-caching audio located at a URL.

The Downloader class can actually be used to download any resource.

The Downloader class downloads the URL and saves it into a local file.

It is your responsibility to delete the local file once you have finished with it.

var saveToFile = TempMediaFile().empty();

await Downloader.download('https://some/path/rock.aac', saveToFile);

var track = Track.fromPath(saveToFile);
...
FileUtil().delete(saveToFile);

You can also obtain download progress information.

var saveToFile = TempMediaFile().empty();

await Downloader.download('https://some/path/rock.aac', saveToFile, progress:   (disposition) {
        print('progress ${disposition.state}, ${disposition.progress}';
    });
PreviousAlbumsNextiOSCategory

Last updated 4 years ago

Was this helpful?