adi_rds avatar image
adi_rds asked

FireTV Webview based android app freezes even though it is NOT out of memory!

The app plays a series of video clips and images in rotation through a webview activity. Even though total memory consumption at any point is < 150-200 mb, suddenly after around 20 hours of playing memory usage suddenly went down to zero and the app froze. I monitored all this through adb. The fire tv stick is non-responsive to the controller and basically needs to be switched off and on manually.

What could be some possible sources of this instability? Is the kernel trying to do something that isn't being handled? Do I need to be clearing some kind of buffers or need to add any additional event handling to the activity?

When I access the same URL through a normal web browser there are absolutely no issues.

fire tvandroidvideoapp
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Jacek avatar image
Jacek answered

We may have seen the same or similar behavior with our WASK app.

What we have also noticed is that the timing of those crashes may depend not so much on how long those videos played, but rather how many vids played (how many times player got started/teared down). From what we have seen, when we play shorter videos, crashes take less time to happen (say few hours for ~3 mins videos); for longer videos sometimes we passed 24 hours without any issues (we didn't bother to wait more than that, knowing that shorter videos trigger the same issue sooner).

Also, in our case, we are playing YouTube videos using YT player. We don't use queueing capabilities of that player, as we started a new player for every video.

We have also no control over those videos, so cannot tell how they were prepared.

Sorry, but we didn't investigate this issue too much.

Thank you, Jacek

10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

adi_rds avatar image adi_rds commented ·

That's very interesting. In my case I am playing a ton of short clips (~10s), and yes it seems to error out after a little while. The actual time it takes seems non-deterministic - can be between a few hours and a few days. Also, I'm playing through the video element in webview rather than dedicated player.

Any thoughts on the source of the problem or where I should fish for a workaround solution?

0 Likes 0 ·
Jacek avatar image Jacek adi_rds commented ·

Hi @adi_rds

So, you have just proved my theory about those short videos bad! Man, when we were doing our tests around this issue, I swear we saw that pattern :)

Hey, we are in the same boat, if possible we would like to see it fixed as well :)

Although, in our case we consider this issue 'nice to be fixed.' (Yes, we see end customers playing those videos for 24 hrs at a time, but not that many.) There are other more pressing issues (for us) that Amazon is not fixing or helping to resolve and are affecting us much more. Both of us seeing potentially the same problem maybe gives Amazon more incentives to look into it.

That YT player we are using is just a JS wrapper for web based aps. So, I think it boils down to the same native player which may or may not be stable. Since both apps work through webview, maybe that is the offending layer.

Seeing what others are reporting, maybe the issue has nothing to do with our apps playing that content, just AFTs are starting some process that brings the system down. Since we both played that content for a long time, we may have just been more exposed to it.

0 Likes 0 ·
adi_rds avatar image adi_rds Jacek commented ·

@Jacek -

If a system process is bringing it down, that would indeed be poor design. The app has KEEP_SCREEN_ON permissions so it's directly against the wishes of the user and the application case. Also, there are a bunch of digital signage players on the app store - everyone will be squealing.

Also, the freeze itself is random. Sometime it just sits on a screen unresponsive, and sometimes it crashes and goes into screen saver......

My strong suspicion would be the video element. Did you know that you can have only 1 video element per html5 page? Also, the documentation says that the video resources aren't automatically released once play is completed.

Maybe if video is played through the MediaPlayer or Exoplayer instead of through Webview we might see more stability? I don't know. I haven't tried that yet.

@Levon @Amazon any suggestions or insights into the problem to help us out? Is the app crashing due to repeated use of the html5 video element in Webview or is it some system level issue?

0 Likes 0 ·
Levon@Amazon avatar image
Levon@Amazon answered

Hi adi_rds,

Please specify the device name / model, OS version on it, and if possible include URLs to some sample videos, as well as a snippet of code (or better yet a sample app) where you play those videos, and the web team will investigate. Thanks!

10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

adi_rds avatar image adi_rds commented ·

App is Bulletin Views

For Screen ID to run a screen try : streetergym7121

It's a test screen setup setup with a couple of videos switching every 10 seconds. The actual crash is non-deterministic but roughly happens between ~24-48 hours of continuous play.

The app is basically a webview that fetches a list of video and image urls from the server, and cycles through them.

Device Details:

[]: [Amazon Fire TV Stick]

[]: [4]

[]: []

[]: []

[]: [Fire OS (623529620)]

[]: [5.1.1]

[]: [22]

0 Likes 0 ·
adi_rds avatar image adi_rds commented ·

@Levon@Amazon were you able to replicate the problem? Any ideas on how to handle it?

Thank you.

0 Likes 0 ·