Git Product home page Git Product logo

volumebar's People

Contributors

gizmosachin avatar mrweatherman208 avatar piemonte avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

volumebar's Issues

System volume hud appears on screen

Hey @gizmosachin,

First let me thank you for this awesome custom control!

I discovered a strange bug that happens from time to time... Sometimes the System volume hud appears on the screen along with your custom VolumeBar.

I think that this might be related to not handling the notification AVSystemController_SystemVolumeDidChangeNotification which is triggered once the system volume is changed.

I am waiting for your input on this one.

Cheers,
Sasho

system HUD appears with the VolumeBar

Hey @gizmosachin ! Amazing library.

If I get the opportunity to determine what's causing this bug, I'll look into but wanted to report it just incase. I've setup the volume bar like so, but the system HUD still appears when pushing the iPhone's physical volume buttons.

  // MARK: - UIApplicationDelegate
    
    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
        
        // setup volume bar
        do {
            try AVAudioSession.sharedInstance().setCategory(AVAudioSessionCategoryAmbient)
            let volumeBar = VolumeBar.sharedInstance
            volumeBar.animationStyle = .slide
            volumeBar.barHeight = 5
            volumeBar.segmentCount = 16
            volumeBar.interitemSpacing = 0
            volumeBar.statusBarHidden = true
            volumeBar.start()
        } catch {
            print("failed to configure audio session")
        }

 //...

Crash when stop volumebar

When I enter in my screen I call start(), when I leave I call stop(), when I enter again the volumebar dont show and when I call stop() the app crashes.

Cannot remove an observer <VolumeBar.VolumeBar 0x1562beef0> for the key path "outputVolume" from <AVAudioSession 0x1562053e0> because it is not registered as an observer.'

iOS 11 crash

This line

VolumeBar.sharedInstance.start()

crashes on iOS 11 only with

libc++abi.dylib: terminating with uncaught exception of type NSException

Stopping VolumeBar results in crash when volume is changed afterwards

If I stop the volume bar like this

VolumeBar.shared.stop()

at any point after having started it and then change the volume on the device, the app crashes with this exception:

EXC_BAD_ACCESS KERN_INVALID_ADDRESS 0x0000000001010120

and stack trace on the main-thread:

0  libobjc.A.dylib                0x1817c67e8 object_isClass + 16
1  Foundation                     0x182f3ffe0 KVO_IS_RETAINING_ALL_OBSERVERS_OF_THIS_OBJECT_IF_IT_CRASHES_AN_OBSERVER_WAS_OVERRELEASED_OR_SMASHED + 68
2  Foundation                     0x182f3e4bc NSKeyValueWillChangeWithPerThreadPendingNotifications + 300
3  AVFAudio                       0x187db8014 KVOProperty<float>::UpdateAndNotify(float const&) + 96
4  AVFAudio                       0x187db7fa4 -[AVAudioSession privateUpdateOutputVolume:] + 64
5  AVFAudio                       0x187db857c (anonymous namespace)::HandlePropertyListenerCallback(unsigned int, objc_selector*, NSObject*) + 72
6  libdispatch.dylib              0x181efea54 _dispatch_call_block_and_release + 24
7  libdispatch.dylib              0x181efea14 _dispatch_client_callout + 16
8  libdispatch.dylib              0x181f3fc80 _dispatch_main_queue_callback_4CF$VARIANT$armv81 + 968
9  CoreFoundation                 0x182527344 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 12
10 CoreFoundation                 0x182524f20 __CFRunLoopRun + 2012
11 CoreFoundation                 0x182444c58 CFRunLoopRunSpecific + 436
12 GraphicsServices               0x1842f0f84 GSEventRunModal + 100
13 UIKit                          0x18bb9d5c4 UIApplicationMain + 236
14 Tonsser.dev                    0x102d70cdc main (AppDelegate.swift:28)
15 libdyld.dylib                  0x181f6456c start + 4

Crash in `startObservingSystemVolumeChanges()`

We are currently experiencing a crash for a substantial amount on users.

This is the stack trace that we get:

Crashed: com.apple.main-thread
0  libswiftCore.dylib             0x105dd0d9c specialized _assertionFailure(_:_:file:line:flags:) + 142776
1  libswiftCore.dylib             0x105ca4de8 swift_errorInMain + 294
2  VolumeBar                      0x1055f0f08 _T09VolumeBar06SystemA7ManagerC014startObservingcA7ChangesyyF + 494
3  VolumeBar                      0x1055f336c _T09VolumeBarAAC5startyyF + 672
4  Tonsser                        0x102d05138 @objc FeedViewController.viewWillAppear(Bool) -> () (FeedViewController.swift:123)
5  UIKit                          0x18e1be4a8 -[UIViewController _setViewAppearState:isAnimating:] + 628
6  UIKit                          0x18e1be21c -[UIViewController __viewWillAppear:] + 156
7  UIKit                          0x18e24c5c0 -[UINavigationController _startTransition:fromViewController:toViewController:] + 812
8  UIKit                          0x18e24bd5c -[UINavigationController _startDeferredTransitionIfNeeded:] + 1168
9  UIKit                          0x18e24b7d8 -[UINavigationController __viewWillLayoutSubviews] + 164
10 UIKit                          0x18e24b6d8 -[UILayoutContainerView layoutSubviews] + 188
11 UIKit                          0x18e1a2e18 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 1276
12 QuartzCore                     0x188c2f948 -[CALayer layoutSublayers] + 184
13 QuartzCore                     0x188c33ad0 CA::Layer::layout_if_needed(CA::Transaction*) + 332
14 QuartzCore                     0x188ba031c CA::Context::commit_transaction(CA::Transaction*) + 336
15 QuartzCore                     0x188bc7b40 CA::Transaction::commit() + 540
16 UIKit                          0x18e41eb6c __34-[UIApplication _firstCommitBlock]_block_invoke_2 + 140
17 CoreFoundation                 0x184b93590 __CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK__ + 20
18 CoreFoundation                 0x184b92e60 __CFRunLoopDoBlocks + 288
19 CoreFoundation                 0x184b90b70 __CFRunLoopRun + 1068
20 CoreFoundation                 0x184ab0c58 CFRunLoopRunSpecific + 436
21 GraphicsServices               0x18695cf84 GSEventRunModal + 100
22 UIKit                          0x18e2095c4 UIApplicationMain + 236
23 Tonsser                        0x102b25800 main (AppDelegate.swift:29)
24 libdyld.dylib                  0x1845d056c start + 4

