Skip to content

Instantly share code, notes, and snippets.

@ULazdins
Last active July 11, 2016 08:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ULazdins/05d34dd9ed7c5f3010dda680257413ee to your computer and use it in GitHub Desktop.
Save ULazdins/05d34dd9ed7c5f3010dda680257413ee to your computer and use it in GitHub Desktop.
Working Live Channels audio track switching sample
public class WorkingSimpleSessionImpl extends TvInputService.Session {
// ...
private void setAudioTracks() {
List<TvTrackInfo> trackInfoList = new ArrayList<>();
for (int i = 0; i < audioTrackCount; i++) {
MediaFormat format = player.getTrackFormat(DemoPlayer.TYPE_AUDIO, i);
TvTrackInfo trackInfo = new TvTrackInfo
.Builder(TvTrackInfo.TYPE_AUDIO, String.valueOf(i))
.build()
trackInfoList.add(trackInfo);
}
notifyTracksChanged(trackInfoList);
}
@Override
public boolean onSelectTrack(int type, String trackId) {
Log.d(TAG, String.format("onSelectTrack(%d,%s)", type, trackId));
// ...
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment