im new in android webview, i play video in android webview using exoplayer, there are 2 category video that i play, first mp4, working well. second streaming (unicast m3u8 and UDP) the video play well but no audio, i try play in stream vlc the source has audio,
this is my code.
private void initializePlayerMulticast(Uri mUri) {
Toast.makeText(ExoPlayer.this, "Hello bro multicast woi hehee", Toast.LENGTH_LONG).show();
player = ExoPlayerFactory.newSimpleInstance(this);
UdpDataSource.Factory test = buildDataSourceFactory();
ExtractorsFactory extractorsFactory = new DefaultExtractorsFactory();
ExtractorMediaSource mediaSource = new ExtractorMediaSource
.Factory(test)
.setExtractorsFactory(extractorsFactory)
.createMediaSource(mUri);
videoView.setPlayer(player);
player.prepare(mediaSource);
player.setPlayWhenReady(true);
}
private DataSource.Factory buildDataSourceFactory() {
return new UdpDataSource.Factory() {
@Override
public DataSource createDataSource() {
return new UdpDataSource(5000, 100000);
}
};
}
sory for bad english..
In my case also audio was an issue. So I fixed it by ensuring bitrate is higher than 20 ( it can be 1 also ) and along with that height of video. The code is as below :