shaka-project / shaka-player

JavaScript player library / DASH & HLS client / MSE-EME player
Apache License 2.0
7.05k stars 1.33k forks source link

User hooks for HLS Parser plugin #1983

Closed anuragkalia closed 5 months ago

anuragkalia commented 5 years ago

Right now, the interface provided by shaka player smooths over HLS and DASH differences using manifest parser plugins. But what we want is event hooks into that parsing process itself. We have some SCTE-35 ad markers in the HLS stream which we want to read as soon as they are parsed. They look like these:

EXT-X-CUE-OUT:201.467

EXT-X-CUE-IN

Right now, there is no clean way to do it other than re-writing the HLS manifest parser itself. What is the closest approximation to achieve what I want as it stands? Is it possible to have some manifest parser events that an outside user can use?

joeyparrish commented 5 years ago

Yes, definitely possible. We just need to discuss your requirements and work on the design.

As an example, the DASH manifest parser has a configurable callback for extracting information from custom <ContentProtection> elements. So it is definitely possible to offer hooks into the parsing process.

We're planning some cleanup and refactoring of the HLS parser, so we can work this into the plan.

Would a callback for SCTE-35 data work? Do you just need access to it the tags? Do you need to return something that would influence the parsed manifest somehow?

anuragkalia commented 5 years ago

Thanks for the quick response!

Do you just need access to it the tags?

Yes. That is the most suitable. A callback when the fragment is parsed, along with the stream id to differentiate from parsed fragments of other streams, should work best.

Let me also take a look at the DASH parser that you mentioned. Where can I see the refactoring plans of HLS parser? I observed that HLS parser was needlessly downloading segments of all the streams rather than the currently active one, so I hope that is also one of the design goals.

joeyparrish commented 5 years ago

We don't have a published plan for the HLS refactor at this time, but we are aware that our fetching of segment headers to extract start times is not great. It's high latency, and could be avoided in many cases, and it's something we hope to improve soon.

thecuriousdev commented 5 years ago

This will add a lot of flexibility. I am also facing a similar issue, needs to access the tags. I'm glad that this is being considered and happy to contribute as well. What is your recommendation to achieve this with the current limitations?

ismena commented 5 years ago

@joeyparrish Joey, could you either schedule this for the team or discuss the pull request design with the interested contributors!

Thanks <3

derekdowling commented 3 years ago

I have filed an issue with a similar use case in mind: https://github.com/google/shaka-player/issues/3523.

avelad commented 5 months ago

Duplicate of https://github.com/shaka-project/shaka-player/issues/3523