В моем приложении три кнопки:
- Воспроизведение,
- Пауза,
- SkipBackwardsFor5Seconds
Всякий раз, когда я нажмите кнопку SkipBackwardsFor5Seconds, ответа нет вообще. Я использую xcode 11.3.1, цель c. Большое спасибо!
ЗДЕСЬ МОЙ КОД:
#import "ViewController.h"
@interface ViewController ()
{
AVAudioPlayer *player;
}
@end
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
NSString *path = [[NSBundle mainBundle] pathForResource:@"WolfStreet" ofType:@"mp3"];
NSURL *url = [NSURL URLWithString:path];
player = [[AVAudioPlayer alloc]initWithContentsOfURL:url error:NULL];
}
- (IBAction)PlayButton:(id)sender {
[player play];
}
- (IBAction)PauseButton:(id)sender {
[player pause];
}
- (IBAction)SkiBackwardsFor5Seconds:(id)sender {
//should I use skipBackwardCommand here?
NSTimeInterval playbac = 5.0; // must be ≥ 0
[player playAtTime: player.deviceCurrentTime - playback];
}
@end