Exoplayer about 10 or 15 minutes the application closes when the screen turns off

first apk is on google play with this option.

But I heard that if you use this, Google play store will rejects the app: Extension to request IGNORE BATTERY OPTIMIZATIONS. Remember: this will not help to run your app in the background!
@Taifun can you confirm that?

I will add it in my application and check if it works.

Although this should be the same as setting this in “special access” on phone.

As I thought, it does nothing. Runs only the special access settings.

today i tested this solution on 15 phones - every play shoutcast over 1 hr. Before stopping several minutes. I don’t use any extension, only this “text”

Of course, you have give allow your app.

Have you tested on Huawei’s phone?

I did tests on my huawei phones.
Hmm, how to say that. It works :slight_smile:
Earlier, playback was interrupted after 11 minutes.
Now, they have been playing with blank screens for an hour.

Strange but works.

I tested with the @Taifun extension.

I also put it into the Google store without any problems. The application has not been rejected.

I just added a call for optimizer in the screen initialization block

The only thing that comes to my mind. I don’t know exactly what.
I’ve always manually set it for the application and it never worked.
Setting this from the extension - works.

I am very happy :slight_smile:

Finally, internet radio works as it should.

interesting…

glad to hear!

Taifun

2 Likes

Please provide a simple example (aia) so that we can understand (reproduce) how it works (for you).

Btw, are you sure that you are talking about the original topic of this thread? As far as I can see, it was not a radio app, but anyway, we are interested in all solutions …

3 Likes

I did some more tests and found something very strange (point 2, that should never have happened):

  1. If you use the uncompressed WAV format instead of the compressed audio format OGG (MP3, M4A, …) no stuttering occurs and the sound does not stop after the app is in the background (home button) or you switch off the screen (press the power button).

  2. If you use the WAV format, the sounds will no longer be looped seamlessly (never seen / heard that before). The WAV format is basically loop-able, this works in all development environments (including iOS, Apple).

Tested on a Galaxy Note8 (Android 9).

Check this APK on your devices: ExoPlayer_test.apk (8.0 MB)

Note: Unfortunately also a PARTIAL_ / FULL_WAKE_LOCK which keeps the CPU running (in background or standby), doesn’t help if you are using compressed audio format (OGG). If there is no other solution, the ExoPlayer would be practically useless. All of these issues (bugs) only occur with ExoPlayer.

4 Likes

It was not a radio application but it differs only by one. The file is not on the device. Exoplayer is the best for playback, also for files from the Internet.
Therefore, this problem also applies to radio applications.

If you want to test. Link:

https://mega.nz/#!atgAwCoR!FAA5zN-dYWp5wkcJjcIHSSkPXfjne8ksu58RYBgS37c

Only small info, the application is only in Polish.

I do not give a link to the google store because I set the download country there and the link in other countries may not be available

On my Samsung S8 running Android OS v9.0 I get the exact same results as you did.

2 Likes

I tested your apk on physical smartphone with android 6 and on AVD with android 9. With the WAV files the application was not closed and the audios continued without problem. As you say, the problem is with ogg audios.

I have now tried an ogg file and another wav, I have left them playing at the same time. It has endured without closing. It may also work on your devices that when the screen is in sleep mode stops sounding … You can try.
ExoTest.apk (7.9 MB)

I had already tried this (by placing a 1 sec silent WAV file to ExoPlayer3.Source, ExoPlayer3.Volume = 0, ExoPlayer3.Loop = true), but unfortunately that doesn’t change the fact that the sound (OGG file) starts to stutter after 50 -60 seconds after the device goes into sleep mode.

1 Like

Kodular is currently using ExoPlayer version 2.8.2 (2018-06-06)
I got a hint from @Boban how to find this after decompiling the APK:

grafik

The current ExoPlayer version is 2.11.3 (2020-02-19): ExoPlayer/RELEASENOTES.md at release-v2 ¡ google/ExoPlayer ¡ GitHub

I really hope @Kodular updates the ExoPlayer to this current version soon, because the ExoPlayer version 2.8.2 is completely unusable due to the issues in background / standby (sleep mode).
As long as this has not happened, I must continue to use the TaifunPlayer (for gapless looping) and otherwise the Player component.

5 Likes

I’ve opened an issue to track this:

6 Likes

See also here:

4 Likes

It’s nice that there exist a library version which contains bug fixes.
The bad thing:
All new exoplayer lib versions use android x.

We still dont use android x.
Means we can not use the newest lib from exoplayer.

3 Likes

Which means we have to wait until Kodular targets Android Q (API 29):
compileSdkVersion = 29
targetSdkVersion = 29

True? If so, when will that happen?