View in English

  • 打开菜单 关闭菜单
  • Apple Developer
搜索
关闭搜索
  • Apple Developer
  • 新闻
  • 探索
  • 设计
  • 开发
  • 分发
  • 支持
  • 账户
在“”范围内搜索。

快捷链接

5 快捷链接

视频

打开菜单 关闭菜单
  • 专题
  • 相关主题
  • 所有视频
  • 关于

返回 Tech Talks

大多数浏览器和
Developer App 均支持流媒体播放。

  • 简介
  • 转写文稿
  • AVDisplayManager 简介

    从 tvOS 11.2 开始,Apple TV 4K 能够自动切换视频显示模式,以与视频内容的原生帧速率和动态范围相匹配。借助 tvOS 11.3,Apple TV (第 4 代) 也能自动切换视频显示模式,以与原生帧速率相匹配。了解如何确保您的 app 和视频内容能够使用 AVDisplayManager 和 AVDisplayCriteria 来支持这项功能。

    资源

    • AVPlayerViewController
      • 高清视频
      • 标清视频

    相关视频

    Tech Talks

    • 制作 4K 和 HDR HLS 视频流

    WWDC17

    • HLS 创作更新
    • HTTP Live Streaming 改进
  • 搜索此视频…

    Starting with tvOS 11.2, Apple TV 4K can automatically switch video display modes to match the native frame rate and dynamic range of video content. The Video and Audio section of the Settings app allows the matching frame rate and dynamic range behavior to be set independently, and enables viewing of content it its original frame rate and dynamic range. By default, these options are disabled. When enabled, and video content is played back in a compatible app, tvOS will automatically switch the video display settings to match that of the content. For instance, if the content is in 24 frames per second and standard dynamic range, the device will switch from its system mode to 24 frame per second, standard dynamic range mode. Once the media playback session is over, the device will then switch back to its system mode.

    The first step in supporting frame rate matching for your content is to ensure that your HLS master playlists are fully annotated with the native frame rate of the variants using the FRAME-RATE attribute. If a playlist does not include the FRAME-RATE attribute, frame rate mode switching will not be supported for that asset. Furthermore, only playlists that declare either a single frame rate for all variants or only have frame rates that are integer multiples of the smallest frame rate are supported. For example, 29.97 and 59.94.

    Dynamic range mode matching does not typically require any changes to your playlists, as content is assumed to be SDR unless the VIDEO-RANGE attribute specifies otherwise, as all non-SDR content must include the VIDEO-RANGE attribute already.

    Apps that use AVPlayerViewController will automatically support mode matching, unless the appliesPreferred DisplayCriteriaAutomatically property is changed to false.

    When content is played back in full screen using AVPlayerViewController, tvOS will automatically switch to the appropriate display mode for that content. Then, when AVPlayerViewController leaves full-screen mode or is dismissed, tvOS will switch back to its system display mode.

    For apps that play back full-screen content using AVPlayerViewController or TVMLKit, no additional work is required. However, for other scenarios where your video might not always be played back in full screen, if you are playing multiple videos simultaneously, switching between different short videos frequently, or you aren't using AVPlayerViewController for your video playback, you may need to directly specify the AVDisplayManager preferredDisplayCriteria to ensure that the mode switch occurs at the right time and reflects the characteristics of the appropriate media content.

    If you are using AVPlayerViewController and wish to opt out of mode switching entirely or need to manage the display mode manually, begin by setting the appliesPreferredDisplay CriteriaAutomatically property of AVPlayerViewController to false. This will disable the automatic AVKit matching behavior. Then, to trigger tvOS to switch modes to match a specific piece of content, retrieve the AVDisplayCriteria object vended by the preferredDisplayCriteria property of the AVAsset. Assign that AVDisplayCriteria object to the preferredDisplayCriteria property of the AVDisplayManager vended by the key UIWindow. The mode switch will occur upon setting this property, assuming that matching was enabled in settings and that the attached device supports the preferred mode. You should perform this switch before assigning the AVPlayerItem to the AVPlayer object so that AVPlayer configures itself based on the targeted display mode.

    To switch back to the system's default mode, simply set the preferredDisplayCriteria property to nil.

    To know when the mode switch begins and ends, you can key-value observe the displayModeSwitchInProgress property of the AVDisplayManager object. To help you determine the best way to make use of this new feature in your media application, here are some guidelines to keep in mind: Switch modes only as often as necessary. All televisions respond to mode switching a little differently, but it will generally cause the screen to flash or temporarily black out, and may take a few seconds to complete. This can be disruptive if it occurs more often than necessary. Typically, mode switching is only appropriate for full-screen playback. Matching frame rate and dynamic range for content that plays in the background, as a thumbnail, or as an interstitial as part of a game, can be quite disruptive and is generally unnecessary. The primary user interface of your app, outside of the video viewing experience, should be run in the system's frame rate so that UI and animations are smooth and fluid. When the television is in a lower frame rate mode, those animations and movements will also render at that frame rate, and may appear less smooth as a result.

    There are also several circumstances where leaving the device in its system mode will yield an improved user experience. If your app plays shorter clips, displays multiple video tiles simultaneously, or frequently switches between content with disparate characteristics, it would be preferred to avoid mode switching entirely to ensure the viewing experience is not disrupted unnecessarily.

    tvOS 11.2 enables video content frame rate and dynamic range matching on Apple TV 4K. AVPlayerViewController can manage this behavior automatically, but some apps will want more control by utilizing AVDisplayManager and AVDisplayCriteria.

    Please visit developer.apple.com for more information.

Developer Footer

  • 视频
  • Tech Talks
  • AVDisplayManager 简介
  • 打开菜单 关闭菜单
    • iOS
    • iPadOS
    • macOS
    • Apple tvOS
    • visionOS
    • watchOS
    打开菜单 关闭菜单
    • Swift
    • SwiftUI
    • Swift Playground
    • TestFlight
    • Xcode
    • Xcode Cloud
    • SF Symbols
    打开菜单 关闭菜单
    • 辅助功能
    • 配件
    • App 扩展
    • App Store
    • 音频与视频 (英文)
    • 增强现实
    • 设计
    • 分发
    • 教育
    • 字体 (英文)
    • 游戏
    • 健康与健身
    • App 内购买项目
    • 本地化
    • 地图与位置
    • 机器学习
    • 开源资源 (英文)
    • 安全性
    • Safari 浏览器与网页 (英文)
    打开菜单 关闭菜单
    • 完整文档 (英文)
    • 部分主题文档 (简体中文)
    • 教程
    • 下载 (英文)
    • 论坛 (英文)
    • 视频
    打开菜单 关闭菜单
    • 支持文档
    • 联系我们
    • 错误报告
    • 系统状态 (英文)
    打开菜单 关闭菜单
    • Apple 开发者
    • App Store Connect
    • 证书、标识符和描述文件 (英文)
    • 反馈助理
    打开菜单 关闭菜单
    • Apple Developer Program
    • Apple Developer Enterprise Program
    • App Store Small Business Program
    • MFi Program (英文)
    • News Partner Program (英文)
    • Video Partner Program (英文)
    • 安全赏金计划 (英文)
    • Security Research Device Program (英文)
    打开菜单 关闭菜单
    • 与 Apple 会面交流
    • Apple Developer Center
    • App Store 大奖 (英文)
    • Apple 设计大奖
    • Apple Developer Academies (英文)
    • WWDC
    获取 Apple Developer App。
    版权所有 © 2025 Apple Inc. 保留所有权利。
    使用条款 隐私政策 协议和准则