iOS Mirroring MPMoviePlayerController to TV with TV screen playback in fullscreen

浪子不回头ぞ 提交于 2019-12-05 06:55:34

问题


I have an App with video (locally stored) playback using MPMoviePlayerController

    NSString *deviceDir = [[NSUserDefaults standardUserDefaults] stringForKey:WZLDEVICEPATH];
NSString *videopath = [deviceDir stringByAppendingPathComponent:video]
NSURL *url = [NSURL fileURLWithPath:videopath];
player = [[MPMoviePlayerController alloc] initWithContentURL:url];
CGRect viewInsetRect = CGRectInset (playerframe,
                                            0.0,
                                            0.0 );
        /* Inset the movie frame in the parent view frame. */
[[player view] setFrame:viewInsetRect];
[player view].backgroundColor = [UIColor clearColor];
[player view].tag = TAG_VIDEO_PLAYER;
player.movieSourceType = MPMovieSourceTypeFile;
[player prepareToPlay];
[self.view addSubview: [player view]];

Now I need to mirror the App to an external device, the mirroring just works fine to the second screen (TV), but the TV playback is in the same resolution(width x height) as it is in the iPad, I have to make the TV playback in fullscreen. Is there any way to make sync playback in two devices at different resolution.

I have tried for the multiple window with different instance of MPMoviePlayerController but there the sync playback is getting affected. Is there some work around to overcome these issues?


回答1:


[secondScreen  setOverscanCompensation: UIScreenOverscanCompensationInsetApplicationFrame];

With the above settings videos in 16:9 resolution starts playing by filling the whole screen & 4:3 videos with black bars on top & bottom which is ok, as we know to keep the aspect ratio it need to be there.

Note I have also noticed when we use iPad Mini the older behaviour still keep on coming.



来源:https://stackoverflow.com/questions/31109542/ios-mirroring-mpmovieplayercontroller-to-tv-with-tv-screen-playback-in-fullscree

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