Search code examples
avplayertvos

Apple TV - AVPlayer - Duration on video player option menu when playing live stream video


  • I'm implementing to play a live stream video (hls) on Apple TV project but not sure why the video duration displays on video player option menu.
    • As my understanding, the live video should not have duration, right? If yes then how to fix this issue or is there any way to hide or override this information.

Please see the attached screenshot below for the more detail. Thanks!!

Screenshot


Solution

  • The duration value is automatically inferred from the stream. Sadly, this inference fails with live streams and it fills the duration field with the duration of the available sliding window of the stream.

    I reported this radar more than one year ago and still no news:

    As an alternative, from tvOS 11, you can use customInfoViewController to create a custom view controller to display the stream metadata instead of using the buggy Info tab provided by Apple.

    You can get a more elaborated explanation from the minute 24:00 of the following WWDC Video:

    Implementing a custom view controller would be straight forward making use of the following two open source controls:

    Note: AVPlayerViewController is quite buggy when playing live streams. Good luck !