简体   繁体   中英

how to play mp3 streaming in objectives c

I have this stream url with mp3 type: http://www.slobodnyvysielac.sk/redata/other/play.php?file=informacna%20vojna%20-%202015-02-17%20financne%20skupiny.mp3

when I open this url with Safari or Chrome, it can play, but I can't play it with objectives C code (iOS).

Please tell me the solution! Thanks all!

player = [[AVPlayer alloc] initWithURL:[NSURL URLWithString:@"http://archive.slobodnyvysielac.sk/informacna%20vojna%20-%202015-02-10%20hudo.mp3"]];
[player play];

Inside your view controller or whatever class you have define this, don't define it inside the event where you stream.

AVPlayer *player

EDIT:

There was a problem with your URL, if you open it in the browser, it opens a flash player so I inspected the flash object and got the original MP3 url which will stream, and you can compare how Google Chrome eg reacts to both URLs to notice the difference, now the url in my above code is the correct one

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM