I am creating a very simple app in android. This app has 1 WebView. and on index.html file.
What I want to do is, I want to run index.html in WebView(Successful)
What index.html is doing is, It takes 3 videos from the same folder and run that videos one by one in the infinite loop. Everything works smooth, however, the biggest issue I can see is in memory profiler.
after testing application for the long run, I have found that Native memory keeps rising and not going down. this is really strange.
What I have done till so far,
1) Testing the app in different WebView
versions,
2) Testing the same issue with creating project in Cordova,
3) Developing the same thing in ionic,
4) Calling System.gc() every after an hour,
5) removing all possible code from HTML and javascript
6) Creating native project loading webview and showing index.html in that
Please check code index.htm code below.
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
* {
box-sizing: border-box;
}
body {
margin: 0;
font-family: Arial;
font-size: 17px;
}
#myVideo {
position: fixed;
right: 0;
bottom: 0;
min-width: 100%;
min-height: 100%;
}
.content {
position: fixed;
bottom: 0;
background: rgba(0, 0, 0, 0.5);
color: #f1f1f1;
width: 100%;
padding: 20px;
}
#myBtn {
width: 200px;
font-size: 18px;
padding: 10px;
border: none;
background: #000;
color: #fff;
cursor: pointer;
}
#myBtn:hover {
background: #ddd;
color: black;
}
</style>
</head>
<body>
<video id="homevideo" width="100%" autoplay onended="run()" muted>
<source src="video1.webm" type="video/webm">
Your browser does not support HTML5 video.
</video>
<script>
video_count =1;
videoPlayer = document.getElementById("homevideo");
function run(){
video_count++;
if (video_count == 4) video_count = 1;
var nextVideo = "video"+video_count+".webm";
videoPlayer.src = nextVideo;
videoPlayer.play();
};
</script>
</body>
</html>
Let me know if anything further information is required.
Also check profiler report.
Thanks in advance.
======================= Further analysis ===================
After spending a whole day and running index.html in android native browser app "com.android.browser". It gives almost same result. Chart continue to rise. Please check the graph attched