如何更改视频播放速度

发布于 2024-10-15 02:44:17 字数 62 浏览 3 评论 0原文

我想知道是否可以在 iPhone 应用程序中更改视频播放速度。我们希望用户对着麦克风大喊以加快播放速度并结束。

I'm wondering if it's possible to change the video playback speed in an iphone application. we want users to yell in the microphone to speed up the playback and get to the end.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

世界等同你 2024-10-22 02:44:17

您必须使用 setCurrentPlaybackRate:

You have to use setCurrentPlaybackRate:

伴梦长久 2024-10-22 02:44:17

AVPlayer 有一个 rate 属性。

如果您采用 Apple 资源部分中名为“avPlayerDemo”的示例,则只需设置 mplayer.rate 即可。它对我有用,我在 xib 文件中创建了一个新滑块,在 AVPlayerDemoPlaybackViewController 中实现了该滑块,并将 mPlayer.rate 设置为滑块值。

There is a rate property for the AVPlayer.

If you take the example from Apple called "avPlayerDemo" in the resource section, you then simply have to set the mplayer.rate. It worked for me, I created a new slider in the xib files, implemented that slider in the AVPlayerDemoPlaybackViewController and simply set mPlayer.rate to the slider value.

留蓝 2024-10-22 02:44:17

MPMoviePlayerController 怎么样?

setCurrentPlaybackRate 

这是一些在该位置不起作用的代码

-(IBAction)abspielen:(id)sender 
{
    NSString *titleOfButton = [sender titleForState:UIControlStateNormal];
    NSBundle *bundle = [NSBundle mainBundle];
    NSString *moviePath = [bundle pathForResource:titleOfButton ofType:@"mov"];
    NSURL *movieURL = [ NSURL fileURLWithPath:moviePath];

    MPMoviePlayerController *themovie = [[MPMoviePlayerController alloc]initWithContentURL: movieURL];  
    [themovie play];
    [themovie setCurrentPlaybackRate:2.f];    
    [themovie release];

    MPMoviePlayerViewController *moviePlayer = [[MPMoviePlayerViewController alloc] initWithContentURL:movieURL];
    [self presentMoviePlayerViewControllerAnimated:moviePlayer];
    [moviePlayer release];              
}

What about the MPMoviePlayerController?

setCurrentPlaybackRate 

Here's some code which does not work at that spot

-(IBAction)abspielen:(id)sender 
{
    NSString *titleOfButton = [sender titleForState:UIControlStateNormal];
    NSBundle *bundle = [NSBundle mainBundle];
    NSString *moviePath = [bundle pathForResource:titleOfButton ofType:@"mov"];
    NSURL *movieURL = [ NSURL fileURLWithPath:moviePath];

    MPMoviePlayerController *themovie = [[MPMoviePlayerController alloc]initWithContentURL: movieURL];  
    [themovie play];
    [themovie setCurrentPlaybackRate:2.f];    
    [themovie release];

    MPMoviePlayerViewController *moviePlayer = [[MPMoviePlayerViewController alloc] initWithContentURL:movieURL];
    [self presentMoviePlayerViewControllerAnimated:moviePlayer];
    [moviePlayer release];              
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文