Skip to content

[Update] Expose EXT-X-PROGRAMMING-DATE-TIME / currentPlaybackTime #4546

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

abir701
Copy link

@abir701 abir701 commented May 12, 2025

  • Pass the EXT-X-PROGRAMMING-Date

Summary

We are currently working on live streaming using an HLS playlist, and to display the time correctly alongside the video player, we need the #EXT-X-PROGRAM-DATE-TIME, which corresponds to the currentPlaybackTime in the player.

Currently, the OnProgressData type does not expose this value, and we're unable to access it via the onProgress callback. To enable accurate timestamp overlays and real-time data alignment, we are requesting to include currentPlaybackTime in the OnProgressData.


Motivation

In live video streaming — particularly in surveillance, news, and real-time dashboards — displaying accurate timestamps is essential. The HLS playlist provides the #EXT-X-PROGRAM-DATE-TIME tag, which maps to the wall-clock time of the segment being played.

By exposing currentPlaybackTime (which aligns with EXT-X-PROGRAM-DATE-TIME) in the onProgress event, developers will be able to:

  • Overlay synchronized timestamps on live video.
  • Sync external data logs or events with media playback.
  • Improve UX for forensic or audit-related video playback.
  • Avoid using external timer independently

Changes

We propose the following enhancement to the OnProgressData type:

export type OnProgressData = Readonly<{
  currentTime: number;
  playableDuration: number;
  seekableDuration: number;
  currentPlaybackTime: number; // Corresponds to EXT-X-PROGRAM-DATE-TIME
}>;

 - Pass the EXT-X-PROGRAMMING-Date
@abir701
Copy link
Author

abir701 commented May 13, 2025

Hi React Native Video community,

We are currently working on live streaming using an HLS playlist, and to display the time correctly alongside the player frame, we need the #EXT-X-PROGRAM-DATE-TIME, which corresponds to the currentPlaybackTime in the player.

Currently, inside the OnProgressData type, we are unable to receive the currentPlaybackTime, but we need it to display the time properly. Would it be possible to include this in a future release? Or, if there's a way to access this value in the current version, could you please advise?
Change needed:

export type OnProgressData = Readonly<{
  currentTime: Float;
  playableDuration: Float;
  seekableDuration: Float;
  currentPlaybackTime: number; // To get EXT-X-PLAYBACK-DATE-TIME
}>;

Thanks for your help!

Best regards,
ABIR

@abir701 abir701 changed the title [Update] Expose PDT to get actual date/time [Update] Expose EXT-X-PROGRAMMING-DATE-TIME / currentPlaybackTime to get actual date/time May 13, 2025
@abir701 abir701 changed the title [Update] Expose EXT-X-PROGRAMMING-DATE-TIME / currentPlaybackTime to get actual date/time [Update] Expose EXT-X-PROGRAMMING-DATE-TIME / currentPlaybackTime May 13, 2025
@KrzysztofMoch
Copy link
Collaborator

Hey, I see that you have changed types but are you going to implement logic behind it?

@abir701
Copy link
Author

abir701 commented May 26, 2025

Hi @KrzysztofMoch Thank you for the response.
I think we are passing the value already only thing is we are not receiving it. I have tested it with an older version. React-native-video 5.x; there also I found the similar kind of implementation. And after changing the types, we are getting the value.

`
func sendProgressUpdate(didEnd: Bool = false){
let currentPlaybackTime = _player?.currentItem?.currentDate()`
 onVideoProgress?([
                "currentTime": currentTimeSecs,
                "playableDuration": RCTVideoUtils.calculatePlayableDuration(_player, withSource: _source),
                "atValue": currentTime?.value ?? .zero,
                "currentPlaybackTime": NSNumber(value: Double(currentPlaybackTime?.timeIntervalSince1970 ?? 0 * 1000)).int64Value,
                "target": reactTag as Any,
                "seekableDuration": RCTVideoUtils.calculateSeekableDuration(_player),
            ])
 }

You can check this method in RCTVideo.swift in iOS.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: To Triage
Development

Successfully merging this pull request may close these issues.

2 participants