开发者

MPMoviePlayerController Custom Control

开发者 https://www.devze.com 2022-12-10 22:19 出处:网络
Can We make Custom control like the default Slider in MPMoviePlayerControll开发者_运维知识库er

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

精彩评论

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

关注公众号