fix(android): prevent livestream failures by assigning a default user-agent for Media3 requests #2496
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Added a custom user-agent string to prevent 403 errors when playing Live365 streams using Media3.
Resolves #2495.
Issue
Some streams require user-agent to be defined. Such as
https://streaming.live365.com/a39417 & https://streaming.live365.com/a62429.
Starting those streams with new media3 implementation resulted in playback error
Tested in example app, on various emulators, physical devices and on different Android versions & Android Studio versions... Same issue everywhere.
mainbranch did work as expected, streams played in all scenarios.After looking into it, server was throwing 403 - Forbidden for media3 implementation.
Native error in media3 exoplayer:

Fix
Added default user-agent to comply with those restrictions.
Users are still able to override user-agent, by defining it inside track object.
Example:
Verified in example app, running on Motorola g34 5G, Android 14.