Provides support for HTTP Live Streaming (HLS) content. To play HLS content,
instantiate a HlsMediaSource
and pass it to ExoPlayer.prepare
.
The core of the ExoPlayer library. Implementation: IcyHttpDataSourceFactory.java Implementation: IcyHttpDataSource.java Its very easy to show shoutcast Icecast Streaming IcyMetadata
dependencies {
`implementation 'com.github.nepsalone.exoplayer:exoplayer-core:1.0.6'`
`implementation 'com.github.nepsalone.exoplayer:exoplayer-hls:1.0.6'`
}
implement
DefaultDataSourceFactory dataSourceFactory = new DefaultDataSourceFactory(getApplicationContext(), null, icy);
icyData
public IcyHttpDataSourceFactory icy = new IcyHttpDataSourceFactory
.Builder(Tools.getUserAgent())
.setAllowCrossProtocolRedirects(true)
.setConnectTimeoutMillis(1000)
.setIcyHeadersListener(icyHeaders -> {
})
.setIcyMetadataChangeListener(icyMetadata -> {
try {
if (sharedPref.getIcyMetadata().equals("true")) {
Tools.postDelayed(() -> {
if ("".equalsIgnoreCase(icyMetadata.getStreamTitle())) {
updateNotificationMetadata(Constant.item_radio.get(Constant.position).category_name);
onMediaMetadataCompatChanged(Constant.item_radio.get(Constant.position).category_name);
} else {
updateNotificationMetadata(icyMetadata.getStreamTitle());
onMediaMetadataCompatChanged(icyMetadata.getStreamTitle());
}
}, 1000);
}
} catch (Exception e) {
e.printStackTrace();
}
}).build();