iPad: Crop the video and play cropped portion only

拜拜、爱过 提交于 2019-12-11 07:36:57

问题


Is it possible to crop the video by dimension and play only cropped portion programmatically? For an example, I have 100x100 full video but I want to play only (0,0) to (25,25) portion of this video. How could I do it?

Basically I am trying to implement something similar to matrix of iPads video available here.


回答1:


Number of options here - since you generally play video back in a view, you can attempt to use the standard UIView content scaling modes along with the specific movie scaling mode additions to MPMoviePlayerController to try and mask correctly. You can imagine how you could set the movie to MPMovieScalingModeFill, set the view's frame to double that of your video's dimensions, and then adjust the origin position accordingly.

Or you could mask it using other views, or even go quite low level and try something a little more complex (my approach above talks about MPMoviePlayerController, because it's the highest level and easiest way to play a video back. But there are other options that give you more control).



来源:https://stackoverflow.com/questions/8387756/ipad-crop-the-video-and-play-cropped-portion-only

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