title: Exoplayer how to know which URL to be played with custom video view
body: <p>I am working on an online Video player, I am using <code>TextureVideoViewMute extends TextureView implements TextureView</code>. <code>SurfaceTextureListener</code> custom class as custom video player. </p>
  
  <p>I am having two <code>URLs</code> in my response <code>source_url</code>(main URL) and <code>dash_url</code>.Now I wanted to use <code>ExomediaPlayer</code> for this but I have the following questions.</p>
  
  <ol>
  <li><p>How to categorize which <code>URL</code> to be played?</p></li>
  <li><p>Or Whether this will be decided by the player itself while playing?</p></li>
  <li><p>Or we need to use a single <code>URL</code> player automatically do his work?  </p></li>
  </ol>
  
  <p>4.Or is it possible combination of <code>custom video surface view</code> and <code>SimpleExoPlayer</code>?</p>
  
  <p><strong>How to achieve <code>adaptive bitrate streaming</code> like <code>you-tube 144p 220p 720p... etc</code> according to network condition?</strong></p>
  
  <p>I have tried the examples provide on <code>GIT</code> but they are either playing <code>dash_url</code> or <code>source_url</code></p>
  
  <p><a href="https://github.com/google/ExoPlayer" rel="nofollow noreferrer">Exoplayer Sample</a></p>
  
  <blockquote>
    <p>Sample code of <code>Exoplayer</code></p>
  </blockquote>
  
  <pre><code>  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());
      }
  </code></pre>