I'm making an app which will play live video from TV channels. Some channels are in HEVC format and some in h.264. H.264 plays just fine, but HEVC won't. I tried both on real device (iPhone 6s and iPhone 8 with iOS 14) and on emulator (iPhone 8, 11, 12 with iOS 14). I read on the internet, that only iPhones 7 and up support HEVC, so it's no surprise, that it doesn't work on iphone 6s.
Live stream is provided with HLS over HTTPS. HEVC and h.264 plays in VLC (Media -> Open Network Stream) so it shouldn't be an issue with stream.
Since I can't provide url of stream (internal use only), I will provide screenshot from VLC.
This is what url looks like: https://domain.example.com/api/stream/some_token/10
And after connection is established it redirects to: http://1xx.xx.xx.xx:85/stream/some_token/stream.m3u8
I allowed HTTP in Info.plist (https://stackoverflow.com/a/32817873/4798218)
Working h.264 stream codec info
Not working HEVC stream codec info
Now the code with which I'm trying to make it work. I tried it in AVPlayerVideoController and also with VideoPlayer (from AVKit, ios14+) and none play HEVC.
import SwiftUI
import AVKit
struct SUIVideoPlayer: View {
private let player = AVPlayer(url: URL(string: "https://domain.example.com/api/stream/some_token/10")!)
var body: some View {
VideoPlayer(player: player)
.onAppear() {
player.play()
}
.onDisappear() {
player.pause()
}
}
}
I'm not getting any errors when trying to play HEVC or h.264 stream. One works, other one does not.