AlvaroFranco / AFSoundManager

iOS audio playing (both local and streaming) and recording made easy
MIT License
807 stars 131 forks source link

can't play loaction mp3 file #28

Open JWLAZY opened 9 years ago

JWLAZY commented 9 years ago

i try your demo ,it is ok,but i used cocoapads ,it don't work and The program crash.

AlvaroFranco commented 9 years ago

Hi, could you share more details about your problem? Logs, errors, crash messages, the file URL you're trying to play, etc.

JWLAZY commented 9 years ago

thank you very much! ^_^

[[AFSoundManager sharedManager] startPlayingLocalFileWithName:@"1.mp3" andBlock:^(int percentage, CGFloat elapsedTime, CGFloat timeRemaining, NSError *error, BOOL finished) {
       _lab1.text = [NSString stringWithFormat:@"%d",percentage];
        _lab2.text = [NSString stringWithFormat:@"%f",elapsedTime];
        _lab3.text = [NSString stringWithFormat:@"%f",timeRemaining];
    }];

this is ok, but if i use cocoapad to install afsoundmanager ,and use the new method ,it didn't working

[[AFSoundManager sharedManager] startPlayingLocalFileWithName:@"1.mp3"  atPath:nil withCompletionBlock:(progressBlock)block :^(int percentage, CGFloat elapsedTime, CGFloat timeRemaining, NSError *error, BOOL finished) {
       _lab1.text = [NSString stringWithFormat:@"%d",percentage];
        _lab2.text = [NSString stringWithFormat:@"%f",elapsedTime];
        _lab3.text = [NSString stringWithFormat:@"%f",timeRemaining];
    }];

AlvaroFranco commented 9 years ago

The first code no longer works since that method was changed in previous updates. The second code should work fine. Why it doesn't work? It crashes the app? The sound doesn't play? If it crashes, please post the crash message log.