https://github.com/redmadrobot/volumebuttons
VolumeButtons provides interface for handle clicks on hardware volume buttons on iOS devices
https://github.com/redmadrobot/volumebuttons
ios swift
Last synced: about 1 year ago
JSON representation
VolumeButtons provides interface for handle clicks on hardware volume buttons on iOS devices
- Host: GitHub
- URL: https://github.com/redmadrobot/volumebuttons
- Owner: RedMadRobot
- License: mit
- Created: 2020-05-27T13:53:59.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2020-05-27T14:03:39.000Z (about 6 years ago)
- Last Synced: 2024-10-31T15:43:44.453Z (over 1 year ago)
- Topics: ios, swift
- Language: Swift
- Size: 12.7 KB
- Stars: 11
- Watchers: 9
- Forks: 5
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# VolumeButtons
[](https://cocoapods.org/pods/VolumeButtons)
[](https://cocoapods.org/pods/VolumeButtons)
[](https://cocoapods.org/pods/VolumeButtons)
VolumeButtons is simple way to handling clicks on hardware volume buttons on iPhone or iPad.
## Usage
```swift
self.volumeButtonHandler = VolumeButtonHandler(containerView: view)
volumeButtonHandler.buttonClosure = { button in
// ...
}
volumeButtonHandler.start()
```
## How it works
VolumeButtonHandler class keeps track of volume changes in an audio session. When you increase or decrease the volume level, the value will be reset to the initial one, thus pressing the buttons is determined without changing the volume of the media player. You need to pass in `init` some view of your View Controller for placing hidden instance `MPVolumeView` used for controlling volume level.
## Requirements
iOS 11 and newer.
## Installation
VolumeButtons is available through [CocoaPods](https://cocoapods.org). To install
it, simply add the following line to your Podfile:
```ruby
pod 'VolumeButtons'
```
## References
This project based on Objective-C code [JPSVolumeButtonHandler](https://github.com/jpsim/JPSVolumeButtonHandler)