Skip to content

feat: ✨ Support waveform extraction from remote URLs on iOS and macOS - #502

Open
lavigarg-simform wants to merge 2 commits into
mainfrom
fix/I054_waveform_from_url
Open

lavigarg-simform wants to merge 2 commits into
mainfrom
fix/I054_waveform_from_url

Conversation

@lavigarg-simform

@lavigarg-simform lavigarg-simform commented Jun 26, 2026 •

Copy link
Copy Markdown

Description

Adds support for extracting waveforms from remote http/https audio URLs on iOS and macOS.

Why it didn't work before:

  • iOS/macOS decode waveforms with AVAudioFile, which only reads local files.
  • A remote URL was handed straight to it, so extraction failed.

What changed:

  • On iOS/macOS, a remote URL is now downloaded to a temp file first, then decoded.
  • The temp file is deleted afterwards (best-effort cleanup).
  • The original file extension is kept so the native decoder can detect the format.
  • Android is untouched — its MediaExtractor already reads network URIs directly.
  • Docs updated to show loading a waveform straight from a network URL.

Checklist

  • The title of my PR starts with a Conventional Commit prefix (fix:, feat:, docs: etc).
  • I have followed the Contributor Guide when preparing my PR.
  • I have updated/added tests for ALL new/updated/fixed functionality.
  • I have updated/added relevant documentation in docs and added dartdoc comments with ///.
  • I have updated/added relevant examples in examples or docs.

Breaking Change?

  • Yes, this PR is a breaking change.
  • No, this PR is not a breaking change.

Related Issues

Closes #54

iOS/macOS decode waveforms via AVAudioFile, which only reads local files, so remote http(s) URLs failed extraction. The file is now downloaded to a temp file before decoding and cleaned up afterwards.
Android's MediaExtractor handles network URIs directly, so its path
is unchanged.
@lavigarg-simform
lavigarg-simform force-pushed the fix/I054_waveform_from_url branch from ed07d1a to 085d01d Compare June 26, 2026 12:44
@lavigarg-simform
lavigarg-simform marked this pull request as ready for review June 26, 2026 12:45

@vasu-nageshri-simform vasu-nageshri-simform left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this. The download-then-decode approach for waveform extraction works. I'm requesting changes because the new docs section says something that doesn't hold on iOS/macOS.

What I checked (macOS host, same AVFoundation as iOS)

  • I ran the real downloadAudioToTempFile against a local HTTP server. The temp file keeps the extension, and for an extension-less URL it has none. Both decode fine in AVFoundation (3.68s).
  • flutter analyze is clean.
Case Result
AVAudioFile(forReading:) with an http:// URL (the #54 root cause) ❌ OSStatus error 2003334207
AVAudioPlayer(contentsOf:) with an http:// URL ❌ same error, and this PR doesn't change the native player
downloadAudioToTempFile then decode ✅

What I could not check

  • I did not run the full extraction through the plugin on an iOS or macOS app.

Comment thread doc/documentation.md Resolved
Comment thread lib/src/base/utils.dart Resolved
Comment thread CHANGELOG.md Resolved
- Document that playback streaming is Android-only and show
  WaveformExtractionController for URL waveforms on iOS/macOS
- Add connection, response and idle timeouts to the download
- Let stopWaveformExtraction() abort an in-progress download and make a
  stop during it fail the extraction instead of being ignored
- Link the PR in the CHANGELOG entry
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

2 participants