gpt4 book ai didi

ios - AVAudioPlayer 和 AirPlay - 可能吗?

转载 作者:可可西里 更新时间:2023-11-01 04:49:00 25 4
gpt4 key购买 nike

我正在尝试确定是否可以使用 AVAudioPlayer 类切换 AirPlay 支持。

据我所读:

AirPlay is a technology that lets your application stream audio to Apple TV and to third-party AirPlay speakers and receivers. AirPlay support is built in to the AV Foundation framework and the Core Audio family of frameworks. Any audio content you play using these frameworks is automatically made eligible for AirPlay distribution. Once the user chooses to play your audio using AirPlay, it is routed automatically by the system. [ Ref ]

基于此信息;它应该与 AVAudioPlayer 一起工作,因为它是 AVFoundation 框架的一部分;但我似乎找不到任何支持这一假设的文件。

我还发现一些文档说可以使用 MPMoviePlayerViewController 来完成:

Support for playing video using AirPlay is included in the MPMoviePlayerController class. This support allows you to play video-based content on AirPlay–enabled hardware such as Apple TV. When the allowsAirPlay property of an active MPMoviePlayerController object is set to YES and the device is in range of AirPlay–enabled hardware, the movie player presents the user with a control for sending the video to that hardware. [ Ref ]

似乎这里有一些相互矛盾的信息。有谁知道是否可以使用 AVAudioPlayer 路由到 AirPlay,或者我们是否被迫使用 MPMoviePlayerController 类?

非常感谢。

最佳答案

回答我自己的问题。看起来简单的方法是添加此处提到的自定义音量 Controller :[ ref ],它将与 MPAudioPlayer 完美配合。这只是一个定位问题。

关于ios - AVAudioPlayer 和 AirPlay - 可能吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5892022/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com