-
Notifications
You must be signed in to change notification settings - Fork 6k
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
Support non-UTF-8 ICY metadata #6753
Comments
Thanks for the report! I wasn't able to reproduce after watching the provided stream for ~1 hour - but I can see how we're assuming a UTF-8 character encoding without any concrete evidence, and it looks like it's not strictly defined for ICY. I'll have a look into how we can best handle this. I'm going to mark this as an enhancement, since the ICY spec is pretty under-defined it's hard to really call this a bug in ExoPlayer - we currently do a sensible-ish thing in an ambiguous situation :) |
If this can help, I noticed the following when listening to this stream using Foobar2000 on Windows.
I don't know if that could help, but that's what I noticed. |
Also change IcyInfo.rawMetatadata from String to byte[] ICY doesn't specify the character encoding, and there are streams not using UTF-8 (issue:#6753). It seems the default of at least one server is ISO-8859-1 so let's support that as a fallback: savonet/liquidsoap#411 (comment) Also update IcyDecoder to skip strings it doesn't recognise at all instead of decoding invalid characters. The feed from issue:#6753 now decodes accents correctly: EventLogger: ICY: title="D Pai - Le temps de la rentrée", url="null" PiperOrigin-RevId: 285388522
It seems your stream metadata is encoded in ISO-8859-1. It looks like this is the default for at least one ICY server: I've updated IcyDecoder to fall-back to ISO-8859-1 if UTF-8 decoding fails - now accents in your stream are rendered correctly in LogCat by the demo app. |
Also change IcyInfo.rawMetatadata from String to byte[] ICY doesn't specify the character encoding, and there are streams not using UTF-8 (issue:#6753). It seems the default of at least one server is ISO-8859-1 so let's support that as a fallback: savonet/liquidsoap#411 (comment) Also update IcyDecoder to skip strings it doesn't recognise at all instead of decoding invalid characters. The feed from issue:#6753 now decodes accents correctly: EventLogger: ICY: title="D Pai - Le temps de la rentrée", url="null" PiperOrigin-RevId: 285388522
[REQUIRED] Issue description
I read an audio stream from a URL (it's a webradio) with ICY metadata. The source is a bit old, it uses Airtime, and it sends its metadata in a non-UTF-8 format. In our case, it's mostly French songs.
Current behaviour:
Desired behaviour
[REQUIRED] Reproduction steps
You can clone and run my radio app : https://github.com/yattoz/Tsumugi-app
All you need to do is press play and wait. Songs with accents are not very frequent so you may need to wait quite some time.
The metadata code is located in the file
RadioService.kt
.[REQUIRED] Link to test content
The audio source used is : https://radio.mahoro-net.org/streams/tsumugi
It's in plain text in the app, and is accessible from anywhere in the world.
[REQUIRED] A full bug report captured from the device
You'll find attached the bug report from my physical device, Motorola Moto G5 Plus "potter". I harvested it right when a song with an accent appeared (see logcat extract just below)
bugreport-potter_n-OPS28.85-17-6-2-2019-12-11-22-38-04.zip
In addition, here is what is displayed by my Log when I print respectively:
addMetadataOutput
[REQUIRED] Version of ExoPlayer being used
I am using ExoPlayer 2.11.0 (the latest release at the time of writing).
I saw the same behaviour on 2.10.6.
[REQUIRED] Device(s) and version(s) of Android being used
This has been reproduced on:
Comment:
I didn't test anything like modifying ExoPlayer by myself, but I happened to read quickly the files related to ICY metadata parsing: https://github.com/google/ExoPlayer/tree/release-v2/library/core/src/main/java/com/google/android/exoplayer2/metadata/icy
It might be a problem to force the decoding as UTF-8 of the byte array in the IcyDecoder:
ExoPlayer/library/core/src/main/java/com/google/android/exoplayer2/metadata/icy/IcyDecoder.java
Line 42 in 76962d5
This method is actually a simple String decoding with a given charset:
ExoPlayer/library/core/src/main/java/com/google/android/exoplayer2/util/Util.java
Line 545 in 76962d5
Or as I said before, if there's no good alternative, it might be helpful to store and expose this byte array to let the developer deal with special characters.
Thank you very much for your hard work!
The text was updated successfully, but these errors were encountered: