Hi, does anybody know how to get the correct duration of a stream/video while downloading it with libRTMP? RTMPDump always shows the correct duration, but I don't understand C.
Currently I'm counting the elapsed seconds and in the beginning the counted duration matches the real duration of the stream/video, but after a while it gets 'out of sync'. For example, my application shows 00:45:38, while the real duration of the stream/video being downloaded is 00:45:21.
As far as I could find, RTMP_GetDuration only returns the duration from onMetaData and returns '0' in this case.
Code:
Do Until LibRTMP.RTMP_IsTimedout(r)
bytes_read = LibRTMP.RTMP_Read(r, b, b.Length)
If (bytes_read = 0) Then Exit Do
FS.Write(b, 0, bytes_read)
ElapsedTime = Duration.Elapsed.TotalSeconds
Loop