gpt4 book ai didi

ios - 如何在我的 MPMoviePlayerController 实例中添加音量控制

转载 作者:行者123 更新时间:2023-11-29 02:56:27 24 4
gpt4 key购买 nike

下面是在按下按钮时打开视频的代码。一切都很好,但我想为我的视频播放器添加音量控制。 MPMoviePlayerController 是否有我可以启用的默认功能,或者我是否必须使用对象库中的 slider ,拖放它,然后根据 slider 值调整音量?

NSString *url = [[NSBundle mainBundle] pathForResource:@"space-time" ofType:@"mp4"];


moviePlayer= [[MPMoviePlayerController alloc] initWithContentURL:[NSURL fileURLWithPath:url]];
[self.view addSubview:moviePlayer.view];

moviePlayer.fullscreen = YES;


[moviePlayer play];

最佳答案

添加体积 View 使用此代码在你的 viewcontroller 中制作一个 uiview 大约 200width x 30height,在那之后放下那个 View (view1)的 socket

MPVolumeView *volumeView = [[MPVolumeView alloc] initWithFrame:self.view1.bounds] ;
[self.view1 addSubview:volumeView];

音量 slider 将显示在该 View 中1

关于ios - 如何在我的 MPMoviePlayerController 实例中添加音量控制,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23844601/

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