{ "id": "124231", "key": "TIMOB-16105", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false }, "project": { "id": "10153", "key": "TIMOB", "name": "Titanium SDK/CLI", "projectCategory": { "id": "10100", "description": "Titanium and related SDKs used in application development", "name": "Client" } }, "fixVersions": [], "resolution": null, "resolutiondate": null, "created": "2013-12-27T15:57:42.000+0000", "priority": null, "labels": [ "3.2.0", "android", "api19", "webview" ], "versions": [ { "id": "14982", "description": "Release 3.2.0", "name": "Release 3.2.0", "archived": false, "released": true, "releaseDate": "2013-12-19" } ], "issuelinks": [ { "id": "34044", "type": { "id": "10003", "name": "Relates", "inward": "relates to", "outward": "relates to" }, "outwardIssue": { "id": "123763", "key": "TIMOB-16044", "fields": { "summary": "Android: Plugins keep playing after closing WebView", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "priority": { "name": "Critical", "id": "1" }, "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false } } } } ], "assignee": null, "updated": "2018-02-28T20:04:11.000+0000", "status": { "description": "The issue is open and ready for the assignee to start work on it.", "name": "Open", "id": "1", "statusCategory": { "id": 2, "key": "new", "colorName": "blue-gray", "name": "To Do" } }, "components": [ { "id": "10202", "name": "Android", "description": "Android Platform" } ], "attachment": [], "flagged": false, "summary": "Android: Second time a webview is loaded with a HTML5 video the video does not play", "creator": { "name": "wgiezeman", "key": "wgiezeman", "displayName": "Wienke", "active": true, "timeZone": "Europe/Berlin" }, "subtasks": [], "reporter": { "name": "wgiezeman", "key": "wgiezeman", "displayName": "Wienke", "active": true, "timeZone": "Europe/Berlin" }, "environment": "Android, Target API 19, webview", "comment": { "comments": [ { "id": "286125", "author": { "name": "wgiezeman", "key": "wgiezeman", "displayName": "Wienke", "active": true, "timeZone": "Europe/Berlin" }, "body": "Added this youtube video showing the actual result:\n\nhttp://www.youtube.com/watch?v=0MpSpfJNyOk ", "updateAuthor": { "name": "wgiezeman", "key": "wgiezeman", "displayName": "Wienke", "active": true, "timeZone": "Europe/Berlin" }, "created": "2013-12-28T12:12:50.000+0000", "updated": "2013-12-28T12:12:50.000+0000" }, { "id": "286140", "author": { "name": "wgiezeman", "key": "wgiezeman", "displayName": "Wienke", "active": true, "timeZone": "Europe/Berlin" }, "body": "I did some more research and it seams that the WebView is not destroyed completely upon leaving the activity. I am currently playing around with adding things like this to the onDestroy function in the WebViewProxy:\n\nnativeWebView.stopLoading();\nnativeWebView.removeAllViews();\nnativeWebView.clearHistory();\nnativeWebView.clearCache(true);\nnativeWebView.loadUrl(\"about:blank\");\nnativeWebView.pauseTimers(); //new code\n\nnativeWebView.destroy();\nnativeWebView = null;\n\nWhen trying this no webview is shown at all on opening it for a second time.", "updateAuthor": { "name": "wgiezeman", "key": "wgiezeman", "displayName": "Wienke", "active": true, "timeZone": "Europe/Berlin" }, "created": "2013-12-28T21:29:25.000+0000", "updated": "2013-12-28T21:29:25.000+0000" }, { "id": "286141", "author": { "name": "wgiezeman", "key": "wgiezeman", "displayName": "Wienke", "active": true, "timeZone": "Europe/Berlin" }, "body": "Ok, I got one step further. When adding some javascript which pauses the video to the onPause method it works:\r\n\r\n\t@Override\r\n\tpublic void onPause(Activity activity) {\r\n\t\tevalJS(\"document.getElementsByTagName('video')[0].pause();\"); // <--- this one\r\n\t\tpause();\r\n\t}\r\n\r\nI would say this is a very ugly hack and we should investigate further on why pausing the video makes the solution. Is there a way in Android where a global playback state is kept? Can this be altered?\r\n\r\nUpdate: Just tested this on a bigger project with more than just the webview in the activity. And it does not work. Somehow it does not wait for the javascript to finish completely.\r\n\r\n", "updateAuthor": { "name": "wgiezeman", "key": "wgiezeman", "displayName": "Wienke", "active": true, "timeZone": "Europe/Berlin" }, "created": "2013-12-28T22:31:56.000+0000", "updated": "2013-12-29T09:53:28.000+0000" }, { "id": "286153", "author": { "name": "fokkezb", "key": "fokke", "displayName": "Fokke Zandbergen", "active": true, "timeZone": "Europe/Amsterdam" }, "body": "[~wgiezeman], maybe your hack works better if you not rely on the external onPause event, but rather use {{evalJS}} upon loading the view to insert an event listener in the web view that pauses the video when it looses focus?\n\nBut of course a more solid non-hack to resolve this ticket is still needed.", "updateAuthor": { "name": "fokkezb", "key": "fokke", "displayName": "Fokke Zandbergen", "active": true, "timeZone": "Europe/Amsterdam" }, "created": "2013-12-29T12:30:35.000+0000", "updated": "2013-12-29T12:30:35.000+0000" }, { "id": "286211", "author": { "name": "ragrawal", "key": "ragrawal", "displayName": "Ritu Agrawal", "active": true, "timeZone": "America/Los_Angeles" }, "body": "[~wgiezeman] Thank you very much for providing the detailed information and a video clip to reproduce the problem. We can now reproduce this problem in-house albeit inconsistently. \n\nMoving this ticket to engineering for further evaluation and prioritization.", "updateAuthor": { "name": "ragrawal", "key": "ragrawal", "displayName": "Ritu Agrawal", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-12-30T04:38:26.000+0000", "updated": "2013-12-30T04:38:26.000+0000" }, { "id": "286230", "author": { "name": "wgiezeman", "key": "wgiezeman", "displayName": "Wienke", "active": true, "timeZone": "Europe/Berlin" }, "body": "[~ragrawal] Thanks for addressing this issue so quickly. I will continue with researching the issue as well.\r\n\r\nIf I can help in any way please let me know.", "updateAuthor": { "name": "wgiezeman", "key": "wgiezeman", "displayName": "Wienke", "active": true, "timeZone": "Europe/Berlin" }, "created": "2013-12-30T08:29:41.000+0000", "updated": "2013-12-30T08:29:41.000+0000" }, { "id": "286253", "author": { "name": "wgiezeman", "key": "wgiezeman", "displayName": "Wienke", "active": true, "timeZone": "Europe/Berlin" }, "body": "I spend 50 points on a bounty on this question and the answer seems quite interesting:\r\n\r\nhttp://stackoverflow.com/questions/20379478/android-samsung-s4-html5-video-pauses\r\n\r\nWhat do you think?", "updateAuthor": { "name": "wgiezeman", "key": "wgiezeman", "displayName": "Wienke", "active": true, "timeZone": "Europe/Berlin" }, "created": "2013-12-30T14:34:45.000+0000", "updated": "2013-12-30T14:34:45.000+0000" }, { "id": "286258", "author": { "name": "wgiezeman", "key": "wgiezeman", "displayName": "Wienke", "active": true, "timeZone": "Europe/Berlin" }, "body": "I tested it the solution on stackoverflow: http://stackoverflow.com/questions/20379478/android-samsung-s4-html5-video-pauses\r\n\r\nAnd it is exactly the right way to solve this problem:\r\n\r\nI modified the code a bit:\r\n{code}\r\n\t ((AudioManager)activity.getSystemService(\r\n\t activity.AUDIO_SERVICE)).requestAudioFocus(\r\n\t new OnAudioFocusChangeListener() {\r\n\t @Override\r\n\t public void onAudioFocusChange(int focusChange) {}\r\n\t }, AudioManager.STREAM_MUSIC, \r\n\t AudioManager.AUDIOFOCUS_GAIN_TRANSIENT);\r\n{code}", "updateAuthor": { "name": "wgiezeman", "key": "wgiezeman", "displayName": "Wienke", "active": true, "timeZone": "Europe/Berlin" }, "created": "2013-12-30T16:07:51.000+0000", "updated": "2013-12-30T16:07:51.000+0000" }, { "id": "286271", "author": { "name": "fokkezb", "key": "fokke", "displayName": "Fokke Zandbergen", "active": true, "timeZone": "Europe/Amsterdam" }, "body": "So white is the PR Wienke? ;)", "updateAuthor": { "name": "fokkezb", "key": "fokke", "displayName": "Fokke Zandbergen", "active": true, "timeZone": "Europe/Amsterdam" }, "created": "2013-12-30T18:30:13.000+0000", "updated": "2013-12-30T18:30:13.000+0000" }, { "id": "286298", "author": { "name": "wgiezeman", "key": "wgiezeman", "displayName": "Wienke", "active": true, "timeZone": "Europe/Berlin" }, "body": ";) I think putting in like this in the SDK is not the way to go. A good way to go would be adding the Audiomanager to the API so it can be controlled upon closing the activity.\r\n\r\nBut that is up to the Appcelerator guys.", "updateAuthor": { "name": "wgiezeman", "key": "wgiezeman", "displayName": "Wienke", "active": true, "timeZone": "Europe/Berlin" }, "created": "2013-12-30T20:31:13.000+0000", "updated": "2013-12-30T20:31:13.000+0000" } ], "maxResults": 12, "total": 12, "startAt": 0 } } }