I have an iPad app developed using a third-party OpenPlug tool that converts AS3 to C ++ and from there when exporting to iOS. (I just wanted to notice that this is not a βnativeβ application using Obj-C in Xcode written by me, I wrote AS3)
I now have this iPad app that displays images and videos in a slide show. For video, I use WebView, which loads an HTML page where I change the src property of the video object to the location of the video file that was uploaded to my application store. This works fine, except that the application freezes when it runs for several hours (3-6).
I looked for this problem and tried the solution in Safari iOS memory leak when loading / unloading HTML5 <video> , but this does not seem to change anything for me.
Since the application freezes (right before the HTML page needs to load the video) and does not work, what does this mean? Do I need to destroy a video object? At first I created a new WebView for each video, but now I reuse webview and just change the src property, but that also does not help me.
Can anyone shed some light on this? OpenPlug has stopped serving it and is no longer offering any support, but nonetheless, I think this is more of a web view / video issue on the iPad (?)
It is important to note: the application freezes, but my iPad does not. The application does not generate a crash report and no longer executes any code (there are also no traces). When I click the Home button on my iPad and click the application icon, the application restarts.
Here is the code for my HTML page, which is updated every time I need to start a new video (webview.location = ...)
<html> <head> <script> function videoEndedHandler(){ var video = document.getElementById("videoPlayer"); video.src = ""; video.load(); window.location.hash = "ended"; } function videoErrorHandler(){ window.location.hash = "error"; var video = document.getElementById("videoPlayer"); video.src = ""; video.load(); } var loop; function setup(){ var video = document.getElementById("videoPlayer"); video.addEventListener("error", videoErrorHandler,false); video.addEventListener("ended", videoEndedHandler,false); video.load(); video.play(); startHashLoop(); } function startHashLoop(){ if(window.location.hash == "#touched"){ setAsPaused(); } if(window.location.hash == "#paused"){ </script> </head> <body onload="setup();" style="background-color:#000000;"> <a href="javascript:setAsTouched()" style="top:0;left:0;position:absolute;z-index:1;color:#FF0000;border:0px solid red;width:100%;height:100%;display:block;"></a> <video id="videoPlayer" style="top:0;left:0;position:absolute;" width="100%" height="100%" preload="auto" src="##VIDEO_URL##" autoplay="autoplay" webkit-playsinline /> </body> </html>