Search code examples
ios4

How to play m3u8 format in iPhone


I have got a url http://stream.alayam.com/alayam/alayam/playlist.m3u8 and wanted to play in iPhone, with m3u8 format, I have successfully got the voice, however movie is not coming. I have used MPMEDIAPLAYER framework and other things.


Solution

  • I am giving u answer in new answer because code will be more readable. I just download MPMovieController example from Apple website and then add your link with http://

    In NSURL i pass link http://stream.alayam.com/alayam/alayam/playlist.m3u8 not this one stream.alayam.com/alayam/alayam/playlist.m3u8 and it works fine.

    -(void)initAndPlayMovie:(NSURL *)movieURL
        {
        // Initialize a movie player object with the specified URL
        MPMoviePlayerController *mp = [[MPMoviePlayerController alloc] initWithContentURL:movieURL];
        if (mp)
        {
            // save the movie player object
            self.moviePlayer = mp;
            [mp release];
    
            // Apply the user specified settings to the movie player object
            [self setMoviePlayerUserSettings];
    
            // Play the movie!
            [self.moviePlayer play];
        }
    }