Loading in ExoPlayer

I am using ExoPlayer in an app to play audio, by calling it using the URL of the audio file stored in Firebase.
blocks (7)
When I press a button, I want the player to fetch the song given in its “source” attribute, and start playing. When using WiFi connection, the player fetches the audio file instantly and starts playing the audio. But when using Mobile data connection, there is delay in this process for the player to load the song.
When there is delay in loading process, I am unable to convey the user, that the song is being loaded. I did not find a solution for showing the loading progress of the ExoPlayer.

I would like to get the function of loading progress method or something like that. But the only method related to LOADING is the “is Loading” attribute.


This does not solve my issue.
Is it possible to achieve something like that using existing logic?? Appreciate your effort in helping!

Try something like this:

Thank you for your response.

I tried the method you suggested. It can be used to show the users, audio is loading. But the else statement in the block is always executed when the status of player changes. I have statements for finding total duration of the audio in seconds, and other few statements to be executed after loading the audio file. These statements will not work properly using the suggested method.
Is there way to know when the loading process is completed, so as to execute other statements along with starting the player?

No, only when ExoPlayer is not loading.
So where is your problem?

I want to know when the loading is completed. And then execute some statements.

When Label2 is an empty string …

the loading is completed.

Thank you for helping

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.