开发者

How to draw text on video to show subtitle on iOS?

开发者 https://www.devze.com 2023-03-17 06:26 出处:网络
How to s开发者_Python百科how subtitle above video with an overlay view on iOS?You can create an overlay view using UILabel to show subtitle as below

How to s开发者_Python百科how subtitle above video with an overlay view on iOS?


You can create an overlay view using UILabel to show subtitle as below

//Overlay View
UILabel *lblOverlayView = [[UILabel alloc] init];
lblOverlayView.frame = CGRectMake(0, 459, 320, 21);
lblOverlayView.backgroundColor = [UIColor yellowColor];
lblOverlayView.alpha = 0.3f;
lblOverlayView.text = @"Video Subtitle";

then you can add it as a subview to the view of MPMoviePlayerController to show a subtitle while playing the video.

[_mpMoviePlayerController.view addSubview:lblOverlayView];

here, _mpMoviePlayerController is an object of MPMoviePlayerController. Hope this will help you to fulfill the requirements.


Add a subview to the view showing the video and put it in front. This might help:

[myView bringSubviewToFront: subtitleView];
0

精彩评论

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

关注公众号