Skip to content

NetworkTypeObserver doesn't update it's initial value after creation #10970

Closed

Description

@rychagovDi

ExoPlayer Version

2.18.2

Devices that reproduce the issue

Pixel 6 running Android 13

Devices that do not reproduce the issue

No response

Reproducible in the demo app?

No

Reproduction steps

Can't find a real auto-quality dash-vp9 video in demo app - it always asks to choose quality before playback start.

The issue is in adaptive quality selection - due to initially low bandwidth, player choose low quality at the start of playback.

Expected result

Video starts with good quality, accordingly to actual network bandwidth.

Actual result

Video starts with bad quality, because of low initial bandwidth

I investigated the issue, and it seems like NetworkTypeObserver#Receiver#onReceive method doesn't get called after registering broadcast receiver (even later, 'asynchronously').

Seems like NetworkTypeObservers' internal impl expects sticky behavior from BroadcastReceiver (so it would receive last network type after receiver registering) - but actually it doesn't work this way.

Moreover, https://developer.android.com/reference/android/net/ConnectivityManager#CONNECTIVITY_ACTION is deprecated and Google advices to use NetworkCallback or/and direct call to ConnectivityManager#requestBandwidthUpdate() to force-receive current network state and it's bandwidth.

Media

Not applicable

Bug Report

  • You will email the zip file produced by adb bugreport to [email protected] after filing this issue.

Activity

  1. tonihei commented on Feb 10, 2023

    @tonihei
    Collaborator

    Thanks for reporting!

    It looks like this is caused by the newly added REGISTER_NOT_EXPORTED flag when registering the receiver. Up to Android 12, it works just fine and if I mark the registration with REGISTER_EXPORTED on Android 13, it also starts working again.

    However, as far as I can see, this shouldn't be needed because callbacks from the system never require REGISTER_EXPORTED. There is a public Android bug reporting this as well at https://issuetracker.google.com/260336345. I'll follow up with the relevant team internally to figure out if this is a system bug or intended behavior .

  2. locked and limited conversation to collaborators on Jun 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions