[ 
https://issues.apache.org/jira/browse/CB-10657?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16198443#comment-16198443
 ] 

Gaven Henry commented on CB-10657:
----------------------------------

this is definitely a wkwebview issue.

I have an audioplayer app.  It has the background audio and background fetch 
permissions from Apple.  It is allowed to run in the background.  With 
wkwebview as soon as the app is no longer in the foreground all javascript 
execution stops, but native execution continues, so if I had a file playing it 
will play to the end and then nothing will happen.  When I bring the app back 
to the foreground then the javascript side of the app will be out of sync with 
the status of the native side.

This makes it impossible to play queued songs in the background or perform any 
other task like responding to play/pause/skip remote controls from the lock 
screen or control center.

The app and wkwebview SHOULD be suspended completely when the OS decides to 
suspend the app, not immediately upon the app going to the background.

Installing the backgroundmode plugin resolves this issue, although javascript 
execution in background is several times slower than when in the foreground.  
Using the external plugin is also not ideal as it is designed to "cheat" and 
keep an app active by playing a silent sound continuously which stops it being 
suspended when it should be.  I have forked and modified the background mode 
plugin to not do this and simply run in background until is is suspended by the 
OS but maintaining a fork of the background mode plugin is far from ideal.

> [wkWebView] wkWebView disables JS execution when app is backgrounded
> --------------------------------------------------------------------
>
>                 Key: CB-10657
>                 URL: https://issues.apache.org/jira/browse/CB-10657
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: cordova-plugin-wkwebview-engine
>         Environment: iOS
>            Reporter: John Robert  Cobbold
>            Assignee: Shazron Abdullah
>              Labels: triaged, wkwebview-known-issues
>
> When using wkWebView, Javascript execution is totally stopped after the app 
> is backgrounded by the user. This is a major problem for apps using 
> background modes as no javascript callback will be executed unless the app is 
> either in the foreground or was already terminated by the user / OS.
> example: cordova-plugin-geofence's javascript callbacks will not trigger 
> after the app was backgrounded but will however trigger if the app is in the 
> foregrounded or was killed by the user / OS.
> UIView does not have this problem.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to