开发者

MPMoviePlayerController Custom Control

Can We make Custom control like the default Slider in MPMoviePlayerControll开发者_运维知识库er for forwarding and Backward the movie?


While you can't modify the MPMoviePlayerController class, you can create your own controls to manage movie playback. The way you do this is, you create a horizontal slider, you set it's minimum value to 0, and the maximum value to the duration property. Create a timer to update the slider's current value every second to the movie's currentPlaybackTime property, like so:

    sliderTimer = [NSTimer scheduledTimerWithTimeInterval:1.0 target:self selector:@selector(updateSlider) userInfo:nil repeats:YES];

and create an IBAction to interact with the slider, to seek a specific time, you will need to add a listener to your slider, like so:

    [seeker addTarget:self action:@selector(sliding:) forControlEvents:UIControlEventValueChanged];

If you want, you can even create labels that show the current and remaining times, but this is a little messy. Good luck.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