Webpage opened inside an iphone app doesn't stop sound after closing - iphone

I have a mobile minisite that is reached from some iphone/android apps through banners
the site integrates a html <audio> tag that plays some sound after clicking a button
While in some apps everything works great, in a certain app - while the banner is clicked the minisite is opened in a some kind of browser inside the app (screenshot provided below)
the problem is that when the user closes that browser (by click the X button) while the sound is playing - the sound doesn't stop
is there anyway to know when the browser is closed in order to stop the sound manually?
I guess window.onbeforeunload won't work here because if the site was unloaded - the sound would stop anyway
screenshot of the kind of browser I'm talking about:
thank you very much

One possibility would be to setup an event listener for the blur event and just pause the audio then.

Related

AIR app still running when the iphone is blocked?

I just made a simple game with flash professional 6.0 and adobe AIR sdk 3.4 for iPhone.
The problem is this: when I lock the iphone pressing the power button, the screen switches off as usual, but the music of the game still sounds. If I exit the game pressing the home button it exits fine. Is only when locking the phone with the app opened.
Also, I opted-out of multitasking for my app, so if I close my app with the home button and I reload it, it loads the main menu.
Anyone knows how can I solve this?
Ok, after a lot of reading, it is a very very simple solution, just with this at the start of the app:
SoundMixer.audioPlaybackMode = AudioPlaybackMode.AMBIENT;
With this playback mode, the sound mutes when the app goes to the background.

Is it possible to pause my flash app on iphone by pressing home button?

I'm quite new to Flash. So here's my problem: I've created my app and it works great. But when I press home button on my iphone, my app minimizes and when I open it from multitasking apps, it simply restarts. Is it possible to freeze or pause the game instead of stop? Thanks!
By default the application should be eligible for the 'freeze-drying' iOS4+ functionality that resumes an app from the last place it left off. That may require a setting to be adjusted in your app descriptor (UIApplicationExitsOnSuspend should be false).
If you simply need to save data when the application is quitting, you can listen for Event.EXITING on the NativeApplication:
NativeApplication.nativeApplication.addEventListener(Event.EXITING, onExit);

Play splash movie every time app launch (with multi-task support)

the app I'm working on supports iOS multi-task feature by default, and I want to stick with this.
Upon app launch, a splash movie clip is played (code is in AppDelegate), after user hits the home button, and re-launches the app, I want to the same splash movie be played before showing the last view where use was.
I know by switching off the multi-task support, I can achieve this, but in the meanwhile, I'm losing the multi-task support feature, and I need to write code to save/resume user states. So, is there any workaround for this? thanks!
You could try the app delegate's applicationDidBecomeActive: method but quite frankly I'd consider this to be user hostile behaviour. Who wants to see a movie every time they switch between apps? The point of multitasking on the iPhone is to quickly change between apps and this violates that.

Issue exiting video after playing(ios phonegap app)

I am currently using iwebkit and phonegap together. Once everything is compiled and tested on an idevice, I can click a video link and get it to play. It play full screen but it uses the ios web video player (the one that doesn't have the "done" button" and the top and has a bar that spans the bottom of the screen. I can then press the full screen button to have it use the regular ios media player but when i click done from that, it doesn't take me back to the part of the app before the video, it just takes me to the full screen video in the web player. I hope someone can help me solve this and I hope I was able to describe my problem in a clear way. I've spent 2 hours searching and have come up with nothing.
I'm having the same problem. iOS 4.3.x introduced this problem as far as I can tell. There's a few comments about it on Apple's developer site but so far I haven't found any solution. Part of the problem seems to be Phonegap because I experience the exact same thing you describe when running the compiled app. However, if I simply browse to the same HTML pages it seems to work fine. Note - I changed from directly linking to video files to using the HTML5 tag. Using the tag works better than direct linking in Phonegap -- the videos still open in the player but when you click the Done button it returns to where it was. Keep in mind that if you do this the video will be on the inline in the page and paused but when you click the play button it opens in the player. The only problem I've found with this solution is that it won't rotate when you change from portrait to landscape when running in the phonegap app but it does rotate when browsing to the video in mobile safari. Not sure if any of that helps. I would be interested in what you've been able to work out since you posted.

html5 <audio>: how to use the built-in `next`, and `previous` controls on iOS 4.2 / Android 2.3

Both on Gingerbread 2.3 and iOS 4.2+ the HTML5 <audio> tag generates an interface with next, and previous buttons.
How do I hook into those controls?
It doesn't appear to be one of the HTML5 Media Events according to
W3Schools
HTML5 Spec.
Safari Developer Library: Controlling Media With JavaScript
What JavaScript events do they emit or do they send HTTP ICECast messages?
(No HTTP headers are sent on the button click)
For an example with screenshots, see https://coolaj86.com/demos/sandbox/html5-audio-tag.html
On Android:
if you have gingerbread or better you'll see the controls in the webapp by default.
On iOS (iPhone, iPod, iPad):
Begin playing the music sample on your iPod/iPad/iPhone
Then click the button to "background" the app.
Double click and swipe from left to right in the lower menu to access the player controls.
Note: play/pause control does work more or less as expected (setting the appropriate Content-Range HTTP header helps)
As for iOS
From the webkit-help mailing list:
These Next/Previous buttons are not
part of the standard HTML5 media
player controls.
On iOS at least, they are simply there
because the same controls are used for
audio playback in web pages as other
audio playback on the device. For web
pages, they just go to the start and
end for the track. You can't modify
this behavior from JS.
AFAIK, mobile phones (android/iphone) open the default player when you attempt to play any media file using the new HTML 5 specification.
There's no way to control those buttons since the actual playback is done via the media player application.
I don't know if intended, but so far, http://www.schillmania.com/projects/soundmanager2/demo/page-player/ works with the NEXT button while you are CURRENTLY PLAYING any audio. If the audio finishes, the NEXT button stops working. And the PREVIOUS button doesn't go to previous song, but restarts current song.
I don't know if Scott (the creator) has coded this, or not. I've tried debugging that page JS files, and didn't find any next/prev logic done.
Clearly, it should be possible. It's working kind of buggy and there is no documentation, but let's build it!
What do the buttons do?
When playing:
Next: go to last ms of the audio, so it triggers onfinish event.
Prev: go to first ms of the audio, means nothing, plays again from start.
When not playing: (depends on if audio stopped or never played)
Next: Nothing
Prev: Nothing
:/ So far, that's the info I have. I'm trying to monitorEvents without success, it should be triggering some event.