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

Weird bleeps and no metadata available when playing a SHOUTcast stream #460

Closed
dylancom opened this issue Feb 6, 2021 · 17 comments · Fixed by #467
Closed

Weird bleeps and no metadata available when playing a SHOUTcast stream #460

dylancom opened this issue Feb 6, 2021 · 17 comments · Fixed by #467

Comments

@dylancom
Copy link
Contributor

dylancom commented Feb 6, 2021

When playing a SHOUTcast stream there are random bleeps occuring every x seconds and song metadata is not available.
This happens for e.g. with:
http://23.237.150.98:8512/ (PRM Internet Radio)
http://lin1.san.fast-serv.com:9844/ (ANDYS 80S)

When playing those URL's with for e.g. Apple Music or VLC it plays without any bleeps and the currently played song is displayed.

@dylancom dylancom changed the title Weird bleeps and no metadata available when playing from a SHOUTcast stream Weird bleeps and no metadata available when playing a SHOUTcast stream Feb 6, 2021
@dimitris-c
Copy link

If my memory serves me right, these bleeps might occur when the stream has metadata but are not parsed... Try and see if the request header has a key/value pair of icy-metaint in it, if that's missing then that's why you hear those bleeps..
The server includes the metadata in the stream but if the header is missing then StreamingKit tries to parse the metadata as audio thus, the bleeps!

@dylancom
Copy link
Contributor Author

dylancom commented Feb 10, 2021

@dimitris-c icy-metaint seems indeed absent. Had luck with https://github.com/jorgenhenrichsen/SwiftAudio/pull/93/files but unfortunately this is based around AVPlayer.

@dimitris-c
Copy link

dimitris-c commented Feb 10, 2021

Try setting "0" on the header value in STKHTTPDataSource line 618. See if that makes any difference.
I haven't got a chance to test this on my library AudioStreaming most likely to behave the same though...

@dylancom
Copy link
Contributor Author

@dimitris-c Setting "Icy-MetaData" to "0" removes the random bleeps indeed so it seems your memory serves you right :) .

@dimitris-c
Copy link

So this is a server issue, it should provide the icy-metaint field in the header for the metadata parsing to work!

@dylancom
Copy link
Contributor Author

AVPlayer can still parse it though.

@iDevelopper
Copy link

@dylancom ,

How do you install the StreamingKit library in your application? Cocoapods is not the latest version.

@dylancom
Copy link
Contributor Author

@iDevelopper I copied all the source files located inside StreamingKit/StreamingKit/* in my Xcode project.

@iDevelopper
Copy link

So, I have not weird bleeps in my applications, one is available on App Store (https://apps.apple.com/fr/app/shout-radios-player/id1231770007). The next one is WIP.

@dylancom
Copy link
Contributor Author

@iDevelopper I just tried your app and added: http://23.237.150.98:8512/ to favorite stations. I enabled metadata and also hear bleeps / weird noises every x seconds.

@iDevelopper
Copy link

@dylancom ,

Very interesting. I'll take a test!

@iDevelopper
Copy link

Yes, I also hear those weird noises. It must come from the server, no ?

@dylancom
Copy link
Contributor Author

@iDevelopper No, when using: https://github.com/jorgenhenrichsen/SwiftAudio/pull/93/files it plays without noises and shows the metadata. (Based around AVPlayer)

@iDevelopper
Copy link

iDevelopper commented Feb 12, 2021

StreamingKit looks for the "Icy-metaint" key in the header. However, the header does not have this key but a "icy-metaint" key:

    if ([httpHeaders objectForKey:@"Icy-metaint"] != nil)
    {
        _metadataBytesRead  = 0;
        _metadataStep       = [[httpHeaders objectForKey:@"Icy-metaint"] intValue];
        _metadataOffset     = _metadataStep;
    }

If you try to replace "Icy-metaint" by "icy-metaint", it will work.

@iDevelopper
Copy link

What I don't understand because with the other stations the header have an "icy-metaint" key also and it works!

@dimitris-c
Copy link

So what I noticed is that these particular streams have the header data as part of the stream, eg they have Icy Headers. StreamingKit is parsing the data and correctly assigns the values...
What happens is that normal http headers requested by CFHTTPMessageCopyAllHeaderFields are case-insensitive while the parsing of he Icy header is not, that's why it doesn't work in this case.

Now I need to find time and add parsing Icy headers in AudioStreaming

@iDevelopper
Copy link

@dimitris-c ,

With your brilliant explanations, and reading the documentation for the CFHTTPMessageCopyAllHeaderFields function, now I understand. Thanks a lot for that!

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

Successfully merging a pull request may close this issue.

3 participants