This is a bit complicated issue.
I am hoping there is a someone has a suggestion, or maybe a solution for it.
I have been testing the timing for injecting
onTextData to the rtmp then use that as a trigger for
inject a custom header to hls playlist(chunklist) m3u8.
I have read/tried this article for creating the event trigger.
add function to create a custom header for m3u8 based on this article
It actually will inject the custom header to the ts chunk which contains the packet where I injected onTextData( call the sendDirect() event).
However, my challenge is that I want to add the custom header to the closer ts chunk , rather then the onTextData contained chunk.
let's say the ts chunk was segmented in 2s each(constant frame rate from publisher),
and the onTextData was called at 1.8s on that chunk,
it is more accurate to add custom header to the next ts chunk(+0.2s difference) rather than add the at the current ts chunk's begging (-1.8s difference).
is there a better way for doing this?