Skip to content

Expose HLS master playlist as part of the object returned via ExoPlayer.getCurrentManifest #2537

@rileymacdonald

Description

@rileymacdonald

I'm upgrading from ExoPlayer r1.5.9 to r2.2.0. How can I receive a reference to the HlsMasterPlaylist when loading HLS content? I'm assuming this is the only way to get a reference to the variants; Previously when using ExoPlayer r1.x, the onSingleManifest() callback returned an HlsPlaylist which could be cast to a HlsMasterPlaylist in order to get a reference the variants (which now appears to be List<HlsUrl> variants;):

new ManifestFetcher.ManifestCallback<HlsPlaylist>() {
    public void onSingleManifest(HlsPlaylist playlist) {
        (HlsMasterPlaylist) playlist // ...
    }
}

This callback appears to have been removed in r2.x.

Here is an example of the ExoPlayer instance I'm using:

ExoPlayer player = ExoPlayerFactory.newInstance(
    Renderer[
        new MediaCodecVideoRenderer(appContext, MediaCodecSelector.DEFAULT),
        new MediaCodecAudioRenderer(MediaCodecSelector.DEFAULT),
        new TextRenderer(...),
        new MetadataRenderer(...)
    ],
    new DefaultTrackSelector(new AdaptiveVideoTrackSelection.Factory(
        new DefaultBandwidthMeter()
    ) 
    new DefaultLoadControl(
        new DefaultAllocator(true, C.DEFAULT_BUFFER_SEGMENT_SIZE)
    )
);

Here is an example of the MediaSource I'm using:

MediaSource mediaSource = new HlsMediaSource(
    uri,
    new DefaultDataSourceFactory(
        appContext, 
        userAgent, 
        new DefaultBandwidthMeter(), 
    handler, 
    adaptiveMediaSourceEventListener)

player.prepare(mediaSource);

Is there a listener which exposes the variants I require from HlsMasterPlaylist? Is there documentation explaining these types of changes from r1.x to r2.x which I can reference? I hope I've provided enough information to answer this question. Thanks.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions