Skip to main content

Live Epoch time

Application needs to get playback position according to Unix Epoch time sometimes for live streams. The application can calculate current live EPOCH position by getting a timeline object from OTVVideoView instance. The timeline object contains the value of live window start time since Epoch.

JAVA
private long getLiveCurrentEpochTime() {
  long currentTimeMs = 0;
  OTVTimeline timeline = mOTVVideoView.getCurrentTimeline();
  if (timeline != null) {
    if (timeline.getWindowCount() == 1) {
      OTVTimeline.OTVWindow window = new OTVTimeline.OTVWindow();
      timeline.getWindow(0, window);
      currentTimeMs = mOTVVideoView.getCurrentPosition() + window.windowStartTimeMs;
    } 
  }
  return currentTimeMs;
}
JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.