Bug 6033 - Video Software, Background Thread
Summary: Video Software, Background Thread
Status: RESOLVED FIXED
Alias: None
Product: iOS
Classification: Xamarin
Component: General ()
Version: 5.3.x
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2012-07-07 17:07 UTC by Joseph Anderson
Modified: 2012-07-07 17:45 UTC (History)
1 user (show)

Tags:
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED FIXED

Description Joseph Anderson 2012-07-07 17:07:02 UTC
I have an issue with Video recordings and MonoTouch. 

If I record the screen, exit, press home, return to the app and record, the camera never opens. It seems that running the application in a background thread causes an unknown error. 

I have used two separate apps and I see the same issue:

http://monotouch.info/Reinforce-lab-MonoTouch_VideoCapturingHowTo

https://github.com/GoranHalvarsson/BarcodeReader-MonoTouch 

Here are more details on the ticket:

http://stackoverflow.com/questions/11332855/monotouch-zxing-camera-wont-open 

Do I have a coding error?

If I go to AppDelegate > DidEnterBackground and enter this code, I can get my video camera to appear:

		public override void DidEnterBackground (UIApplication application)
		{
			CameraViewController CameraPicker = new CameraViewController();
			CameraPicker.Initialize();
			application.Windows[0].RootViewController = CameraPicker;
		}
Comment 1 Joseph Anderson 2012-07-07 17:26:18 UTC
Hi,

I also get this error:

MonoTouch.Foundation.MonoTouchException: Objective-C exception thrown.  Name: NSGenericException Reason: Cannot call UICreateScreenImage() while app is in the background.
  at MonoTouch.CoreGraphics.CGImage.get_ScreenImage () [0x00000] in /Developer/MonoTouch/Source/monotouch/src/shared/CoreGraphics/CGImage.cs:206
  at com.ReinforceLab.MonoTouch.Controls.VideoCaptureSample.OverLayView.worker () [0x00000] in /Users/josephanderson/Projects/Commercial/Vulcan/Luggage/jmaweb_vlug/Luggage/Code/OverLayView.cs:73
  at com.ReinforceLab.MonoTouch.Controls.VideoCaptureSample.OverLayView.<StartWorker>m__6 () [0x00000] in /Users/josephanderson/Projects/Commercial/Vulcan/Luggage/jmaweb_vlug/Luggage/Code/OverLayView.cs:110
  at MonoTouch.Foundation.NSActionDispatcher.Apply () [0x00000] in /Developer/MonoTouch/Source/monotouch/src/shared/Foundation/NSAction.cs:50
  at MonoTouch.UIKit.UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName) [0x0004c] in /Developer/MonoTouch/Source/monotouch/src/UIKit/UIApplication.cs:38
  at Luggage.Application.Main (System.String[] args) [0x00000] in /Users/josephanderson/Projects/Commercial/Vulcan/Luggage/jmaweb_vlug/Luggage/Main.cs:17
Comment 2 Joseph Anderson 2012-07-07 17:45:29 UTC
I had to add this code to Info.plist:

http://maniacdev.com/2010/07/screw-multi-tasking-how-to-make-your-ios-4-apps-exit-for-real/

To App Delegate, I had to add this code:

		public override void OnResignActivation (UIApplication application)
		{
			UIApplication.SharedApplication.PerformSelector(new Selector("terminateWithSuccess"), null, 0f);
		}