0

我们一直在为基于 AVPlayer 的视频播放器添加字幕支持。我们可以从 [self.player.currentItem.asset mediaSelectionGroupForMediaCharacteristic:AVMediaCharacteristicLegible] 生成的 AVMediaSelectionGroup 中检索 mediaType "sbtl" 的 AVMediaSelectionOption 对象,并且可以选择适当的 AVMediaSelectionOption 来在我们的直播流中显示字幕。这一切都很好。

我们遇到问题的地方是在 iOS 5.01 和 iOS 5.1 上取消选择 AVMediaSelectionOption。

在运行 iOS 6 的设备上,我们可以使用 [self.player.currentItem selectMediaOption:nil inMediaSelectionGroup:self.subtitleSelectionGroup] 禁用字幕,它们会按预期消失。但在 iOS 5.01 和 iOS 5.1 上,字幕停止更新,但最后显示的文本仍保留在视频播放器上,直到播放器关闭、按下电源按钮或应用程序移至后台。

我们尝试过滤掉强制字幕,认为这可能是问题所在,但无济于事。这是操作系统中的错误吗?我们的流媒体视频有问题吗?

感谢您提供的任何帮助和指导。

4

1 回答 1

1

Not sure if this helps in iOS5 but in my video stream i have an option for subtitles and an option for forced subtitles for each language. I i change to the forced subtitle option it wont show any subtitle (only if you have forced ones). So if you make your videos like this and have that forced subtitle with not subtitles at all you can select the forced subtitles to make the trick in iOS5.

Here is a print object of how my selection group option array looks like:

<__NSArrayM 0x2006d590>(
    <AVMediaSelectionTrackOption: 0x200297a0, mediaType = sbtl, locale = en, title = (null), option ID = 3, associated forced-only option = <AVMediaSelectionTrackOption: 0x2006d600>>,
    <AVMediaSelectionTrackOption: 0x2006d600, mediaType = sbtl, locale = en, title = (null), option ID = 3, default = YES, forced subtitles only>,
    <AVMediaSelectionTrackOption: 0x20057210, mediaType = sbtl, locale = zh, title = (null), option ID = 4, associated forced-only option = <AVMediaSelectionTrackOption: 0x20044bc0>>,
    <AVMediaSelectionTrackOption: 0x20044bc0, mediaType = sbtl, locale = zh, title = (null), option ID = 4, forced subtitles only>,
    <AVMediaSelectionTrackOption: 0x2002d450, mediaType = sbtl, locale = ce, title = (null), option ID = 5, associated forced-only option = <AVMediaSelectionTrackOption: 0x20028660>>,
    <AVMediaSelectionTrackOption: 0x20028660, mediaType = sbtl, locale = ce, title = (null), option ID = 5, forced subtitles only>
    )

Hope this can be of any use for you because there is not much info available for this subject.

于 2013-02-15T12:42:58.903 回答