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

Fetching ICY metadata fails on some streams #5876

Closed
nightwolf738 opened this issue May 12, 2019 · 4 comments
Closed

Fetching ICY metadata fails on some streams #5876

nightwolf738 opened this issue May 12, 2019 · 4 comments
Assignees
Labels

Comments

@nightwolf738
Copy link

nightwolf738 commented May 12, 2019

Hello,

I have been waiting for 2.10.0 release for a long time. Finally it has been released. Thanks for your effort.

I tried to fetch ICY metadata from radio streams, but it seems ExoPlayer fails on some streams. Here is some examples:

http://voyagesc.radyotvonline.com/
ExoPlayer fails in fetching ICY metadata on this radio stream while 'Current Song' section is not empty when you open link on browser (Chrome in my case). Also, ExoPlayer logs this issue as

W/IcyDecoder: Unrecognized ICY tag: null

I would like to also give a working example:
http://stream.radyoalaturka.com.tr:9100/
ExoPlayer successfuly fetches ICY metadata from this stream and invokes MetadataOutput listener.

The only difference between two streams is SHOUTcast Server version; failing stream version is 1.9.8 while working stream version is 2.5.5.733

I used an API level 28 Android 9 Emulator
I fetch ICY Metadata as follows:

player.addMetadataOutput(metadata -> {
            if ((metadata != null)) {
                final int length = metadata.length();
                if (length > 0) {
                    for (int i = 0; i < length; i++) {
                        final Metadata.Entry entry = metadata.get(i);
                        if (entry instanceof IcyInfo) {
                            final IcyInfo icyInfo = ((IcyInfo) entry);
                            Log.d("IcyInfo", icyInfo.title);
                        } else if (entry instanceof IcyHeaders) {
                            final IcyHeaders icyHeaders = ((IcyHeaders) entry);
                            Log.d("IcyHeaders", icyHeaders.name);
                            Log.d("IcyHeaders", icyHeaders.genre);
                        }
                    }
                }
            }
        });

I hope these examples help for finding the issue. If you think I miss something to fetch the metadata, please inform me.

Thank you.

@ojw28
Copy link
Contributor

ojw28 commented May 12, 2019

The problem is just that the first stream contains line terminators in the stream title. For example:

DJ MERT LEVENT - BON VOYAGE

 - 

The Pattern we use for matching doesn't handle that. It's easy to fix (note that it'll be working as intended that there are line terminators in the stream title, since that's what's in the underlying stream).

@nightwolf738
Copy link
Author

nightwolf738 commented May 13, 2019

Thank you for your response in such a short time. I would like to furher this issue to maintain the feature with minimum bugs:

  • Fetching ICY metadata does not work at all in my Sony E5553 Android 6.0, API 23 device, MetadataOutput listener is never being invoked, while API 26 & API 28 devices work fine on the same stream. You can test the issue via http://17773.live.streamtheworld.com/JOY_TURK2AAC_SC

  • http://46.20.3.228/ this radio stream has an empty 'Current Song' section but ExoPlayer invokes MetadataOutput with IcyInfo containing title field: ';StreamUrl='. It seems like ExoPlayer wrongly parses metadata because there is also a 'Stream Url' section when you open the link in browser.

That's all I have found so far. I would like to continue to report more bugs as I face.

Thank you.

@ojw28
Copy link
Contributor

ojw28 commented May 13, 2019

http://46.20.3.228/ this radio stream has an empty 'Current Song' section but ExoPlayer invokes MetadataOutput with IcyInfo containing title field: ';StreamUrl='. It seems like ExoPlayer wrongly parses metadata because there is also a 'Stream Url' section when you open the link in browser.

This is because our Pattern doesn't expect empty values, and is also easy to fix.

Fetching ICY metadata does not work at all in my Sony E5553 Android 6.0, API 23 device, MetadataOutput listener is never being invoked, while API 26 & API 28 devices work fine on the same stream. You can test the issue via http://17773.live.streamtheworld.com/JOY_TURK2AAC_SC

I'm less sure about this one. Does playback of the stream work at all? Does using the OkHttp extension rather than the default network stack resolve the problem? You should probably be using the OkHttp extension anyway if you're playing ICY streams, since on some devices the default network stack will not handle not-strictly-http status responses, and will fail playback with "Unexpected status line: ICY 200 OK" for some ICY streams. We should add an entry to our troubleshooting page about this!

@ojw28 ojw28 closed this as completed May 13, 2019
@ojw28 ojw28 reopened this May 13, 2019
@nightwolf738
Copy link
Author

Update

Using OkHttp extension resolves the problem in Sony E5553 Android 6.0, API 23. I only changed my code from this:

public HttpDataSource.Factory buildHttpDataSourceFactory() {
    return new DefaultHttpDataSourceFactory(userAgent);
}

to this:

public HttpDataSource.Factory buildHttpDataSourceFactory() {
        return new OkHttpDataSourceFactory(new OkHttpClient(), userAgent);
 }

We appreciate when other easy-to-fix bugs are resolved.

Thank you.

ojw28 added a commit that referenced this issue May 15, 2019
Issue: #5876
PiperOrigin-RevId: 247935822
ojw28 added a commit that referenced this issue May 15, 2019
Issue: #5876
PiperOrigin-RevId: 248119726
@ojw28 ojw28 closed this as completed May 15, 2019
ojw28 added a commit that referenced this issue May 15, 2019
Issue: #5876
PiperOrigin-RevId: 247935822
ojw28 added a commit that referenced this issue May 15, 2019
Issue: #5876
PiperOrigin-RevId: 248119726
@google google locked and limited conversation to collaborators Sep 27, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants