我目前正在制作一个可以搜索歌曲的iOS应用程序。然后,您将获得一个歌曲列表,您可以从中选择,然后从应用程序流式传输。它使用了tinysong API的组合,我试图使用Grooveshark的URL结合我给我播放的歌曲来播放歌曲......例如。
https://grooveshark.com/facebookWidget.swf?songID=13963
我已经快速浏览了这篇文章:How can i share a grooveshark music url to facebook with the music widget?
但我想知道我是否可以获得更多信息。
我想要做的是使用更改的songID播放该链接的音频...
我的目标C代码是:
//Opens the link of Url from first song and plays it
NSString *SongID = [[jsonArray objectAtIndex:0] objectForKey:@"SongID"];
NSString *playString = [@"https://grooveshark.com/facebookWidget.swf?songID=" stringByAppendingString:SongID];
//Converts songURL into a playable NSURL
NSURL *playURL = [NSURL URLWithString:playString];
AVAudioPlayer *backgroundMusicPlayer = [[AVAudioPlayer alloc] initWithContentsOfURL:playURL error:&error];
[backgroundMusicPlayer prepareToPlay];
[backgroundMusicPlayer play];
但它不是在玩。我应该怎么做才能发挥它?我知道iOS无法播放Adobe Flash播放器,并且考虑到它采用swf格式,这就是为什么我认为它无法播放但我不太了解flash和/或它与iOS结合。所以任何帮助或想法将不胜感激。
如果还有另一种方式来访问和播放来自庞大的歌曲数据库的歌曲,其艺术家和专辑也来自客观C(如spotify API,但免费),请发表评论,因为这可能是另一种解决方案!
谢谢!