public void play(String uri){
  tvInputPlayer.setSurface(mSurface);
  try {
    Log.d(TAG,"Play " + uri + "; "+ uri.indexOf("asset:///"));
    if (uri.contains("asset:///")) {
      Log.i(TAG,"Is a local file");
      DataSource dataSource=new AssetDataSource(getApplicationContext());
      ExtractorSampleSource extractorSampleSource=new ExtractorSampleSource(Uri.parse(uri),dataSource,new DefaultAllocator(1000),5000);
      TrackRenderer audio=new MediaCodecAudioTrackRenderer(extractorSampleSource,null,null,true);
      tvInputPlayer.prepare(audio,null,null);
    }
 else {
      tvInputPlayer.prepare(getApplicationContext(),Uri.parse(uri),TvInputPlayer.SOURCE_TYPE_HLS);
    }
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
  tvInputPlayer.setPlayWhenReady(true);
}

public void play ( String uri ) { tvInputPlayer . setSurface ( mSurface ) ; try { Log . d ( TAG , "Play " + uri + "; " + uri . indexOf ( "asset:///" ) ) ; if ( uri . contains ( "asset:///" ) ) { Log . i ( TAG , "Is a local file" ) ; DataSource dataSource = new AssetDataSource ( getApplicationContext ( ) ) ; ExtractorSampleSource extractorSampleSource = new ExtractorSampleSource ( Uri . parse ( uri ) , dataSource , new DefaultAllocator ( 1000 ) , 5000 ) ; TrackRenderer audio = new MediaCodecAudioTrackRenderer ( extractorSampleSource , null , null , true ) ; tvInputPlayer . prepare ( audio , null , null ) ; } else { tvInputPlayer . prepare ( getApplicationContext ( ) , Uri . parse ( uri ) , TvInputPlayer . SOURCE_TYPE_HLS ) ; } } catch ( Exception e ) { e . printStackTrace ( ) ; } tvInputPlayer . setPlayWhenReady ( true ) ; }
will load and begin to play any rtmp , hls , or mpeg2 - dash stream should also be able to play local videos and audio files
