#pragma mark Notification
- (void)addNotification
{
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(beginPlayVideo:)
name:UIWindowDidBecomeVisibleNotification
object:self.view.window];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(endPlayVideo:)
name:UIWindowDidBecomeHiddenNotification
object:self.view.window];
}
- (void)removeNotification
{
[[NSNotificationCenter defaultCenter] removeObserver:self
name:UIWindowDidBecomeVisibleNotification
object:nil];
[[NSNotificationCenter defaultCenter] removeObserver:self
name:UIWindowDidBecomeHiddenNotification
object:nil];
}
-(void)beginPlayVideo:(NSNotification *)notification{
//如果是alertview或者actionsheet的话也会执行到这里,所以要判断一下
if ([[UIApplication sharedApplication].keyWindow isMemberOfClass:[UIWindow class]]){
[playButton removeFromSuperview];
}
}
-(void)endPlayVideo:(NSNotification *)notification{
NSLog(@"结束");
}
监听webview视频播放、结束
©著作权归作者所有,转载或内容合作请联系作者
- 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
- 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
- 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
推荐阅读更多精彩内容
- WebView加载视频的网页时,点击视频播放,然后退出,视频还在播放,未能及时结束。 在项目中遇到此问题,在此记录...
- onPageStateChange这个监听事件。可以判断微信小程序是否在前台。通过监听判断音视频播放或者暂停 小程...
- (1)HTML页面视频标签大体如下 (2)视频加载后获取视频的长度 varelevideo = document....
- /** * 播放动画的主类 */ @SuppressLint("AppCompatCustomView") pub...