分享开源一个自己写的 ios 的电台播放器吧

2014-08-30 03:16:08 +08:00
 fofoone
其实我最早想做,是因为是看到v2有个同学通过豆瓣电台然后去搜索网易云音乐达到让64kbps到320kbps的音质做,再者当时豆瓣fm很多功能不是很全做,于是开了这个坑。
后来看豆瓣fm4.0功能已经很全了,于是没啥动力了,希望对大家有些用处。

基本播放流程
歌词
后台锁屏播放和控制
锁屏后封面+歌词

http://bcs.duapp.com/postquery/img1.PNG
http://bcs.duapp.com/postquery/img2.PNG
http://bcs.duapp.com/postquery/img3.PNG
6025 次点击
所在节点    分享创造
14 条回复
11
2014-08-30 03:19:50 +08:00
咕~~(╯﹏╰)b 地址呢。。
fofoone
2014-08-30 03:20:40 +08:00
这里!!
https://github.com/jovisayhehe/fmpro

居然忘记最重要的!
fofoone
2014-08-30 03:21:51 +08:00
qq2511296
2014-08-30 09:01:58 +08:00
已fork 挺不错的说 没有真机 只能模拟器上跑 模拟器好像不支持锁屏后台播放和锁屏歌词滚动

锁屏歌词滚动的实现原理是什么?
eato
2014-08-30 10:22:58 +08:00
DouBanApi 里的是豆瓣的用户名和密码吗?
fofoone
2014-08-30 11:18:22 +08:00
@eato
(´゚Д゚`)天呐,我改了,低级失误。
fofoone
2014-08-30 11:48:14 +08:00
@qq2511296
先通过notify_register_check("com.apple.iokit.hid.displayStatus", &token);
获取屏幕是否点亮。
在锁屏点亮的时候就在 封面上绘制歌词,然后每次更新歌词就通过 MPNowPlayingInfoCenter 的setNowPlayingInfo 更新锁屏封面。
Hysteria
2014-08-30 15:10:58 +08:00
赞一个!
djyde
2014-08-30 18:56:48 +08:00
@fofoone 楼主,你难道不知道git是可以看历史commit的?
fofoone
2014-08-30 20:08:38 +08:00
@djyde
知道,所以两边都改了。
parkman
2014-09-06 10:00:36 +08:00
这个是什么原因导致的。 是不是SD 版本不对

http://photo.weibo.com/1738495452/photos/detail/photo_id/3751743321175886
parkman
2014-09-06 10:17:36 +08:00
FIX , SD新版本要改下代码
parkman
2014-09-06 10:18:01 +08:00
[self.cover setImageWithURL:[NSURL URLWithString:track.picture] placeholderImage:nil options:SDWebImageRefreshCached];

__weak typeof(self) weakSelf = self;

//[self.cover sd_setImageWithURL:[NSURL URLWithString:track.picture] placeholderImage:nil options:SDWebImageRefreshCached completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, NSURL *imageURL)

[self.cover setImageWithURL:[NSURL URLWithString:track.picture] placeholderImage:nil options:SDWebImageRefreshCached completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType) {
CGImageRef imgRef = image.CGImage;
CGFloat width = CGImageGetWidth(imgRef);
CGFloat height = CGImageGetHeight(imgRef);
CGAffineTransform transform = CGAffineTransformIdentity;
CGRect bounds = CGRectMake(0, 0, width, height);
CGFloat scaleRatio = 1;
transform = CGAffineTransformMakeTranslation(0.0, height);
transform = CGAffineTransformScale(transform, 1.0, -1.0);
UIGraphicsBeginImageContext(bounds.size);
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextScaleCTM(context, scaleRatio, -scaleRatio);
CGContextTranslateCTM(context, 0, -height);
CGContextConcatCTM(context, transform);
CGContextDrawImage(UIGraphicsGetCurrentContext(), CGRectMake(0, 0, width, height), imgRef);
UIImage *imageCopy = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
weakSelf.bgcover.image = imageCopy;

}];
siri
2014-09-30 18:56:27 +08:00
lz求认识~

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/130721

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX