gpt4 book ai didi

audio - 流音频时看不到MPMoviePlayerControls

转载 作者:行者123 更新时间:2023-12-03 02:08:55 25 4
gpt4 key购买 nike

我仅流音频时看不到MPMoviePlayerController控件,这正常吗?我只能看到黑屏,尽管正在播放音频,但是在另一 View 中播放视频时它可以工作。我希望这将允许我使用控件,这样我就不必使用AVPlayer构建自己的UI。

我的代码如下:

self.audioPlayer = [[MPMoviePlayerController alloc] init];
self.audioPlayer.movieSourceType = MPMovieSourceTypeStreaming;
[self.audioPlayer setContentURL:self.audioUrl];
[self.audioPlayer setControlStyle:MPMovieControlModeDefault];
self.audioPlayer.scalingMode = MPMovieScalingModeAspectFit;


[self.audioPlayer.view setFrame:self.view.bounds];

[self.view addSubview:self.audioPlayer.view];
[self.view bringSubviewToFront:self.audioPlayer.view];

[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(moviePlayBackDidFinish:)
name:MPMoviePlayerPlaybackDidFinishNotification
object:self.audioPlayer];

[self.audioPlayer prepareToPlay];
[self.audioPlayer play];

问候

最佳答案

最后,我使用UI构建了一个AVPlayer,而不是使用MPmovieplayer。

关于audio - 流音频时看不到MPMoviePlayerControls,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25866552/

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