google / ExoPlayer

An extensible media player for Android
Apache License 2.0
21.61k stars 5.99k forks source link

Support SCTE-35 in HLS #10992

Open billyjoker opened 1 year ago

billyjoker commented 1 year ago

ExoPlayer Version

2.18.1

Devices that reproduce the issue

Xiaomi Mi Mix 2 (Android 9)

Devices that do not reproduce the issue

Playing on Google Chrome, the SCTE-35 is receivde properly

Reproducible in the demo app?

Yes

Reproduction steps

Play the file (it is a boucle live with SCTE-35 implemented) and wait for the ads

Expected result

We expect receive and read SCTE-35 metadata, but no metadata entries are received.

Actual result

Not receiving Metadata

Media

https://c5433dd5ed1ff15654384a6e4d12952d.7wzuvg.channel-assembly.mediatailor.us-east-1.amazonaws.com/v1/channel/canal3/playlist.m3u8

Bug Report

tonihei commented 1 year ago

SCTE-35 metadata in HLS TS streams is not supported at the moment. We usually recommend ID3 for metadata entries.

The HLS spec also provides a way to signal SCTE-35 splice information in the media playlist: https://datatracker.ietf.org/doc/html/draft-pantos-hls-rfc8216bis#section-4.4.5.1.1 This isn't supported either yet, but it seems like the preferred way of signalling this metadata.

I'll mark this as an enhancement to support either version of SCTE-35 signalling.

billyjoker commented 1 year ago

Thanks @tonihei , so if I want to parse this data, how could I map it directly? I am reading the stream manifest data as follows:

    @Override
    public void onTimelineChanged(Timeline timeline, int reason) {
        Object manifest = player.getCurrentManifest();
        if (manifest instanceof HlsManifest) {
            for (String tag : ((HlsManifest) manifest).mediaPlaylist.tags) {
                // TODO CustomMediaPlaylist mediaPlaylist = parseMediaPlaylist(tag);
            }
        } 
    }

Could you please say if there is an existing parser to perform TODO section ?

tonihei commented 1 year ago

We have SpliceInfoDecoder that can read SCTE-35 information from a byte buffer. Not sure if it could be useful for this case.

billyjoker commented 1 year ago

That did not helped to me. Finally I did a custom parse to get the attributes I needed