Adding custom controls to a full screen movie

血红的双手。 提交于 2019-12-11 02:04:00

问题


Is it possible to add custom controls to a movie playing in full-screen mode ( with MPMoviePlayerController )? I've seen this in a few streaming apps, and I'm curious how it is done.


回答1:


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...



来源:https://stackoverflow.com/questions/7422807/adding-custom-controls-to-a-full-screen-movie

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!