狗尾草

导航

< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

统计

(ios)MPMoviePlayerController首次播放视频的时候,没有控制条

问题:

      在视频播放时,现在控制条采用磨砂的效果,会遮罩部分视频

解决思路

1 播放器直接设置不带控制条,在app在 Foreground状态,默认播放器暂停,这样需要在获得Foreground事件,进行设置播放

- (void) viewWillAppear:(BOOL)animated{  

    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(appWillEnterForegroundNotification) name:UIApplicationWillEnterForegroundNotification object:nil];  

}  

- (void) appWillEnterForegroundNotification{  

    NSLog(@"trigger event when will enter foreground.");  

}  

-(void) viewDidDisappear:(BOOL)animated{  

    [[NSNotificationCenter defaultCenter] removeObserver:self];      

}  

2 直接侦听播放器准备播放通知,在通知中设置播放器带控制条

  [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(moviePlayBackDidFinish:)

                                                     name:MPMoviePlayerReadyForDisplayDidChangeNotification

                                                   object:player];

 

- (void) moviePlayBackDidFinish:(NSNotification*)notification

{

    player.controlStyle =MPMovieControlStyleEmbedded;

    [[NSNotificationCenter defaultCenter]removeObserver:self name:MPMoviePlayerReadyForDisplayDidChangeNotification object:player];

    

}

posted on   狗尾草-大数据收割基  阅读(1750)  评论(0编辑  收藏  举报

编辑推荐:
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
阅读排行:
· 物流快递公司核心技术能力-地址解析分单基础技术分享
· .NET 10首个预览版发布:重大改进与新特性概览!
· AI与.NET技术实操系列(二):开始使用ML.NET
· 单线程的Redis速度为什么快?
· 展开说说关于C#中ORM框架的用法!
历史上的今天:
2010-04-26 底层逻辑层发起,数据流向上一级逻辑层 的几种方式
点击右上角即可分享
微信分享提示