JPSVolumeButtonHandler icon indicating copy to clipboard operation
JPSVolumeButtonHandler copied to clipboard

Event issue at initialization

Open ghost opened this issue 7 years ago • 12 comments

Thanks for this awesome library. I'm facing an issue, at initialization, PSVolumeButtonHandler adjusts the volume to avoid a maximum or minimum state (i suppose that in this state, it will couldn't detect any event on volume buttons). But when adjusting, it's triggering by itself and call the upBlock or downBlock.

how to avoid that ?

ghost avatar Mar 27 '17 13:03 ghost

That shouldn't happen. Maybe someone more actively involved in this library than I would be able to make a repro case?

jpsim avatar Mar 27 '17 15:03 jpsim

We are seeing this in our app currently using 1.0.2, I'm going to retry with latest master

apple-ihack-geek avatar Apr 12 '17 15:04 apple-ihack-geek

I'm seeing this issue also.

jasongaare avatar Apr 27 '17 20:04 jasongaare

@titiSbr @apple-ihack-geek @jasongaare I assume you're all seeing this with 1.0.4 too? There's an unfortunate lack of information or repro cases in this thread 😞

jpsim avatar Apr 27 '17 21:04 jpsim

After further review, My issue was slightly different. Mine was not at initialization, mine was an event issue by another event (an infinitient loop of volume presses). Sadly, I had to pull the button handler our entirely due to another issue I'm not sure how to resolve, https://github.com/jpsim/JPSVolumeButtonHandler/issues/46

apple-ihack-geek avatar Apr 28 '17 12:04 apple-ihack-geek

For other people still experiencing this, you can try the new exactJumpsOnly feature https://github.com/jpsim/JPSVolumeButtonHandler/pull/45

apple-ihack-geek avatar Apr 28 '17 12:04 apple-ihack-geek

The exact jumps feature worked for me, but caused a different issue where the min/max logic no longer works.

I think the problem is that -[JPSVolumeButtonHandler startHandler:] is calling setupSession too early (in addition to calling it twice). The first call should not be there, and it causes the delayed second call to do nothing, because isStarted is set to true the first time setupSession is called). After I removed that line, I haven't seen the issue.

jpeyer avatar May 02 '17 18:05 jpeyer

I'm seeing this too. With JPSVBH included, about 75% of the time when I start my app I see the volume level displayed and then the up handler fires. The volume level never displays if I take out JPSVBH

xaphod avatar Jun 12 '17 12:06 xaphod

This is happening for me as well. exactJumpsOnly avoids this issue, but also stops the handler from firing at all for min/max volumes

genericwoods avatar Jun 19 '17 22:06 genericwoods

@genericwoods Are you sure you're using the latest version? The not firing at max/min was an bug (of my own doing) but was fixed with https://github.com/jpsim/JPSVolumeButtonHandler/pull/47 (or so I think).

apple-ihack-geek avatar Jun 20 '17 12:06 apple-ihack-geek

@apple-ihack-geek we’re using 1.0.4 via Cocoapods – is #47 included in that release?

Edit: Nevermind, noticed on the issue that it was never tagged for release, moved the conversation over there

genericwoods avatar Jun 20 '17 13:06 genericwoods

@genericwoods no, it hasn't had a release tag yet. For now, you should be able to manually set it to commit id 08850cf30a3d823bc29f917685653e0029616bdf. Give that a try.

apple-ihack-geek avatar Jun 20 '17 13:06 apple-ihack-geek