开发者

Adding custom controls to a full screen movie

开发者 https://www.devze.com 2023-04-04 18:00 出处:网络
Is it possible to add custom controls to a movie playing in full-scre开发者_如何学运维en mode ( with MPMoviePlayerController )? I\'ve seen this in a few streaming apps, and I\'m curious how it is done

Is it possible to add custom controls to a movie playing in full-scre开发者_如何学运维en mode ( with MPMoviePlayerController )? I've seen this in a few streaming apps, and I'm curious how it is done.


You can turn off the standard controls of the player and create custom buttons that call play, pause etc on the player. If you set fullscreen to NO, you can make the players frame whatever you want (fullscreen) and layer your custom controls on top.

Something like:

MPMoviePlayerController *mp = [[MPMoviePlayerController alloc] init];
[mp setControlStyle:MPMovieControlStyleNone];
[mp setFullscreen:NO];
[[mp view] setFrame:CGRectMake(myX, myY, myWidth, myHeight)];

[myCustomController setMoviePlayer:mp];  // so controller can send control messages to mp

[myView addSubview:mp.view];
[myView addSubview:myCustomController.view];

or whatever...

0

精彩评论

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