jPlayer play event is not firing when audio start playing automatically - events

I got a problem with jPlayer.
When the page loaded, the player plays automatically but it doesn't trigger "play" event.
Only when I click on pause button and click on play button again, the event is triggered.
Is that a bug of jPlayer?

hard to say since you don't mention which browser you are experiencing this in but my experience is that it is safer to rely on the 'playing' event rather than the 'play' event. Ideally the 'play' event is to be fired as soon as you call jPlayer('play') and 'playing' then is fired once the actual playback starts (i.e. after initial buffering etc). What I've seen this works fine in Safari but does not work in Chrome, in Chrome the two events are both fired when content starts to play.

Related

Can't find out how button click event got wired

I have a button which posts back through Ajax. I tried to find out what code executes when the button is clicked. I used Visual Event (screen capture below) to see how the event was bound but the info didn't help me enough. Then I set an event listener breakpoint on mouse clicks in Chrome. The breakpoint hit code in the main jQuery file which was also not helpful. So I blackboxed the file. Now when I click the button, no breakpoints are hit.
What's a systematic way to find the user code which gets executed? I also searched for 'live' and 'click' as text across the whole app. It was time consuming and didn't find where the click event for the button got attached. It's painful to do such a search. I would like to know the productive technique using Chrome's debugger or another tool. (Another browser's tips are OK)
Have you tried the Chrome profiler?
Launch the Chrome DevTools (F12)
Go to the Profiles panel
Ensure that Collect JavaScript CPU Profile is selected
Click Start
Perform your operation
Click Stop.
Then you should see a list of functions that were called.
There are several possible ways to do so. One is described by the user thesentiment. Another way is to use the DevTools' debugger.
Open the Chrome DevTools (F12)
Switch to the Sources panel
Click the Pause button () or hit F8
Perform your operation
=> The script execution will stop at the first line of the event handler function within jQuery. You can then step through to your actual event handling function.
Note that in Firebug this works much easier, because its Events side panel already displays the wrapped listeners, i.e. the functions that are called by a jQuery event listener:

What API events are triggered when closing a FirefoxOS app

I need to check for unsaved data when a packaged app is closed (using the close button at the bottom of the screen and then pressing the X that is top left when the app appears reduced size).
I've managed to add an event listener for the low battery condition and this works as expected. But looking at https://developer.mozilla.org/en-US/docs/Web/Events I can't decide which event is correct for closing an app.
The obvious name -- close -- seems to be something to do with web sockets.
mozbrowserclose seems to be triggered when closing by the app's software.
XUL close "the user presses the close button" seems like the appropriate one, but when trying
window.addEventListener("close", function( event )
{
window.alert("closing");
}, false);
the app closes without triggering the alert.
DOMWindowClose seems to be specific for close by window.close in software
mozbrowserclose seems to be specific to iframes
So ... does anybody know the correct event to trap ?
Phone is ZTE Open C with FFOS 1.3.
It looks like this is a bug -- https://bugzilla.mozilla.org/show_bug.cgi?id=996754 "User-terminated apps do not receive 'beforeunload' event"

Issues in "WP7" Sudden Tombstoning

I am facing some issues in WP7 tombstoning. My issue is application hangs when i try for a sudden tombstone and come back. ie, After loading the page i press device menu button and with in seconds i pressed back button( Pressed Back button before the actual page disappeared) In that time the page loads but the application hangs / its back key press is not working. and if we try for a slow thombstone it is working perfectly. And the pretty interesting thing is that, while tombstoning the loaded and unloaded events of APP working perfectly. Please any one help me to solve this issue.
It sounds like your App has been deactivated, but not tombstoned. This results in neither the App or Page contrusctor being called, causing your app to act in unexpected ways. I highly recommend reading the Windows Phone Silverlight Application Life Cycle document. The relevant extract for said article:
This case can occur if the user
presses the Start and Back buttons on
the phone in quick succession. In this
case, the application received a
Deactivate event and the system was
starting to save the state of the
application to perform an application
tombstone. Before this operation is
completed, the app Activated event is
received. The system knows that the
application was not removed from
memory, so the flow of execution is
different. Specifically:
• The app constructor is not called.
• The page constructor is not called.
The only way for the application to determine
if this condition has occurred is to
set a flag to indicate if the page
constructor has been called. If you
notice in the above section, this flag
was set in the page constructor, and
cleared in the OnNavigateFrom event.
In this case, we will receive the
OnNavigatedTo event, but we will see
that the page constructor was not
called. This tells us that our
application was not tombstoned.

WP7 App Events in Emulator

I'm seeing some unexpected things happening in the emulator.
When debugging and starting the app for the first time, the Application_Launching fires just fine. When clicking the start button, the Application_Deactivated event fires fine. When click the back button, the Application_Activated event fires fine.
If I click the start button then go to my apps and launch my app, no events are fired. I would assume either the Application_Launching or Application_Activated would fire when the app is launched every time, just a different event depending on how the app got there.
Is this an issue with the emulator or do I have the wrong assumptions here?
Well, the events get fired right. What you missed is that debugger get dettached when you are launching "new instance" of your app. ;)

OnNavigatedTo mysteriously not firing on Windows Phone 7

I am trying to handle state restoration on a sub-page of my app. I've hooked the OnNavigatedFrom and OnNavigatedTo overrides in order to do this. However - although they fire quite happily while I am navigating around the app itself, the OnNavigatedTo does not fire when I switch out of the app with that page active, then try to reactivate it. This is made all the more mysterious because another near-identical app I have seems to work fine.
Is there some sort of setting somewhere that might prevent OnNavigatedTo from firing when my app comes back from tombstoning, but allows it to fire when the user navigates around screens in my app?
Chris
If you're going back almost immediately, it may be possible that your app is still running the same as it was, but the OnNavigatedTo should still be fired even in that case (more recent info: link text).
Are you doing anything fancy in your constructors, such as hooking up event handlers to try and handle the state changes from the frame?
If so, drop that and see where it gets you, ctors should be mostly empty.

Resources