MIME type audio/mpeg is not streaming?

1.4k Views Asked by At

I am using Matt Gallagher's streaming here.

I am trying to play SHOUTCast API returned urls. But Media with MIME type audio/mpeg are not being played without showing any error.

But MIME type audio/aacp are playing fine.

Why so? Do I need to use something other than this?

IN Matt's tutorial he stated that for mp3 files I need to add fileTypeHint but that is already there and for MediaType = audio/mpeg it is not going inside any of case in below function.

What need to change?

+ (AudioFileTypeID)hintForFileExtension:(NSString *)fileExtension
{
    AudioFileTypeID fileTypeHint = kAudioFileAAC_ADTSType;
    if ([fileExtension isEqual:@"mp3"])
    {
        fileTypeHint = kAudioFileMP3Type;
    }
    else if ([fileExtension isEqual:@"wav"])
    {
        fileTypeHint = kAudioFileWAVEType;
    }
    else if ([fileExtension isEqual:@"aifc"])
    {
        fileTypeHint = kAudioFileAIFCType;
    }
    else if ([fileExtension isEqual:@"aiff"])
    {
        fileTypeHint = kAudioFileAIFFType;
    }
    else if ([fileExtension isEqual:@"m4a"])
    {
        fileTypeHint = kAudioFileM4AType;
    }
    else if ([fileExtension isEqual:@"mp4"])
    {
        fileTypeHint = kAudioFileMPEG4Type;
    }
    else if ([fileExtension isEqual:@"caf"])
    {
        fileTypeHint = kAudioFileCAFType;
    }
    else if ([fileExtension isEqual:@"aac"])
    {
        fileTypeHint = kAudioFileAAC_ADTSType;
    }
    return fileTypeHint;
}

And With this streamer how do I work in condition where I am playing top5 stations and for that I have fetch all URL from PLS file and save them in an Array.

Now how do I continuously play them as it is radio

1

There are 1 best solutions below

0
On

I also faced the same problem. It seems that if no fileExtension is there the default fileTypeHint is kAudioFileAAC_ADTSType (as the first line of the function).

Changing it to AudioFileTypeID fileTypeHint = kAudioFileMP2Type will solve the MediaType = audio/mpeg problem.