Hi,
I am following VideoPlayback sample in Xcode. I almost developed my app is to just play videos on different marker and these video are also coming from webservice. Now I am stuck in just one problem is that when video is playing on marker at that time if pressed home button and apps goes in background and after when app resum it stuck on Splash screen, app working fine when no video is playing and it resume normally. When video is not playing then every function gets call successfully on app delegate but when video playing then No function call after going background like "applicationDidBecomeActive" and "applicationWillEnterForeground" it only stuck in splash screen and crash. I check device log it show me error "failed to resume in time".
Following What I am doing in Resign Active and become active function.
- (void)applicationDidBecomeActive:(UIApplication *)application
{
NSLog(@"applicationDidBecomeActive");
if (firstTime == NO)
{
[arParentViewController viewDidAppear:NO];
}
else {
[self setupInfoScreen];
// Start playback from the current position on the first run of the app
for (int i = 0; i < NUM_VIDEO_TARGETS; ++i) {
videoPlaybackTime[i] = VIDEO_PLAYBACK_CURRENT_POSITION;
}
}
// Load the video for use with the EAGLView
EAGLView* arView = [arParentViewController getARView];
#ifdef EXAMPLE_CODE_REMOTE_FILE
// Load a remote file for playback
for (int i = 0; i < NUM_VIDEO_TARGETS; ++i) {
VideoPlayerHelper* player = [arView getVideoPlayerHelper:i];
[player load:@"http://<SOME_URL>" playImmediately:NO fromPosition:VIDEO_PLAYBACK_CURRENT_POSITION];
}
#else
// For each video-augmented target
for (int i = 0; i < NUM_VIDEO_TARGETS; ++i) {
VideoPlayerHelper* player = [arView getVideoPlayerHelper:i];
NSString* filename;
switch (i) {
case 0:
filename = @"Alan!.mp4";
break;
}
if (NO == [player load:filename playImmediately:NO fromPosition:videoPlaybackTime[i]]) {
NSLog(@"Failed to load media");
}
}
#endif
firstTime = NO;
}
- (void)applicationWillResignActive:(UIApplication *)application
{
// Remove the native movie player view (if it is displayed). This gives us
// a clean restart on iOS 4 and 5
NSLog(@"applicationWillResignActive");
[arParentViewController removeMoviePlayerView];
EAGLView* arView = [arParentViewController getARView];
for (int i = 0; i < NUM_VIDEO_TARGETS; ++i) {
VideoPlayerHelper* player = [arView getVideoPlayerHelper:i];
// If the video is playing, pause it and store the index of the player
// so playback can be resumed
if (PLAYING == [player getStatus]) {
[player pause];
NSLog(@"Player has been paused");
}
// the player is currently paused)
videoPlaybackTime[i] = [player getCurrentPosition];
// Unload the video
if (NO == [player unload]) {
NSLog(@"Failed to unload media");
}
}
// do the same as when the view has dissappeared
[arParentViewController viewDidDisappear:NO];
// Remove the info screen (if it's displayed)
[infoView removeFromSuperview];
}
App stuck in splash screen reload from background
Hi Aleem,
Can I just check that if you are using a web service then the Video is playing full screen, as it's from a URL right?
I have tried the video playback sample on iOS5 and iOS6 to try and reproduce by forcing the app to play fullscreen.