Playing video file with 1.5x, 2x speed

2019-05-01 11:49发布

问题:

I am an iOS developer who should make an app to play video with various speed. I think there is no API to change playback speed on MPMoviePlayerController.

And I couldn't find any solutions.

Can you please tell me how to implement it? or Can you please tell me any Framework/library(SDK) that support above functions for iOS?

回答1:

There actually is such property.

MPMoviePlayerController adheres to the MPMediaPlayback protocol

See

currentPlaybackRate

The current playback rate for the player. (required)

@property(nonatomic) float currentPlaybackRate

Discussion

This value represents a multiplier for the default playback rate of the current item. A value of 0.0 indicates that playback is stopped while a value of 1.0 indicates that playback is occurring at normal speed. Positive values indicate forward playback while negative values indicate reverse playback.

Setting the value of this property changes the playback rate accordingly.