Playing M3U livestream

65 Views Asked by At

First of all, this question was marked as duplicate, but since the answer of the other one didn't help me, i decided to create a new one. I just want to know whats wrong with my code, or a different way to do it. In the other one they say to use Movieplayercontroller, but i have no experience with that whatsoever, so a little help is appreciated.

I'm developping a simple XCode app, to play a live M3U stream from the internet.

The program i have so far, is a simple play button, and a webview. It loads up the webview, and opens a media player screen, but no music playing whatsoever. I'm sure its just a simple thing that has to be solved.

Also, i've already added the web link to the info.plist so it allows this, and only this URL.

Here's my vieuwcontroller.m code

#import "ViewController.h"

@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

- (IBAction)Play:(id)sender {

    NSString *stream = @"http://listen.radionomy.com/cutefm2016.m3u";
    NSURL *url = [NSURL URLWithString:stream];
    NSURLRequest *urlrequest = [NSURLRequest requestWithURL:url];
    [Webview loadRequest:urlrequest];

}

@end

and the vieuwcontroller.h code

#import <UIKit/UIKit.h>

@interface ViewController : UIViewController {

    IBOutlet UIWebView *Webview;

}

- (IBAction)Play:(id)sender;

@end
0

There are 0 best solutions below