I am first time working on online Video player, I am using TextureVideoViewMute extends TextureView implements TextureView.SurfaceTextureListener
custom class as custom video player.
I am having two urls
in my response source_url
(main url) and dash_url
.Now I wanted to use ExomediaPlayer
for this but I have following questions.
1.How to categories which url
to be played?
2.Or Whether this will be decided by player itself while playing?
3.Or We need to use single url
player automatically do his work?
4.Or is it possible combination of custom video surfaceview
and SimpleExoPlayer
?
The main thing I want achieve is adaptive bit rate streaming
like you-tube 144p 220p 720p... etc
does according to network condition
I have tried the examples provide on GIT
but they are either playing dash_url
or source_url
Because of poor documentation I am not able to understand how should I go for this.
Exoplayer Sample
Sample code of
Exoplayer
String videoURL = "http://blueappsoftware.in/layout_design_android_blog.mp4";
SimpleExoPlayerView exoPlayerView = (SimpleExoPlayerView) findViewById(R.id.exo_player_view);
try {
BandwidthMeter bandwidthMeter = new DefaultBandwidthMeter();
TrackSelector trackSelector = new DefaultTrackSelector(new AdaptiveTrackSelection.Factory(bandwidthMeter));
SimpleExoPlayer exoPlayer = ExoPlayerFactory.newSimpleInstance(this, trackSelector);
Uri videoURI = Uri.parse(videoURL);
DefaultHttpDataSourceFactory dataSourceFactory = new DefaultHttpDataSourceFactory("exoplayer_video");
ExtractorsFactory extractorsFactory = new DefaultExtractorsFactory();
MediaSource mediaSource = new ExtractorMediaSource(videoURI, dataSourceFactory, extractorsFactory, null, null);
exoPlayerView.setPlayer(exoPlayer);
exoPlayer.prepare(mediaSource);
exoPlayer.setPlayWhenReady(true);
} catch (Exception e) {
Log.e("MainAcvtivity", " exoplayer error " + e.toString());
}