Skip to Content
Mux Docs: Home

Synchronize video playback

Learn how to synchronize video playback with other components on your webpage.

Introduction to video playback synchronization

You may have encountered many video streaming products and services enabling the following experiences:

  • Plan a watch party where each viewer is watching the video at the exact moment at the same time. And when one viewer pauses the video, the video playback pauses for every viewer at the same time at the exact moment.
  • Synchronize video playback with other components like chats, activity feeds, fitness stats collection, etc.

You can build similar and possibly many more interactive experiences like those mentioned above by aligning your web page or application components using a common source of truth, i.e., epoch time. The underlying assumption to achieve synchronization is that your viewer's device remains synced to an NTP server.

Mux records the epoch time of each frame received for the live stream and includes that timing information in the HLS Manifest as EXT-X-PROGRAM-DATE-TIME (aka PDT) tag. The PDT tag value is represented in ISO 8601 format. This tag is added every few seconds with monotonically increasing epoch time representing the next frame's recorded epoch time.

Below is an example of the HLS rendition (2nd level) manifest with repeating PDT tags for every 2s of the live stream recorded:


How to get epoch time value

Every modern video player exposes an API to get EXT-X-PROGRAM-DATE-TIME tag value. Your application can synchronize video playback to other components using this epoch time. An example demonstrating how to implement synchronization:

Supported Video Players

The list below shows the various video players providing API to get EXT-X-PROGRAM-DATE-TIME tag value. If your player isn't listed here, please reach out.

If your application wants to synchronize viewers playing videos on different devices, your application can subscribe to communication channels for receiving and sending epoch time values. Many cloud-based or other commercial products developed using WebSockets are available for implementing such a communication channel.

Add exclude_pdt parameter

By default, HLS playback using{PLAYBACK_ID}.m3u8 URL always adds EXT-X-PROGRAM-DATE-TIME tag with recorded epoch time value. If you add the exclude_pdt=true parameter to the playback URL, then Mux will exclude this tag from the HLS rendition manifest.

There are few reasons to exclude the HLS tag:

  • Video Player, like React Native, updates the current play position time value with the EXT-X-PROGRAM-DATE-TIME tag value. So if your application expects a zero-based play position time, the viewer could experience playback issues when the video player starts reporting epoch time instead.
  • Your application is using a legacy video player or a player version without support for this HLS tag.

Using signed URLs

Mux videos have two types of playback policy, public or signed. If your playback_id is signed, then all query parameters, including exclude_pdt need to be added to the claims body.

Take a look at the signed URLs guide for details.


Is the epoch time available with on-demand video?

Yes. Mux records epoch time for all live streams. So, the HLS manifest includes the epoch time every few seconds with the EXT-X-PROGRAM-DATE-TIME tag value when the live stream is active, or for the on-demand playback of the live stream recording.

The epoch time is not available in the HLS manifest when the input is a video file.

How about getting access to the epoch time using the API?

Yes. The asset resource objectAPI includes recording_times which represents the live stream start epoch time and the duration recorded. You can store the live stream timing information using therecording_times for managing the live stream's status information.

Was this page helpful?