Hls.js: Parsing HLS manifest of live stream on IOS

Created on 2 Apr 2018  路  8Comments  路  Source: video-dev/hls.js

I know it's probably not the right place to raise this question, but I have a live event coming up and I guess since all the streaming masters are here, this is the quickest place I can get an answer.

My goal is to get the PDT or any other metadata from a live stream manifest on a device without support for MSE.

My current setup on desktop browsers: I use Hls.js, and listen to "Hls.Events.FRAG_CHANGED" event, from the event I can get the "rawProgramDateTime" or the "pdt" of a fragment.

Because IOS natively support hls streaming, and does not support MSE, I can't use Hls.js and all of the stream logic becomes obfuscated to me.

Is there any way I can't do this on IOS?

Wontfix

Most helpful comment

Hi dokydok, I am exactly in your situation. Did you find a way to read ID3 data in safari on IOS device. Any pointer will help.

All 8 comments

@dokydok AFAIK safari won鈥檛 expose this data.
What you can do is add timed metadata as ID3 tags and read it through the texttrack API.
You will need to add this data somehow in your encoder.

Thanks, but I don't have access to the encoder, is there any other way to do this?

@dokydok I suppose you could manually download the manifests and parse out the EXT-X-DATETIME tag yourself. But you'd have to manage the download timer. The spec says you should attempt a download on an interval based on the segment length. Here's our implementation: https://github.com/video-dev/hls.js/blob/master/src/controller/level-controller.js#L357-L374

That is what I'm doing now, this raises 2 questions:

  1. how do I know which segment am I currently playing (n, n-1, n-2...)?
  2. how do I get second accurate within a segment?
    Let's say the segment duration is 8 seconds, when I parse that segments, and get it's PDT,
    I can already be off by up to 8 secondes.

BTW, thanks for the help and for not kicking me to Stackoverflow.. :)

how do I know which segment am I currently playing (n, n-1, n-2...)?

I can't say off the top of my head, but I'd imagine it'd be very difficult to get 1 second accuracy. Safari won't tell you what segment it's downloading, and you can't always assume things are running in sequential order.

Tricky given the limited native video API. It's a moving target with live. You won't know how the current time or buffer map to whatever the internal playlist state may be.

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Hi dokydok, I am exactly in your situation. Did you find a way to read ID3 data in safari on IOS device. Any pointer will help.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

GeorgySerga picture GeorgySerga  路  3Comments

phillydogg28 picture phillydogg28  路  4Comments

neuman picture neuman  路  4Comments

ronag picture ronag  路  4Comments

shalommeoded picture shalommeoded  路  3Comments