如何从iOS中的URL播放MP3

时间:2015-11-23 02:03:10

标签: ios url webview mp3

这个问题似乎与许多问题重复。我已经在这些问题中回答了很多问题,但他们并没有为我工作。所以如果你帮帮我,我决定再问这个问题。我有一个从webview获取的URL

  

[[[webview request] URL] absoluteString];

这是我从URL播放MP3文件的代码:

// properties
@property (strong,nonatomic) AVPlayerItem *playerItem;
@property (strong,nonatomic) AVPlayer *player;

// coding
NSString *decoded = (__bridge_transfer NSString *)CFURLCreateStringByReplacingPercentEscapesUsingEncoding(NULL, (CFStringRef)aSongURL, CFSTR(""), kCFStringEncodingUTF8);
NSURL *aURL = [NSURL URLWithString:decoded];
self.playerItem = [AVPlayerItem playerItemWithURL:aURL];
self.player = [AVPlayer playerWithPlayerItem:self.playerItem];
self.player = [AVPlayer playerWithURL:aURL];
[self.player play];

请帮帮我

修改

//output
aURL = "http://laguboard.com/music/down/33867378/2794942/NTU0NktpZE56eERWZGxVeC9zTS9LVUd1TEhkZTE0cFZuaW1QS1pFMHVhOUNkM2ZoZEE=/(http://mp3xload.wapka.me).mp3"

0 个答案:

没有答案