alvarofranco / afsoundmanager Goto Github PK
View Code? Open in Web Editor NEWiOS audio playing (both local and streaming) and recording made easy
License: MIT License
iOS audio playing (both local and streaming) and recording made easy
License: MIT License
I'm really stuck here, how do u change the volume with the slider?
Hi @AlvaroFranco ,
I try to play a mp3 file from remote url, so the app crashed.
Console Logs:
2015-04-04 09:21:17.653 QNSShow[602:12426] -[__NSCFData objectForKey:]: unrecognized selector sent to instance 0x7fcd91f0ad10
2015-04-04 09:21:17.801 QNSShow[602:12426] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFData objectForKey:]: unrecognized selector sent to instance 0x7fcd91f0ad10'
*** First throw call stack:
if I disable these code lines, the app will work
You can pick any mp3 url from this like below to reproduce this problem
http://download.chiasenhac.com/mp3/us-uk/u-pop/nothing-else-matters~metalica~1001903_download.html
How can I check when current AFSoundItem is stop/start playing if I use AFSoundQueue with UITableView (each AFSoundItem in UITableViewCell)?
Thank you!
Has this project been abandoned? Would like to know so that we can move on to another solution.
Thanks.
hi, it is every time showing 42:48 time Remaining when stream from url. how can i solve this
thank you
For example:@"http://abv.cn/music/%E5%85%89%E8%BE%89%E5%B2%81%E6%9C%88.mp3"
I wanna recorded , but i failed , could you make a demo in your project? If you can make them associated with a player, I think it's better for us newbie. Thank you very much.
how can i get the status, such as, playing, buffering, pause, stopped....
I choose your library fot its simplicity, so i have used your example code and i'm getting this error when trying to play what i have recorded:
NSOSStatusErrorDomain -43
AFSoundManager.sharedManager().moveToSecond(Int32(second));
How do fit it?
Hi, I'm sorry to use the issue tracker to ask this but is there a way to reduce the buffer size when playing a remote http file ? Problem is that the current buffer size is too large and songs can take more than 20 seconds to start playing even in Wifi. Thanks.
for example, many tracks I put into my project using AFSoundManager get 0:00 for duration, it seems thats the library exists severe issue on metadata fields.
For some reason, my audio plays when I use “startStreamingRemoteAudioFromURL” but the block never gets hit. It skips right over it which means it never updates the timeRemaining and elapsedTime.
if i drag a littie UISlider it response,but if i drag more it will not response ,and i want to know why。
How can I stop music?
Thanks!
NSURL *url = [NSURL URLWithString:@"http://222.186.15.28:8083/demo_store/2015/12/28/94ef7255caf8704acfa36fdf3d444052.mp3"];
NSURL *ceceurl = [NSURL URLWithString:@"http://www.cecesat.com/FileCenter/data/APS/TF/TPO-20-C1.mp3"];
AFSoundItem *item6 = [[AFSoundItem alloc] initWithStreamingURL:url ];
AFSoundItem *item7 = [[AFSoundItem alloc] initWithStreamingURL:ceceurl];
item6 is ok,but item7 cant get duration,Is mp3 file damaged? But the android is good
url1:
2016-01-14 10:39:45.454 AFSoundManager-Demo[22069:77459] Item duration: 73 - time elapsed: 20
2016-01-14 10:39:46.454 AFSoundManager-Demo[22069:77459] Item duration: 73 - time elapsed: 0
ceceurl:
2016-01-14 10:39:47.453 AFSoundManager-Demo[22069:77459] Item duration: 0 - time elapsed: 0
2016-01-14 10:39:47.453 AFSoundManager-Demo[22069:77459] Finished item, next one is (null)
2016-01-14 10:39:47.459 AFSoundManager-Demo[22069:77459] Item duration: 0 - time elapsed: 0
2016-01-14 10:39:47.459 AFSoundManager-Demo[22069:77459] Finished item, next one is (null)
2016-01-14 10:39:47.460 AFSoundManager-Demo[22069:77459] Item duration: 0 - time elapsed: 0
hi, the fetchInfoForCurrentPlaying method is not implemented
how to remove the listener from the Afsoundplayback
You are sharing the same AVplayer
/AVAudioPlayer
instance all the time in your code. You can't use more than a sound simultaneously by now...
Especially since the default place to play from is [[NSBundle mainBundle] resourcePath], which is a different place.
i try your demo ,it is ok,but i used cocoapads ,it don't work and The program crash.
Is possible do such things with the library?
start playing .mp3 from url immediately (like streaming or streaming)
cache it and track caching progress during it's playback
save cached file to local storage
It seems that you are using _currentItem in setUpItem:
_currentItem.duration = (int)CMTimeGetSeconds(_player.currentItem.asset.duration);
Before it is assigned to.
Easy to fix by setting _currentItem before calling setUpItem:
-(id)initWithItem:(AFSoundItem *)item {
if (self == [super init]) {
_currentItem = item;
[self setUpItem:item];
_status = AFSoundStatusNotStarted;
}
return self;
}
I met a problem:
When network is slow, sometimes AFSoundManager will pause a little, and continue. sometimes it will stop playing. When it stops, try to "resume" audio playing, encounter the following problem:
elapsedTime, timeRemaining ... sometimes will stop update after resume.
But can hear audio.
Seems startStreamingRemoteAudioFromURL:andBlock: stop calling it's Block.
This problem can be reproduced in slow network.
i found one bug, i want to play some mp3 in an queue, but the mp3 is very short, less than 1s,can‘t play other music unless the first one
I am playing sounds in a queue and if the app is in background and the track finishes the queue couldn't play the next sound infact muffle /distort all the sound with the error
AFSoundItem: 0x7f9a7163fc10> 0
ERROR: >aq> 1627: failed (-66674); will stop (4096/0 frames)
Any help or solution appreciated .Thanks in advance.
When I run the app the audio plays when the view loads. The app continues to play audio when it goes into background mode. I am able to successfully pause and/or play audio from the Control Center (accessed either from within the app or the Lock Screen) but, if I access the Lock Screen audio controls and pause the player, the music pauses and the lock screen controls disappear. I expect the music to pause, but not for the controls to disappear.
Note: I already use MPNowPlayingInfoCenter on my example.
I try to force built in speaker when headphone jack plugged in, but nothing happen. Did I miss something?
When I stream a mp3 with artwork image (copied the file from itunes into my server), I get no sound and no error. Removing the artwork, everything is fine.
Any suggestions what's wrong?
Use AFSoundRecord can't record
As the title described, I'd like to let people can switch the output device between headphone and speaker while the sound is playing. For example, when people make his/her ear close to the phone, it turns to use headphone to play the sound, otherwise use speaker to play the sound.
How to implement this use AFSoundManager?
I need to call the following method several time to play music from a particular view controller.
Each time I call this method memory increases. Those memory are not released when I leave that view controller. If I remove the listenFeebackUpdates block code, it working fine without any unwanted memory issues.
To reproduce the issue I attached following code snippets, please check it.
(void)playMusicWithFileName:(NSString*)fileName{
AFSoundItem *item = [[AFSoundItem alloc] initWithLocalResource:fileName atPath:nil];
[player pause];
player = nil;
player = [[AFSoundPlayback alloc] initWithItem:item];
item = nil;
// If I remove the listenFeedbackUpdate code block then there is no memory issue.
[player listenFeedbackUpdatesWithBlock:nil andFinishedBlock:^(void) {
NSLog(@"Finished");
}];
[player play];
}
Thanks
When the app is in background, sound stop.
Hi, how to seek when using a queue, i found AFSoundPlayback class has a method named "playAtSecond:", but AFSoundQueue class doesn't have.
If I download some audio files, I can't play it. because you play bundle audio file by default. I think you should let the user choose which file to play. not be limited to bundle file
Xcode 5.0.2, iOS 7.1
Test on simulator iPhone Retina (4-inch 64-bit): No warning at all.
Test on simulator iPhone Retina (3.5-inch): Has following Warning.
After testing on 3.5-inch, when change back to 4-inch. the warning doesn't go away. Don't know why the compiler didn't detect the warning in the first place..
Detail:
In AFAudioRouter.m, line 31:
[[AVAudioSession sharedInstance]setDelegate:self]; <-----
Warning Message:
AFSoundManager/AFAudioRouter.m:31:53: Incompatible pointer types sending 'Class' to parameter of type 'id'
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.