Display the duration of the video

You can display the duration of the currently active content.

Implement a video-duration display using the following sample code:

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

  • For VOD, this range is the entire VOD content range, including ads.
  • For live/linear, this range represents the seekable window.

For more information about the API, see TVSDK 3.4 for iOS API Reference

CMTimeRange seekableRange = self.player.seekableRange;
if (CMTIMERANGE_IS_VALID(seekableRange)) {
    double start = CMTimeGetSeconds(seekableRange.start);
    double duration = CMTimeGetSeconds(seekableRange.duration);
}

On this page