Skip to content

Commit

Permalink
修改bug
Browse files Browse the repository at this point in the history
  • Loading branch information
夏远全 committed Apr 23, 2017
1 parent 4850625 commit 55e589b
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 69 deletions.
61 changes: 0 additions & 61 deletions XYQPlayer/Source.bundle/Root.plist

This file was deleted.

Binary file removed XYQPlayer/Source.bundle/en.lproj/Root.strings
Binary file not shown.
30 changes: 24 additions & 6 deletions XYQPlayer/XYQAudioToolView.m
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ +(instancetype)openAudioPlayerView:(NSArray *)musicArr audioPlayerViewController
audioView.musicArr = musicArr;
audioView.containViewController = controller;
audioView.bgView = [[UIImageView alloc] initWithFrame:controller.view.bounds];
audioView.bgView.image = [UIImage imageNamed:@"Source.bundle/source/audiobook_bg_icon"];
audioView.bgView.image = [UIImage imageNamed:@"audiobook_bg_icon"];
[controller.view addSubview:audioView.bgView];
[controller.view addSubview:audioView];

Expand All @@ -102,30 +102,30 @@ - (void)setupSubView{
//播放、暂停
self.playOrStopButton = [[UIButton alloc] init];
[self.playOrStopButton addTarget:self action:@selector(playOrPauseButtonPressed:) forControlEvents:UIControlEventTouchUpInside];
[self.playOrStopButton setImage:[UIImage imageNamed:@"Source.bundle/source/audiobook_start_blue_icon"] forState:UIControlStateNormal];
[self.playOrStopButton setImage:[UIImage imageNamed:@"Source.bundle/source/audiobook_stop_blue_icon"] forState:UIControlStateSelected];
[self.playOrStopButton setImage:[UIImage imageNamed:@"audiobook_start_blue_icon"] forState:UIControlStateNormal];
[self.playOrStopButton setImage:[UIImage imageNamed:@"audiobook_stop_blue_icon"] forState:UIControlStateSelected];
self.playOrStopButton.selected = NO;
[self addSubview:self.playOrStopButton];


//上一首
self.preVButton = [[UIButton alloc] init];
[self.preVButton addTarget:self action:@selector(preVButtonPressed:) forControlEvents:UIControlEventTouchUpInside];
[self.preVButton setImage:[UIImage imageNamed:@"Source.bundle/source/audiobook_last_icon"] forState:UIControlStateNormal];
[self.preVButton setImage:[UIImage imageNamed:@"audiobook_last_icon"] forState:UIControlStateNormal];
[self addSubview:self.preVButton];


//下一首
self.nextButton = [[UIButton alloc]init];
[self.nextButton addTarget:self action:@selector(nextButtonPressed:) forControlEvents:UIControlEventTouchUpInside];
[self.nextButton setImage:[UIImage imageNamed:@"Source.bundle/source/audiobook_next_icon"] forState:UIControlStateNormal];
[self.nextButton setImage:[UIImage imageNamed:@"audiobook_next_icon"] forState:UIControlStateNormal];
[self addSubview:self.nextButton];


//光盘
self.lightDisk = [[UIImageView alloc]init];
self.lightDisk.contentMode = UIViewContentModeScaleAspectFit;
self.lightDisk.image = [UIImage createRoundedRectImage:[UIImage imageNamed:@"Source.bundle/source/audiobook_bg_icon"] size:CGSizeMake(180, 180) radius:90];
self.lightDisk.image = [UIImage createRoundedRectImage:[UIImage imageNamed:@"audiobook_bg_icon"] size:CGSizeMake(180, 180) radius:90];
[self addSubview:self.lightDisk];

//进度条
Expand Down Expand Up @@ -217,6 +217,12 @@ -(void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event{
#pragma mark - 播放或者暂停播放
- (void)playOrPauseButtonPressed:(UIButton *)sender{


//不能为空
if (self.musicArr.count == 0) {
return;
}

//获取当前播放器
[XYQAudioTool waitPlayingStateCallBack:^(AVAudioPlayer *audioPlayer) {
NSLog(@"%@",audioPlayer);
Expand All @@ -234,6 +240,12 @@ - (void)playOrPauseButtonPressed:(UIButton *)sender{

#pragma mark - 手动切换上一首
- (void)preVButtonPressed:(UIButton *)sender{

//不能为空
if (self.musicArr.count == 0) {
return;
}

if (self.musicArr.count==1 || currentIndex == 0) {
[XYQHUDView showHud:@"已经是第一首"];
return;
Expand All @@ -248,6 +260,12 @@ - (void)preVButtonPressed:(UIButton *)sender{

#pragma mark - 手动切换下一首
- (void)nextButtonPressed:(UIButton *)sender{

//不能为空
if (self.musicArr.count == 0) {
return;
}

if (self.musicArr.count==1 || currentIndex == self.musicArr.count-1) {
[XYQHUDView showHud:@"已经是最后一首"];
return;
Expand Down
3 changes: 1 addition & 2 deletions XYQPlayerExample/XYQPlayer/PlayMusicViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,9 @@ - (void)viewDidLoad {

//1、网络音乐
//[self testPlay_Local_URL_Music:@[@"http://120.25.226.186:32812/xxx/minion_02.mp3"]];
[self testPlay_Local_URL_Music:@[@"http://120.25.226.186:32812/resources/videos/minion_02.mp4"]];

//2、本地音乐
//[self testPlay_Bundle_Music:[self musicArray]];
[self testPlay_Bundle_Music:[self musicArray]];

}

Expand Down
17 changes: 17 additions & 0 deletions XYQPlayerExample/XYQPlayer/XYQPlayer/XYQAudioToolView.m
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,11 @@ -(void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event{
#pragma mark - 播放或者暂停播放
- (void)playOrPauseButtonPressed:(UIButton *)sender{

//不能为空
if (self.musicArr.count == 0) {
return;
}

//获取当前播放器
[XYQAudioTool waitPlayingStateCallBack:^(AVAudioPlayer *audioPlayer) {
NSLog(@"%@",audioPlayer);
Expand All @@ -234,6 +239,12 @@ - (void)playOrPauseButtonPressed:(UIButton *)sender{

#pragma mark - 手动切换上一首
- (void)preVButtonPressed:(UIButton *)sender{

//不能为空
if (self.musicArr.count == 0) {
return;
}

if (self.musicArr.count==1 || currentIndex == 0) {
[XYQHUDView showHud:@"已经是第一首"];
return;
Expand All @@ -248,6 +259,12 @@ - (void)preVButtonPressed:(UIButton *)sender{

#pragma mark - 手动切换下一首
- (void)nextButtonPressed:(UIButton *)sender{

//不能为空
if (self.musicArr.count == 0) {
return;
}

if (self.musicArr.count==1 || currentIndex == self.musicArr.count-1) {
[XYQHUDView showHud:@"已经是最后一首"];
return;
Expand Down

0 comments on commit 55e589b

Please sign in to comment.