Last active
April 17, 2018 13:50
-
-
Save ponnamkarthik/af294de0f821ebbdee5d2736345b8864 to your computer and use it in GitHub Desktop.
RTMP Player using Exo Media Player Library
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//initiate Player | |
//Create a default TrackSelector | |
BandwidthMeter bandwidthMeter = new DefaultBandwidthMeter(); | |
TrackSelection.Factory videoTrackSelectionFactory = new AdaptiveTrackSelection.Factory(bandwidthMeter); | |
TrackSelector trackSelector = new DefaultTrackSelector(videoTrackSelectionFactory); | |
//Create the player | |
SimpleExoPlayer player = ExoPlayerFactory.newSimpleInstance(this, trackSelector); | |
PlayerView playerView = findViewById(R.id.simple_player); | |
playerView.setPlayer(player); | |
RtmpDataSourceFactory rtmpDataSourceFactory = new RtmpDataSourceFactory(); | |
// This is the MediaSource representing the media to be played. | |
MediaSource videoSource = new ExtractorMediaSource.Factory(rtmpDataSourceFactory) | |
.createMediaSource(Uri.parse("rtmp://stream1.livestreamingservices.com:1935/tvmlive/tvmlive")); | |
// Prepare the player with the source. | |
player.prepare(videoSource); | |
//auto start playing | |
player.setPlayWhenReady(true); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment