I am developing a VOIP app based on the VoipChatterbox sample app project and I need to manipulate the headset button click.
I see that, during an active call, when I press the button on the earphone, I get a CallEndRequested event and I need to call NotifyCallEnded within 5 seconds.
But I need a different behavior for my app. I need to simply turn the microphone off / on (toggle behavior) when the user presses the headset button. (This requirement might seem odd, but that's what make sense in the context of my application). How can I achieve this behavior?
To summarize :
Is there any other event to understand that user has pressed the earphone button?
Is there a way to override the behavior that NotifyCallEnded should be called in five seconds when CallEndRequested event is fired?
Related
I know that I can trigger "Pause script execution" action in Google Chrome DevTools by having DevTools open with Sources tab active and press F8.
However, this seems to move focus out from the content area triggering additional events and I'm trying to debug some code that listens focus and blur events in addition to other events I'm trying to debug.
What I would really need is ability to trigger the "Pause script execution" feature without pressing F8. The closest I can do is executing setTimeout(function(){ debugger; }, 2000); in the JS console but that will stop all JS processing instantly after 2 second delay. The feature I'd like to use from DevTools is ability to delay stopping until some code actually runs so that the event queue already has the next events when scripting is stopped. (I'm basically trying to figure out what events are already in the queue in some specific situations and any extra focus/blur events will mess that work.)
Is there a way to trigger "Pause script execution" without pressing F8 or clicking the GUI button because both mess with the focus events?
It seems that to fully handle all combinations of keyboard focus and focus/blur events you need to do some extra steps. I found that I can get correct events like this:
Open DevTools and the Sources tab.
Press Ctrl+Shift+P to open "Run command" action
Search for focus and run command Emulate a focused page (note that this is not a permanent toggle and you need to do this again in the future to debug similar stuff).
Now prepare the situation you would want to test (e.g. you're about to press some keyboard button next).
Click the pause button within the DevTools Sources tab with the mouse.
Press Ctrl+Shift+P again and search for focus and run command Focus debuggee.
The keyboard focus is now in the correct place and any JS code that would be executed will trigger the debugger with the correct event for the next keyboard action.
If you need to debug mouse events, follow the same list but instead of clicking the pause button with mouse, press F8 twice (single press doesn't work for me?), then Ctrl+Shift+P again and search for "focus" and run command Focus debuggee using the keyboard only. Do not move the mouse even a single pixel after pressing F8 until you have exeuted the Focus debuggee command, or the page will see mousemove and other mouse movement related events.
I'm coding a game for Android on Flash using AS3. My problem is that when I shoot a rocket or bullet at an enemy the user can repeatedly press the virtual button (on screen), this defeats the object of the game. Is there any way to limit how often a user can press this button so it can be pressed every half second or so? Many Thanks. (will provide code upon request if needed)
In the event handler that handles the button press, remove the listener.
This alone would disable the button.
Additionally, start a Timer.
Upon completion of the timer, re-add the listener for the button press, which allows pressing the button again, but only after the timer completed.
i have a simple system to register who is present at a party.
I created an easy numkeypad with buttons, and that works. But when I try it in Safari (or any other mobile browser), it takes about a second before I can press the next button. It has to be quick, so this is too long.
Is there any way to shorten this "waiting" time between button presses.
click events are delayed in mobile browsers due to the fact the browser has to ensure the user isn't double-tapping or tap-holding an element.
I have written a jQuery plugin that can handle touch and mouse events in a convenient way, and allows you to bind one event to trigger without a delay (tap). You can check it out here:
https://github.com/benmajor/jQuery-Mobile-Events
I am trying to build a custom modal dialog in flash. The way I chose to go about it is create a movie clip class with the UI for the dialog with a function to add buttons to it. I then size the ui after all the buttons are added and display it on the screen.
It works up to this point. Now I want whatever called this dialog to wait until a button is picked before the user can do anything else. Something along the lines of:
var dialog:MyDialog = new MyDialog();
dialog.addButton(new MyButton("Foo"));
dialog.addButton(new MyButton("Bar"));
var result:String = dialog.show(); // we will wait here
In the dialog.show I wish to show the movie clip and then wait for the user to click and of the buttons on the dialog before returning. The MouseEvent.CLICK event is asynchronous though so I don't know how to wait for it.
An alternative is creating a whole custom complete event for the dialog that is added to the screen that is calling the dialog which I can continue the logic in and have a boolean that disables other input, but that is a pretty big hassle and I've never done anything like it.
What your describing is a misconception of what synchronous and asynchronous is.
When the dialog comes up, you still want the user to be able to hit the dialog button. If the procedure was synchronous then the entire program would freeze as the routines for the mouse clicking actions would never arrive. Remember, flash is single threaded.
The thread that has the popup is sharing the same thread as the underlying app.
The easiest thing is just to have an event on the buttons that dispatch some close event that you can listen for in your application. No custom event classes are needed.
dispatchEvent(new Event("close"))
as an example.
If your worried about the user interacting with parts outside of the application, then you can simply draw a rectangle behind the popup with mouseEnabled true, or check out using Flex's model dialog classes.
I want to make a chrome extension which performs a certain action when the user enters the a "back" navigation action.
ie: they click the back button in the browser, or they swipe backwards with 3 fingers on a macbook pro, or if they enter the shortcut alt + left arrow.
How can I detect these actions? Should I create some type of listener or handler which accounts for each one individually?
You can use the webNavigation API.
Start monitoring the details for each transition type that you mentioned. And then try to do something with this information.
chrome.experimental.webNavigation.onCommitted(function(details){
console.log(details);
});