iosstreamingmpmovieplayercontrollermpmovieplayermpmoviewcontroller

radio streaming without MPMoviePlayerController


i am currently doing a small radio shoutcast for android and ios with kony. everything is fine with android but for ios, i am creating a library to play the shoutcast.

Unfortunatly, it seems that the player of MPMoviePlayerController need to be set as a subview to work and i am unable to do that.

does anybody know an other solution to play a shoutcast on IOS?


Solution

  • I don't know about shoutcast but I imagine its similar to SoundCloud in which you use the API to parse the stream URL? If I'm right in thinking that then you simply need to put the URL into an NSURL and make sure to tell the MPMoviePlayerController the source, like so...

    radioPlayer = [[MPMoviePlayerController alloc] initWithContentURL:[NSURL URLWithString:YOUR_SHOUTCAST_STREAM_URL]];
    radioPlayer.movieSourceType = MPMovieSourceTypeStreaming;
    

    Then simply play

    [radioPlayer prepareToPlay];
    

    Hope that helps :)