Does AVPlayer support closed captions delivered in

2019-05-05 21:54发布

问题:

My team produces iOS apps that play video using AVPlayer. We've recently been told that we MUST allow display of closed captions for all videos... but that the closed captions would not be coming as a track within the video files (we already support closed captions that come in this way). Instead, we'll be getting them as a separate text file. I've seen a couple references to including the caption text file in the SMIL, but I've found nothing about how to incorporate this text file into the playback experience. Does anyone have any personal experience with this, or know of any online documentation/tutorials that would help?

回答1:

OK, we have a plan now, though it's a little complicated because DRM is involved. The simplified version is that we're going to do what's described in the What's New in HTTP Live Streaming talk from WWDC 2012 (https://developer.apple.com/videos/wwdc/2012/?id=512): namely, create a playlist that references our webvtt file(s), and then reference that playlist from the main m3u8. This will give us closed-captions-as-subtitles in iOS6.