I am trying to play a Rec2020 HLS video in my native iOS Swift App using AVPlayer. The API does not appear to handle colorspace information in the source similar to image API. With Images, it will automatically detect the colorspace ICC data and set the colrospace appropriately. For Video it will not. For a h.265 (or h.264) mp4 clip, I was able to set it manually with the code below. However, for HLS this does not work. I assume because the playeritem is the m3u8 index file. But I cannot find any way to detect the fragment mp4 files to insert the colorspace informaiton.
Anyone know how?
let playerItem = AVPlayerItem(url: videoUrl)
let colorAttributes = [AVVideoAllowWideColorKey:true,
AVVideoColorPropertiesKey: [AVVideoColorPrimariesKey: AVVideoColorPrimaries_ITU_R_2020,
AVVideoTransferFunctionKey: AVVideoTransferFunction_ITU_R_709_2,
AVVideoYCbCrMatrixKey: AVVideoYCbCrMatrix_ITU_R_2020]] as [String : Any]
let playerItemVideoOutput = AVPlayerItemVideoOutput(outputSettings: colorAttributes)
playerItem.add(playerItemVideoOutput)
And of another interest, the mp4 and HLS display fine on Safari on OS-X, but NOT on Safari on iOS. It displays correctly on VLC on all paltforms..
Thank you for any help!
Chris