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