Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Metadata and webradio: how to recover data like on native player? #793

Open
pcdus opened this issue Feb 14, 2021 · 2 comments
Open

Metadata and webradio: how to recover data like on native player? #793

pcdus opened this issue Feb 14, 2021 · 2 comments

Comments

@pcdus
Copy link

pcdus commented Feb 14, 2021

Hello,

I would like to know how metadata are recovered from a a webradio?

I play an audio stream from an URL with:
var mediaItem = await CrossMediaManager.Current.Play(radioUrl);

I also use:

mediaItem.MetadataUpdated += (sender, args) => {
	var title = args.MediaItem.Title;
	Debug.WriteLine(title);
};

and:

CrossMediaManager.Current.MediaItemChanged += OnCurrentMediaItemChanged;

private void OnCurrentMediaItemChanged(object sender, MediaItemEventArgs e)
{
	var currentMedia = e.MediaItem;
	Debug.WriteLine($"OnCurrentMediaItemChanged - currentMedia :  {currentMedia.Title} {currentMedia.Artist}");
}

But these events are never raised.

However, if I push the app in background and I display the native iOS player, the title and artist are well recovered.

How is it possible? Can I recover these data in the app?

@pcdus
Copy link
Author

pcdus commented Feb 22, 2021

Finally I've found a way to manage this on iOS with MediaItem_PropertyChanged:

Source = await CrossMediaManager.Current.Play(radioUrl);
Source.PropertyChanged += MediaItem_PropertyChanged;
private void MediaItem_PropertyChanged(object sender, PropertyChangedEventArgs e)
{
    if (e.PropertyName == nameof(Source.Artist))
    {
        CurrentArtist = Source.Artist;
    }
    if (e.PropertyName == nameof(Source.Title))
    {
        CurrentTitle = Source.Title;
    }
}

However this doesn't work for Android: is it normal?

@pcdus
Copy link
Author

pcdus commented Sep 21, 2022

Hello, is there any news about this issue?

I just did some tests with the latest version but this doesn't change anything on Android.

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

No branches or pull requests

1 participant