I've created a Scene which displays the streamed video from 3 Zoneminder security cameras.
The Webview element mode is direct and the source is:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
<html>
<head>
<title></title>
</head>
<body>
<div align="center">
width="100%"alt="pic">
</div>
</body>
</html>
The Show Scene task has "Continue Task Immediately" and the scene is destroyed at the bottom of the task. The problem is that upon exiting the Scene via the Back Button or Home Key, the 3 Webview elements keep the connection up and video continues to stream to phone in the background indefinitely.
If I exit the scene using the Close menu item at the top of the Scene, the connections are closed immediately.
I attempted to get around this issue by individually destroying each Webview element before destroying the Scene. This fixes the problem, unless the Scene was started in portrait mode and closed while in landscape mode. If the orientation has changed I get an error when I try to destroy the Webview element and the connection stays active.
Error Message when destroying Webview element that was created in different orientation:
20-01-2017 E: 09.56.33#E: error: code 3: android.view.ViewRootImpl$CalledFromWrongThreadException: Only the original thread that created a view hierarchy can touch its views..
20-01-2017 E: 09.56.33#E: error: prefsException/Element Destroy: Only the original thread that created a view hierarchy can touch its views.
Am I doing something wrong or are there any suggestions on how to get around this issue?
Task:
wcWebCamWidget (125)
A1: Create Scene [ Name:WebCam Scene ]
A2: Perform Task [ Name:wcChangeLayout Priority:%priority Parameter 1 (%par1): Parameter 2 (%par2): Return Value Variable: Stop:Off ]
A3: Show Scene [ Name:WebCam Scene Display As:Activity, Full Display Horizontal Position:100 Vertical Position:100 Animation:System Show Exit Button:Off Show Over Keyguard:On Continue Task Immediately:Off ]
A4: For [ Variable:%var Items:1,2,3 ]
A5: Element Destroy [ Scene Name:WebCam Scene Element:%var Continue Task After Error:On ]
A6: End For
A7: Destroy Scene [ Name:WebCam Scene Continue Task After Error:On ]
Phone:
Galaxy S5 (unrooted)
Android 6.0.1
Tasker 4.9u4m