Как изменить аудио и видео треки в Exo Player? - PullRequest
0 голосов
/ 13 февраля 2020

У меня есть встроенный Exo-плеер, способный воспроизводить видео. На данный момент я использую дорожку по умолчанию, я хотел изменить дорожки, как я могу это сделать

DataSource.Factory dataSourceFactory = new DefaultDataSourceFactory(this,Util.getUserAgent(this, "NeouApplication"));
DefaultTrackSelector trackSelector = new DefaultTrackSelector(this);
player = new SimpleExoPlayer.Builder(this).setTrackSelector(trackSelector).build();

MediaSource videoSource = new ProgressiveMediaSource.Factory(dataSourceFactory).createMediaSource(Uri.parse("http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4"));

player.prepare(videoSource);
playerView.setPlayer(player);

trackSelector.getCurrentMappedTrackInfo() дает следующую информацию

rendererTrackGroups = {TrackGroupArray[5]@9281} 
 0 = {TrackGroupArray@9304} 
  hashCode = 0
  length = 1
  trackGroups = {TrackGroup[1]@9362} 
  shadow$_klass_ = {Class@7070} "class com.google.android.exoplayer2.source.TrackGroupArray"
  shadow$_monitor_ = 0
 1 = {TrackGroupArray@9305} 
  hashCode = 0
  length = 3
  trackGroups = {TrackGroup[3]@9309} 
   0 = {TrackGroup@9311} 
    formats = {Format[1]@9314} 
     0 = {Format@9316} "Format(2, null, null, audio/mp4a-latm, null, -1, en, [-1, -1, -1.0], [2, 44100])"
    hashCode = 0
    length = 1
    shadow$_klass_ = {Class@7429} "class com.google.android.exoplayer2.source.TrackGroup"
    shadow$_monitor_ = 0
   1 = {TrackGroup@9312} 
    formats = {Format[1]@9318} 
     0 = {Format@9320} "Format(3, null, null, audio/mp4a-latm, null, -1, en, [-1, -1, -1.0], [2, 44100])"
    hashCode = 0
    length = 1
    shadow$_klass_ = {Class@7429} "class com.google.android.exoplayer2.source.TrackGroup"
    shadow$_monitor_ = 0
   2 = {TrackGroup@9313} 
    formats = {Format[1]@9322} 
     0 = {Format@9324} "Format(4, null, null, audio/mp4a-latm, null, -1, en, [-1, -1, -1.0], [2, 44100])"
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...