So in our FeedViewController's viewWillAppear function we literally just do this:

override func viewWillAppear(_ animated: Bool) {
    super.viewWillAppear(animated)
        
    VolumeBar.shared.start()
    VolumeBar.shared.style.backgroundColor = Style.color.darkBlueBackgroundColor
}

and viewWillDisappear:

override func viewWillDisappear(_ animated: Bool) {
    super.viewWillDisappear(animated)

    VolumeBar.shared.stop()
}

Now, what navigation causes that to crash I really don't know. I have not been able to replicate yet, unfortunately.
However, digging into the stack trace, it's caused by an assertion failure in startObservingSystemVolumeChanges() in SystemVolumeManager. Looking at the implementation of that, there is one thing at least that sticks out: the force try:

do {
    try! AVAudioSession.sharedInstance().setActive(true)
}

Should that maybe be changed to a do { try } catch { } for good measure?

Still an error

(Could not reopen the other issue)

This problem is still occurring, could it be a problem through GitHub or the podspec?

Here's the output of the command:

$pod install --repo-update
Updating local specs repositories
  $ /usr/bin/git -C /Users/_/.cocoapods/repos/master fetch origin
  --progress
  remote: Enumerating objects: 49887, done.        
  remote: Counting objects: 100% (49887/49887), done.        
  remote: Compressing objects: 100% (207/207), done.        
  remote: Total 189583 (delta 49715), reused 49763 (delta 49667), pack-reused 139696        
  Receiving objects: 100% (189583/189583), 20.65 MiB | 2.60 MiB/s, done.
  Resolving deltas: 100% (100633/100633), completed with 29941 local objects.
  From https://github.com/CocoaPods/Specs
     bbc394fb93b..378e845108d  master     -> origin/master
   * [new branch]              indexes    -> origin/indexes
  $ /usr/bin/git -C /Users/_/.cocoapods/repos/master rev-parse
  --abbrev-ref HEAD
  master
  $ /usr/bin/git -C /Users/_/.cocoapods/repos/master reset --hard
  origin/master
  Checking out files: 100% (11372/11372), done.
  HEAD is now at 378e845108d [Add] NEMobilytics 2.2.3-snapshot
warning: inexact rename detection was skipped due to too many files.
warning: you may want to set your diff.renameLimit variable to at least 10934 and retry the command.

CocoaPods 1.7.0.rc.1 is available.
To update use: `sudo gem install cocoapods --pre`
[!] This is a test version we'd love you to try.

For more information, see https://blog.cocoapods.org and the CHANGELOG for this version at https://github.com/CocoaPods/CocoaPods/releases/tag/1.7.0.rc.1

Analyzing dependencies
Downloading dependencies
Using IQKeyboardManagerSwift (6.2.1)
Using VolumeBar (3.0.4)
Generating Pods project
Integrating client project
Sending stats
Pod installation complete! There are 2 dependencies from the Podfile and 2 total pods installed.

[!] Automatically assigning platform `ios` with version `12.2` on target _ because no platform was specified. Please specify a platform for this target in your Podfile. See `https://guides.cocoapods.org/syntax/podfile.html#platform`.

VolumeBar doesn't work when device is rotated

In the sample app, when you rotate the device the volume bar stops working until you press one of the buttons (Use Instagram/Snapchat Style). It seems to have the same behaviour with a test app I made. I'm on the latest v.3.0.1. This didn't happen in the previous v.2.0.6 version.

AVAudioSession category

When start VolumeBar it stops playing background music from another app at string
try AVAudioSession.sharedInstance().setActive(true)

When I set ambient category before activate session music continues to play and VolumeBar works
try AVAudioSession.sharedInstance().setCategory(AVAudioSessionCategoryAmbient)
try AVAudioSession.sharedInstance().setActive(true)

Thank you

iPhone X support

Any plans/ideas regarding VolumeBar support for iPhone X's "notched" status bar?

(sorry, can't create a tagged questions on Stack Overflow as recommended on your README)

Error

This shows up when running pod 'VolumeBar', '~> 3.1'

[!] CocoaPods could not find compatible versions for pod "VolumeBar":
  In Podfile:
    VolumeBar (~> 3.1)

None of your spec sources contain a spec satisfying the dependency: `VolumeBar (~> 3.1)`.

You have either:
 * out-of-date source repos which you can update with `pod repo update` or with `pod install --repo-update`.
 * mistyped the name or version.
 * not added the source repo that hosts the Podspec to your Podfile.

Note: as of CocoaPods 1.0, `pod repo update` does not happen on `pod install` by default.

iPhone X Support

Instead of the full status bar can we do the top left part of iPhone X screen where time is?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.