Open Doxoh opened 6 years ago
I got the following error:
[AVAsset loadValuesAsynchronouslyForKeys:completionHandler:] invoked with unrecognized keys (
title,
artwork,
artist
).
There is no meta data (to my knowledge) embedded in the shoutcast stream. I am building an app that utilizes multiple shoutcast streams and I poll that data from the external XML data providing additional information such as song name etc. This data should also be available depending on the stream management software you use, I am using Centova Cast and Auto DJ.
I can get you more detailed information but my main development machine is currently undergoing a raid array backup and rebuild so it is out of commission for a day or two.
https://www.mixxx.org/manual/latest/chapters/livebroadcasting.html In this post under 9.3 is the description to set the metadata settings.
My ShoutCast service provides and RPC call that returns and XML dataset. http://panel5.serverhostingcenter.com:2199/rpc/tjguhenj/streaminfo.get
I ingest this data for "Song Name" etc.
But that is not implement in this compontent?
When do you call the XML to get the information in the right time?
Put it in a recurring timer, i update mine every 30 seconds
Can you send me an example what do you do in your PCL?
RadioStreamData is just a poco class that matches the streaminfo.get xml. But I am using ServiceStack as the json client so I am not sure this helps you unless you have a ServiceStack license.
var url = new Uri(DataURL);
var jsonClient = new JsonServiceClient(url.AbsoluteUri.Replace(url.PathAndQuery, ""));
var rsData = await jsonClient.GetAsync<RadioStreamData>(url.PathAndQuery);
@mike-rowley I have the same, also using a SHOUTcast server. I can also get the data trough a JSON REST API, but how do I assign it to the MediaManager? What methods/properties do I call?
I am not sure if IAndroidMediaNotificationManager and its collateral code is in the 0.45 release, if not pull the develop branch and build your own version until it is. Take a look at this pull request, it explains how to implement your own Android Notification class, this will allow you to customize your own Notifications in any way you like.
Here is where you will find the code that generates the Android Notification if you don't override the class. https://github.com/martijn00/XamarinMediaManager/blob/develop/MediaManager.Android/MediaSession/MediaNotificationManagerImplementation.cs
I am not working so long with Xamarin. I dont know how ich create a background task (IOS, Android) that every 30 seconds do the JSon Call
Im getting this error on iOS, how could this fix it?
@Doxoh Use a timer.
@TGlev What error? Under what circumstances?
@mike-rowley ok thanks. I will try it
Im also trying to stream from a shoutcast server and Im getting this error: (Xamarin.Forms.iOS)
[AVAsset loadValuesAsynchronouslyForKeys:completionHandler:] invoked with unrecognized keys (
title,
artwork,
artist
).
Since I can get this data from a JSON api, I was wondering how to pass it to the MediaManager to get rid of the error. Since the stream does not work at the moment.
@TGlev are you passing a MediaFile object with the appropriate fields filled out to the MediaNotificationManager's StartNotification or UpdateNotifications?
No. I found this plugin on Xamarin Blog and all Im doing is this:
await CrossMediaManager.Current.Play("stream.bigb21.nl:12000/live");
Never mind! I forgot to add http:// to the URL! 😛
@TGlev now its worked?
Yep.
var mediaFile = new MediaFile { Type = MediaFileType.Audio, Availability = ResourceAvailability.Remote, Url = "http://5.196.64.74:5099/live", MetadataExtracted = true }; await CrossMediaManager.Current.Play(mediaFile);
I do this, but I got the same error on IOS:
AVAsset loadValuesAsynchronouslyForKeys:completionHandler:] invoked with unrecognized keys ( title, artwork, artist ).
@TGlev did you change any options on the server?
I am still getting the error, but the audio is working.
No, I did not change anything. The server is not mine.
Alright. yes the audio is working too for me.
I will try the Timer option..
@Doxoh you are getting an error in the log or an exception in the application?
in the console.
Try filling in Artist and Title for the Metadata on the MediaFile
If you look at the code, that should be what is used to populate the notification on IOS
The Shoutcast server is not mine. I will tell that to the owner
Can I override the title and artist in the LockScreen control? Currently I shows "live"
It has nothing to do with the Shoutcast server.
var mediaFile = new MediaFile { Type = MediaFileType.Audio, Availability = ResourceAvailability.Remote, Url = "http://5.196.64.74:5099/live", MetadataExtracted = false }; mediaFile.Metadata.Title = "Song Title"; mediaFile.Metadata.Artist = "Artist Name"; await CrossMediaManager.Current.Play(mediaFile);
I HIGHLY suggest downloading the code and playing with the sample projects.
I do this:
` async Task
var titleArtist = //WebRequest
Device.BeginInvokeOnMainThread(() =>
{
if (titleArtist.Length > 1)
{
titel.Text = titleArtist[1].TrimStart(' ');
artist.Text = titleArtist[0].TrimEnd(' ');
}
else
{
titel.Text = titleArtist[0];
artist.Text = "HarbourTown - Radio";
}
mediaFile.Metadata.Title = titel.Text;
mediaFile.Metadata.Artist = artist.Text;
});
return result;
}`
In the first call it's worked. But when the next title is playing the MPNowPlayingInfo does not changed
I fixed it.
Run this after you changed the title CrossMediaManager.Current.MediaNotificationManager.UpdateNotifications(mediaFile, MediaPlayerStatus.Playing);
@Doxoh Can you elaborate please? I have the same issue with this plugin for my radio station. what does the //WebRequest look like. also when do you call GetTitleInfo() ?
Hello,
I want to use the MediaManager with a stream of a "shoutcast stream server". But I didn´t get MetaData. Do you know why or can you help?
Best Regards Doxoh