google / ExoPlayer

This project is deprecated and stale. The latest ExoPlayer code is available in https://github.com/androidx/media
https://developer.android.com/media/media3/exoplayer
Apache License 2.0
21.74k stars 6.03k forks source link

Attempting to change tracks in multi-angle adaptive HLS playlist #2600

Open benwilber opened 7 years ago

benwilber commented 7 years ago

I am trying to change the selected video track in a multi-angle adaptive HLS playlist as described in Listing 13 here "Variant playlist with 3 different camera angles and different bit rates."

I have created a test stream with 3 different "angles" each having 3 adaptive variants here:

#EXTM3U

#EXT-X-MEDIA:TYPE=VIDEO,GROUP-ID="3000k",NAME="Red",AUTOSELECT=YES,DEFAULT=YES
#EXT-X-MEDIA:TYPE=VIDEO,GROUP-ID="3000k",NAME="Green",AUTOSELECT=YES,DEFAULT=NO,URI="green/index-f1-v1-a1.m3u8"
#EXT-X-MEDIA:TYPE=VIDEO,GROUP-ID="3000k",NAME="Blue",AUTOSELECT=YES,DEFAULT=NO,URI="blue/index-f1-v1-a1.m3u8"

#EXT-X-MEDIA:TYPE=VIDEO,GROUP-ID="5000k",NAME="Red",AUTOSELECT=YES,DEFAULT=YES
#EXT-X-MEDIA:TYPE=VIDEO,GROUP-ID="5000k",NAME="Green",AUTOSELECT=YES,DEFAULT=NO,URI="green/index-f2-v1-a1.m3u8"
#EXT-X-MEDIA:TYPE=VIDEO,GROUP-ID="5000k",NAME="Blue",AUTOSELECT=YES,DEFAULT=NO,URI="blue/index-f2-v1-a1.m3u8"

#EXT-X-MEDIA:TYPE=VIDEO,GROUP-ID="8000k",NAME="Red",AUTOSELECT=YES,DEFAULT=YES
#EXT-X-MEDIA:TYPE=VIDEO,GROUP-ID="8000k",NAME="Green",AUTOSELECT=YES,DEFAULT=NO,URI="green/index-f3-v1-a1.m3u8"
#EXT-X-MEDIA:TYPE=VIDEO,GROUP-ID="8000k",NAME="Blue",AUTOSELECT=YES,DEFAULT=NO,URI="blue/index-f3-v1-a1.m3u8"

#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=613606,RESOLUTION=1920x1080,CODECS="avc1.640028,mp4a.40.2",VIDEO="3000k"
red/index-f1-v1-a1.m3u8

#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=815785,RESOLUTION=1920x1080,CODECS="avc1.640028,mp4a.40.2",VIDEO="5000k"
red/index-f2-v1-a1.m3u8

#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=1110022,RESOLUTION=2560x1440,CODECS="avc1.640032,mp4a.40.2",VIDEO="8000k"
red/index-f3-v1-a1.m3u8

Unfortunately I'm not able to determine from the TrackSelector API how I can actually change to a different "angle" as a result of user button press, for instance. Is this possible with ExoPlayer v2.3.0 presently?

Thanks!

sergiomartinez4 commented 7 years ago

is there a way to achieve that in ExoPlayer r2.5.2?

sapanda commented 6 years ago

Bumping up to see if this is possible yet in ExoPlayer 2.8.2. Thanks!

AquilesCanta commented 6 years ago

Still on the radar but not on the roadmap yet, unfortunately. Thanks for your patience!

jaganPeloton commented 5 years ago

Hello,

I have a similar use-case where I am defining alternative renditions (HLS spec https://tools.ietf.org/html/draft-pantos-http-live-streaming-20#section-4.3.4.2.1).

How can I use ExoPlayer on Android to select audio streams from a group - This is mainly to support multi-language audio over HLS streaming?

Thanks.

AquilesCanta commented 5 years ago

Multi-language HLS should just work. Try it on our demo app and let us know if you run into any issues.

WassimErriha commented 5 years ago

I'm working on a very similar feature as the OP where I'm trying to make a seamless track selection to a different camera-angle. I have tried two approaches so far: 1. I have tried to implement a ManualTrackSelector by customizing AdaptiveTrackSelector, and passing a message to the playback thread to make a seamless switch. This solution is described in #2250. The switch is seamless as expected, but the time between the selection and the switch can be quite long(maybe LoadControl needs to be configured differently ?). Also, ExoPlayer.ExoPlayerComponent() and ExoPlayer.sendMessages() are now deprecated ... 2. The second approach was to use two players. The idea was that the helper player loads the media that was selected and seeks to the current position, then makes the switch only after it reaches STATE_READY. The seeking in this approach didn't work as expected. With the decoder reuse in the upcoming release (Exoplayer 2.10), i might just revert to using a single instance since the latency is now down to 110ms (props to the team for this !) Will the next release facilitate multi-angle track selection or renditions ? If not, is there a way to customize Exoplayer to support such use case in the meantime ? Thank you!

AquilesCanta commented 5 years ago

Hi @WassimErriha, this issue tracks support for multiple video renditions in HLS (which is currently being worked on as per commit references above).

Achieving seamless switching between video renditions is a different issue, and I suggest you open a new issue for that.