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

feat(iOS): add handler for Apple Earpods play/pause command #4116

Conversation

sharnik
Copy link
Contributor

@sharnik sharnik commented Aug 26, 2024

Summary

This adds a new InfoCenterManager command that handles custom behaviour of Apple's wired earphones.

Motivation

Our customers reported that using Apple Earpods they can only adjust the volume, but not play/pause the video.

Apple Earpods also allow to skip to next/previous track, but as this concept (playlists) is more complicated I've decided not to add any behaviour for that commands.

Changes

  • Added a togglePlayPauseCommand sent by Apple Earpods that resumes or pauses the video based on its state.

Test plan

Play a video with Apple Earpods plugged in and use the play/pause button to stop and resume playback.

If you don't have access to this hardware, I can provide a video of the behaviour before and after the change.

@sharnik sharnik changed the title Add handler for Apple Earpods play/pause command feat(iOS): add handler for Apple Earpods play/pause command Aug 26, 2024
guard let self, let player = self.currentPlayer else {
return .commandFailed
}

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

    //Additional check: Is the player ready to play?
    guard player.currentItem?.status == .readyToPlay else {
        return .commandFailed
    }

@KrzysztofMoch
WDYT?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is same code than play and pause handling. Looks good to me

@freeboub freeboub merged commit 9c38d9f into TheWidlarzGroup:master Aug 29, 2024
6 checks passed
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

Successfully merging this pull request may close these issues.

3 participants