简体   繁体   English

iOS AVPlayerViewController不会隐藏仅音频资产的播放控件

[英]iOS AVPlayerViewController does not hide playback controls for audio-only asset

I noticed that when I load a AVMutableComposition into AVPlayerViewController with only audio tracks, the playback controls does not auto hide. 我注意到,当我将AVMutableComposition加载到仅包含音轨的AVPlayerViewController中时,播放控件不会自动隐藏。

I would like it to have it auto hide the same way as when I load video compositions. 我希望它具有与加载视频作品时相同的方式自动隐藏。

Any Ideas? 有任何想法吗?

The best workaround that I've seen is to just add an empty video track. 我见过的最好的解决方法是只添加一个空的视频轨道。

// just a hack to get an empty video track
mediaTrack = [composition addMutableTrackWithMediaType:AVMediaTypeVideo
                               preferredTrackID:kCMPersistentTrackID_Invalid];

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM