Player event when rendered bitrate changes
Hello,
Is there an event I can hook into to determine when the currently rendered bitrate changes? I saw you can calculate average bitrate
Log.d("DEBUG", "Additional calculated summary metrics: "
+ "average video bitrate = " + playbackStats.getMeanVideoFormatBitrate()
but did not find something for the current rendered bitrate. Thanks!
Can you clarify exactly what you mean by "when the currently rendered bitrate changes"? Do you mean "when the current media file changes and it has a different average bitrate than the previous one"? Or "when the compressed bitrate of the video frame being renderered changes"? Or anything else?
Basically we want to know when the player switches to a different rendition due to network bandwidth change and when it does, what is the bitrate of the video being rendered
what is the bitrate of the video being rendered
Sounds like AnalyticsListener.onVideoInputFormatChanged() is what you are looking for. The AnalyticsListener has other methods like onVideoSizeChanged(), but I think the Format can change for the video size or the frame rate when changing tracks. The Format gives you both.
Basically we want to know when the player switches to a different rendition
The actual notification that an adaptive track change has occurred is notified with AnalyticsListener.onTracksChanged(). You could extract the information from the track selection as well.
due to network bandwidth change
I think strictly speaking you can't know the reason for the change of video size or tracks from the listener being called alone. This can be a decision taken by the adaptive track selector based on network bandwidth change. Other things like load errors or manual track selection can cause the same listeners methods to be called.
You can also use EventLogger as a start and inspect the logs when you play. That will give you a good feeling of what listener method is best for your use case.
Closing due to inactivity.