Display the Duration of the Video

You can display the duration of the current active content.

Implement a video-duration display using the following sample code as a guide.

The PTMediaPlayer property, seekableRange, contains the current seekable window range:

  • For VOD, this range is the entire VOD content range, with ads included.
  • For live/linear, this range represents the seekable window.
CMTimeRange seekableRange = self.player.seekableRange; 
if (CMTIMERANGE_IS_VALID(seekableRange)) {
    double start = CMTimeGetSeconds(seekableRange.start); 
    double duration = CMTimeGetSeconds(seekableRange.duration);
}