shaka-project / shaka-player-embedded

Shaka Player in a C++ Framework
Apache License 2.0
239 stars 62 forks source link

How to retrieve video resolutions of an adaptive stream from the player, and play each one? #205

Open Offek opened 3 years ago

Offek commented 3 years ago

Hi, I have a regular HLS stream with 2 video tracks and 2 audio tracks. I'm able to fetch the languages (audio tracks) using the getVariantTracks function and have the player change between them. However, getVariantTracks only retrieves the audio tracks of the stream. How can I do the same for video variants of the different resolutions in the stream? I'm trying to fetch all the video tracks so I can play them selectively, similar to YouTube's (360p, 1080p, etc).

Here is an example of my master.m3u8 file:

#EXTM3U
#EXT-X-VERSION:3
#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="group_aud",NAME="audio_0",DEFAULT=YES,LANGUAGE="spa",URI="var-0.m3u8"
#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="group_aud",NAME="audio_1",DEFAULT=NO,LANGUAGE="eng",URI="var-1.m3u8"
#EXT-X-STREAM-INF:BANDWIDTH=22975,RESOLUTION=640x272,CODECS="avc1.640015,mp4a.40.2",AUDIO="group_aud"
var-2.m3u8

#EXT-X-STREAM-INF:BANDWIDTH=140800,RESOLUTION=1920x816,CODECS="avc1.640028,mp4a.40.2",AUDIO="group_aud"
var-3.m3u8

Thanks in advance!

joeyparrish commented 3 years ago

On iOS, Apple's native playback API doesn't give you control over resolution selection, only language/audio. In cases where we are relying on that to play HLS, there is no way for us to offer you resolution selection as far as I understand. @TheModMaker, I know this is all true on the web, but is it also accurate for Embedded on iOS?