Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When pressing play at the end of a sound clip, the sound file doesn't reset. - iOS #5

Closed
katamaritaco opened this issue Jun 20, 2013 · 6 comments

Comments

@katamaritaco
Copy link

Not a huge deal, but I figured I'd bring it up.

When you are done listening to a sound clip, the audio stops and the button returns to 'play'. When you click on play though, it starts playing after the sound file.

For example, the app says 2:55/2:55 when the sound file is done playing. If play is pressed again, time will increase at that interval - 2:55/2:56, 2:55/2:57, so on so forth.

 - Could be fixed on line 145 by replacing with this:
  if(player.rate == 0.0 && (CMTimeGetSeconds(player.currentTime)/CMTimeGetSeconds(player.currentItem.duration)) < 1.0) 

EDIT: Also found: Before you load a sound, there is nothing where the play/pause is. That would be fine, however you can still click on it and the green text says 'playing'.

  • Can be fixed by deleting lines 141-143.

These behaviors occurs in the iOS version, not the OSX version.

Thanks

@wsnnn
Copy link

wsnnn commented Jun 21, 2013

I add at end of startAudio

- (void) startAudio{
...
[[NSNotificationCenter defaultCenter] addObserver:self
                                                 selector:@selector(playerItemDidReachEnd:)
                                                     name:AVPlayerItemDidPlayToEndTimeNotification
                                                   object:[player currentItem]];
}

playerItemDidReachEnd

- (void)playerItemDidReachEnd:(NSNotification *)notification {
    AVPlayerItem *p = [notification object];
    [p seekToTime:kCMTimeZero]; //set to 00:00
    [player pause];
}

dealloc

- (void) dealloc
 [[NSNotificationCenter defaultCenter] removeObserver:self
                                                    name:AVPlayerItemDidPlayToEndTimeNotification
                                                  object:nil];

@gyetvan-andras
Copy link
Owner

Do you mind if I include this fix into my code ?

@wsnnn
Copy link

wsnnn commented Jun 21, 2013

If my, of course include :)

@katamaritaco
Copy link
Author

Feel free to use mine if you'd like as well. Thanks for making the program to begin with 👍

@gyetvan-andras
Copy link
Owner

Both of yours :-D

gyetvan-andras added a commit that referenced this issue Jun 24, 2013
@gyetvan-andras
Copy link
Owner

OK. I committed changes which hopefully fixes these issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants