14 Replies Latest reply: May 10, 2012 4:25 PM by daxx
daxx Level 1 (0 points)

Hi,

 

So i got my html widget entering fullscreen and starting playing sound, but when exiting fullscreen the sound doesn't stop,

there the little arrow in topbar of iPad...

 

How could i stop the sound when exiting the fullscreen ??

 

Thanks

  • MichiHenning Level 4 (1,350 points)

    I suspect that's impossible. The reason is that a widget actually keeps running in the background even after it is closed. There is no event posted to a widget when that happens, so you cannot intercept closing the widget in Javascript to stop the sound.

     

    Michi.

  • K T Level 7 (23,705 points)

    Does it stop when you advance to the next page?

  • daxx Level 1 (0 points)

    The sound still play when i change page,

    You're right, the widget keep running in background after closing it,

    May be there a work- around with javascript, if html window still in focus or screen size, or ??

     

    Or may be there a stop() all sound function built-in iBook ? Or in iOS itself ?

     

    Thanks for advice

  • MichiHenning Level 4 (1,350 points)

    I had similar problems with my widget when I was interested in finding out when the widget is closed, in order to save the state of the widget.

     

    It turns out that the relevant events simply are not posted when executing the widget inside iBooks. (They are when you run the same widget in Dashboard.)

     

    I'm afraid there is absolutely nothing that can be done about this, until Apple change the execution environment for widgets in iBooks. I'd suggest that you submit feedback about the problem.

     

    Cheers,

     

    Michi.

  • daxx Level 1 (0 points)

    i think solution is with the file i find :

     

    so i finaly get this famous file mentioned in : http://support.apple.com/kb/HT5068 ,

    Apple provide a tutor without providing the file to achieve it.., did you said amateurish ?

     

    So, i find it decompiling the iBooks.app,

    go on your iTunes/Mobile Applications/ Folder,

    duplicate the iBooks.ipa,and rename it with .zip extension and decompress the archive,

    in iBooks Folder, open Payload folder and right-click on iBooks app to show package content,

    you'll find an AppleWidgetController.js file,

    despite the name, this is the  AppleWidget.js mentioned in tutor because inside there the function i need (and others really interesting)

     

    --

     

      * notifyContentExited

       *   Notifies native widget controller that js widget is closing down.

       *   Called when the user ends the slideshow

       * ------------------------------------------------------------------ */

      notifyContentExited : function() {

        window.location = 'apb:///do?c=exited';

      },

     

     

    Michi.

    then itshould be as is :

    in main.html load :

    <script type="text/javascript" src="AppleClasses/AppleWidget.js"> </script>

    add in info.plist:


    <key>IBNotifiesOnExit</key>

    <true/>

    and javascript call :

    widget.notifyContentExited()

     

    can a real developper give us a working example with that

     

    Thanks

  • miguel_sanchez Level 1 (20 points)

    You have to pause the audio into the "widget.pauseAudioVisual()" function. This function triggers when the user exits the widget.

     

    Explanation (in spanish) into my blog.

    Working example.

  • MichiHenning Level 4 (1,350 points)

    Thank you very much for that, this is really useful!

     

    It would be really nice if these things were documented somewhere by Apple…

     

    Cheers,

     

    Michi.

  • daxx Level 1 (0 points)

    Thanks, muchas gracias Miguel :-)

     

    May be you can help too with my other topic to fix the flash initialisation effect :

    https://discussions.apple.com/message/18324422#18324422

     

    we need more guys like you in this forum

     

    Hasta luego

  • miguel_sanchez Level 1 (20 points)

    You're welcome.

     

    I have the same problem in my ken burns widget.

     

    But i have no the solution yet :-(

  • daxx Level 1 (0 points)

    so how to open a ticket to request Apple for this ?

     

    btw, nice ken burn widget.

  • MichiHenning Level 4 (1,350 points)

    Join the Apple Developer Program (free) and submit a bug report. I've been getting timely and constructive responses to the bugs I have submitted.

     

    Michi.

  • daxx Level 1 (0 points)

    do you got a direct link ?

    there so many options, i'm lost...

  • K T Level 7 (23,705 points)

    daxx wrote:

     

    do you got a direct link ?

    there so many options, i'm lost...

    Register as an Apple Developer (free)

  • daxx Level 1 (0 points)

    i was already registered....

    but on the page there top menu and left menu,

    and footer menu and so on....

     

    i finally found the tiny link to bug report in footer menu,

    https://bugreport.apple.com

     

    ok, send,

    we will see ... hope sooner than later