Android WebView pause sound on Activity onPause - android-webview

Background music from WebView keep playing when a user hits the home button. I am testing that on an Android 8.0 phone.
I have tried multiple solution from other thread (also tried using reflection as suggested on some threads). Unfortunately, nothing has worked for me. I am calling webview.onPause().
Is there any up to date solutions that are not listed on other threads that you can help me with?

Related

Keep video playing when app goes to the background and show player controller in the notification

Want this feature in flutter (android/IOS)
I want to keep the video playing when an app goes to the background and shows a player controller in the notification.
Is this possible?
You can try this library https://pub.dev/packages/just_audio with the latest version 0.9.21. It's quite easy to configure though some features are still experimental e.g Simultaneous downloading+caching, Background play which are here Experimental features. Overall it works for me.

iOS7 - App causes device (not app) to crash

Our company has an app which is basically an eBook reader.
We use the RMSDK to perform book downloads & read.
Now, something very strange is happening in iOS7 devices (not in the simulator):
I download a book using the fulfillment method in the RMSDK
I wait for the book to finish downloading. The book is saved in the NSCachesDirectory (for App Store guidelines reasons) - so far, everything works fine
I hit the home button, the app moves to the background
I hit the app button to bring the app back, that's when the problem happens:
The app gets completely stuck. Hitting the home button does nothing, hitting the power button shuts down the screen, but then hitting the power button again does nothing.
The device itself has effectively crashed.
After a few minutes, the Apple logo appears on the device and the device comes back to life after a reboot.
I have no idea what in my code could be causing the device to act this way. Shouldn't the iOS7 sandbox prevent me from being able to crash the whole device?
Any ideas on why this could be happening and what I can do to prevent it would be greatly appreciated.
EDIT:
I placed a breakpoint on the -(void)applicationDidBecomeAcvive: method in the AppDelegate, and it's not being called when clicking on the app icon in the last phase before the crash.
EDIT:
The RMSDK is using libcurl to download the books. Could this be a cause for this behavior?
EDIT:
The problem is happening if I click on ANY app after I click on the home button, not just on the same app. So for example, I click on the home button, then I try to open Fruit Ninja, and the device crashes.
We managed to solve this issue by disabling functions in RMSDK, which call mkfifo(). I'm not sure how much I can say here due to NDA but they're all located in one file and can be cleanly converted to no-ops with a nice preprocessor #if defined()
Its an OS level bug. iOS 7 is still unstable in areas, for example my Apps report crashes in places that are part of iOS 7 itself and couldn't be caused by my app.

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

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.

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.