0

I am making online radio streaming, for a local radio station. Unfortunately, the stream works ok with android version 8 and below, but it fails in android version 9 and above.

here is my code so far (for the play function)

 player = new ExoPlayer.Builder(this).build();
        MediaItem mediaItem  = new MediaItem.Builder()
                .setUri("http://stream.zeno.fm/fiit4u4ied0uv")
                        .build();

        player.setMediaItem(mediaItem);
        player.setPlayWhenReady(true);
        playerView.setPlayer(player);
        player.prepare();

along with internet permission i have these as well in manifest


        android:usesCleartextTraffic="true"
        android:networkSecurityConfig="@xml/network_security_config"

here is network_security_config code

<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
    <base-config>
        <trust-anchors>
            <certificates src="system"/>
        </trust-anchors>
    </base-config>
        <domain-config cleartextTrafficPermitted="true">
            <domain includeSubdomains="true">http://stream.zeno.fm</domain>
        </domain-config>
</network-security-config>

my stream url is: http://stream.zeno.fm/fiit4u4ied0uv

i have been strugling with this for three days.

1 Answers1

0

I just wanted this line in manifest

android:usesCleartextTraffic="true"

The use of network_security_config didn't work The two should not work together as well.