'Exoplayer how to know which URL to be played with custom video view
I am working on an 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 the following questions.
How to categorize which
URLto be played?Or Whether this will be decided by the player itself while playing?
Or we need to use a single
URLplayer automatically do his work?
4.Or is it possible combination of custom video surface view and SimpleExoPlayer?
How to achieve adaptive bitrate streaming like you-tube 144p 220p 720p... etc according to network condition?
I have tried the examples provide on GIT but they are either playing dash_url or source_url
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());
}
Solution 1:[1]
You can get the current player source (uri) by calling:
player.currentMediaItem?.playbackProperties?.uri
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Abanoub Samir |
