简体   繁体   English

AVPlayer当前正在iPhone中播放项目详细信息和音量控制吗?

[英]AVPlayer currently playing item details and volume control in iPhone?

I have tried AVPlayer for playing online http streamed music file, it works fine. 我已经尝试过AVPlayer来播放在线http流音乐文件,但效果很好。

What is the way to get the current playing audio track name,artist etc? 如何获得当前播放的音轨名称,艺术家等?
Is there any way to adjust the volume of AVPlayer while playing music (using UISlider )? 有什么方法可以在播放音乐时(使用UISlider )调节AVPlayer的音量?

您可以通过以下方式调节音量:

player.volume = slider.value;
MPMediaItem *currentItem = self.musicPlayer.nowPlayingItem;

//Display the artist, album, and song name for the now-playing media item.
//These are all UILabels.
self.songLabel.text   = [currentItem valueForProperty:MPMediaItemPropertyTitle];
self.artistLabel.text = [currentItem valueForProperty:MPMediaItemPropertyArtist];
self.albumLabel.text  = [currentItem valueForProperty:MPMediaItemPropertyAlbumTitle];

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

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