I want to reproduce the URL in my application, but when using the exoplayer library, it gives an error, while if I use the standard mediaplayer, everything will be fine and the mp3 will play. Please help me find my mistake and give useful information. Thank.
Here is an example URL address, it is redirected but it is necessary that exoplayer works with it: https://m.z1.fm/xxx-load/22346945?play=on
This is my code
DefaultRenderersFactory renderersFactory = new DefaultRenderersFactory(context, null,
DefaultRenderersFactory.EXTENSION_RENDERER_MODE_OFF);
exoPlayer = ExoPlayerFactory.newSimpleInstance(context, renderersFactory, new DefaultTrackSelector());
DefaultHttpDataSourceFactory httpDataSourceFactory = new DefaultHttpDataSourceFactory(
URLs.getUserAgentMobile(), new DefaultBandwidthMeter(),
DefaultHttpDataSource.DEFAULT_CONNECT_TIMEOUT_MILLIS,
DefaultHttpDataSource.DEFAULT_READ_TIMEOUT_MILLIS, true);
ExtractorMediaSource mediaSource mediaSource =
new ExtractorMediaSource.Factory(httpDataSourceFactory).createMediaSource(Uri.parse(urlTrack));
exoPlayer.prepare(mediaSource);
exoPlayer.setPlayWhenReady(true);