From 98b455f72c43dee9474dbe8256d162ef3aaf0312 Mon Sep 17 00:00:00 2001 From: AIMembers Date: Fri, 14 Jun 2013 18:01:06 +0300 Subject: [PATCH] Update VideoPlayerImpliOS.m add notification to know when app will become active when app goes in background player will change state to paused... this method will resume it if will need.... P.S. sorry for my english :) --- Classes/VideoPlayer/iOS/VideoPlayerImpliOS.m | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/Classes/VideoPlayer/iOS/VideoPlayerImpliOS.m b/Classes/VideoPlayer/iOS/VideoPlayerImpliOS.m index 71550d4..0e07723 100644 --- a/Classes/VideoPlayer/iOS/VideoPlayerImpliOS.m +++ b/Classes/VideoPlayer/iOS/VideoPlayerImpliOS.m @@ -24,10 +24,26 @@ - (id) init if ( (self = [super init]) ) { _theMovie = nil; + + // add notification to know when app will become active when app goes in background player will change state to paused... + [[NSNotificationCenter defaultCenter] addObserver:self + selector:@selector(appDidBecomeActive:) + name:UIApplicationDidBecomeActiveNotification + object:nil]; + } return self; } +//this method will resume it if will need.... +-(void)appDidBecomeActive:(NSNotification *)notification { + if (_theMovie != nil && self.isPlaying) { + if (_theMovie.playbackState == MPMoviePlaybackStatePaused) { + [_theMovie play]; + } + } +} + //----- playMovieAtURL: ------ -(void)playMovieAtURL:(NSURL*)theURL {