Choose AVPlayerItemVideoOutput video track

UPDATE

I don't want this to necessarily be an hls question, it's about multitrack video, so I could rephrase as how do I tell AVPlayerItemVideoOutput which video track to use from a multitrack local file? e.g. an mp4


Do I need to make multiple single track AVCompositions and play them in multiple AVPlayers? That might be fine, even though it's not clear that it would work with a non local version...


PREVIOUSLY

I have an hls stream with multiple video tracks - the tracks are independent, i.e. not different resolution versions of the same thing.

I don't see anyway to choose which one AVPlayerItemVideoOutput will use.


Is there a way?

Replies

I have the same problem. Have you solved it?
I can think of a couple ways:
  1. Use an AVVideoComposition to tell AVPlayer which track(s) to choose, and how to compose them together (if you choose more than one)

  2. Use AVPlayerItemTrack.enabled to choose which tracks are enabled

Depending on how the content is authored, you might be able to use selectMediaOption:inMediaSelectionGroup: to pick the video option you want as well.