Baseflow / Baseflow/XamarinMediaManager
iOS: remote mp3 duration is 0, MetadataUpdated doesn't fire
- Dominant language
- C#
- Stars
- 763
- Forks
- 299
- PR merge metrics
- No merged PRs in 30d
Description
## 🐛 Bug Report
On iOS in Xamarin.Forms, when playing a remote mp3, Duration is always zero {0:00:00}. Furthermore the MetadataUpdated event doesn't fire, even when metadata is loaded (IsMetadataExtracted is true).
The audio plays, but Duration is always 0. I've tried several mp3s, including the one in the wiki.
### Expected behavior
1. MediaItem.Duration is non-zero after metadata loads. (The example mp3 is 0:04:30)
2. mediaItem.MetadataUpdated event gets fired when metadata loads.
### Reproduction steps
```C#
CrossMediaManager.Current.StateChanged += (sender, e) => {
if (e.State == MediaManager.Player.MediaPlayerState.Playing)
{
var duration = CrossMediaManager.Current.Queue.Current.Duration; // Duration is zero {0:00:00}
}
};
var mediaItem = await CrossMediaManager.Current.Play("https://ia800806.us.archive.org/15/items/Mp3Playlist_555/AaronNeville-CrazyLove.mp3");
mediaItem.MetadataUpdated += (sender, args) => {
// This never fires on iOS
var duration = args.MediaItem.Duration;
};
```
### Configuration
**Version:** 0.9.7 to 0.9.9, Xamarin.Forms 4.7.0 to 4.8.0.1269
**Platform:**
- [x] :iphone: iOS
- [ ] :robot: Android
- [ ] :checkered_flag: WPF
- [ ] :earth_americas: UWP
- [ ] :apple: MacOS
- [ ] :tv: tvOS
- [x] :monkey: Xamarin.Forms
Contributor guide
Research direction
Start by reproducing the issue with the provided remote MP3 and the CrossMediaManager.Current.Play example on iOS. Check how Queue.Current.Duration and MediaItem.MetadataUpdated behave after IsMetadataExtracted becomes true. Done means Duration is non-zero after metadata loads and MetadataUpdated fires with the updated duration.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp, ios
- Domain
- audio-video-rtc, mobile-dev
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100