ios zxing with front or rear camera - iphone

Im using ZXing, is working fine on my new app, but i would like to integrate the option of front or rear camera,
so far the only reference to this i've found is on the google group
But is not very clear what they mean with that,
so any pointers on what i have to do to accomplish this?
thanks !

ZXWidgetController doesn't provide that functionality and it's not really set up to make it easy to change.
The code that needs to change is in - (void)initCapture. It calls [AVCaptureDevice defaultDeviceWithMediaType:AVMediaTypeVideo]. This returns the default camera and you don't want the defalt.
You need code similar to that in - (ZXCaptureDevice*)device in ZXCapture.mm. That code won't work out of the box (it's designed to work with both AVFF and QTKit) but it's the same idea. Instead of using the default video input device, go through the devices and look at device position to find the device you want.
Be nice to port that code to the widget but that hasn't happened at this point.

Related

Struggling with Mobile build on phone, looking different on phone and Pc

Firstly I'm still fairly new to coding, saw people making games and fell in love with the idea of making your own game. So the past few months I've been learning unity tutorials and practicing basic games. I've come so far to be basically done with my first game. Everything is ready and I want to load and post it on playstore, but there's one last issue. When I run it on Unity on my pc it looks perfect but I loaded it onto my phone and the UI and some objects is either not showing or looking different than on the pc.Example1Example2Example3 These are examples of my problem. The IMG above is the way it should look like and the one underneath is how it shows on my phone when loaded.
It doesn´t look the same, due to the different resolutions.
Try to use a Canvas Scaler component. Set a reference resolution and the mode how you want to scale it.
If you want your UI elements to be anchored to the center/top/left etc. you should also set the anchor points. Here is a good Tutorial
A good way to instantly check the result is the "device simulator" It is a unity package
That's because of your Canvas settings & your UI GameObjects Anchor. But I think the easiest way to solve this for you - because you don't have that much experience about it - is to separate canvases for mobile & pc. This is the code:
private void Start()
{
if (Application.platform == RuntimePlatform.WindowsPlayer) // If your game's running on android
{
pcCanvas.SetActive(true); // Use PC designed canvas
mobileCanvas.SetActive(false); // Disable Mobile designed canvas
}
else // Your game is running on mobile
{
pcCanvas.SetActive(false);
mobileCanvas.SetActive(true);
}
}
Add this to a GameObject, Design 2 Canvases & assign them to script. (This will be a litte complicated, but will work) This link for more info
But if you want to use 1 canvas, you have to set its settings & its GameObjects anchors.

Built game looks duller than what is seen in the editor

I built my unity game through Xcode into an iOS device for testing, and the colors look duller and more pastel-like than in the game view in the editor. The exact same thing has also happened on a modern android device. How can I make it so that the colors as seen in the built game better reflect the colors in the editor?
EDIT: I have sent a file to my phone and found out that the phone perceives colors differently than my monitor. I'm sorry if I'm asking for quite a bit here, but... is there any way to make the game look as I intend it to? The fact that I never see exactly how my game will turn out seems kinda... awkward. Thanks.
I'm not sure if you already tried this, but you might want to use Unity Remote for your iOS device, so you can check the color differences in real time instead of having to build it every time.
But other than what the comments said, it sounds like you should try to adjust your monitor's display settings for better color correlation between the built game and the one in the editor.

Unity 3D: Rear camera in device is behaving weird

Am working on taking snap from my device camera. The front camera is working good,but the rear camera is not upto the mark. It is showing upside down. I donno why it is behaving strange.
Can anyone help me out.
Cheers!!
It's difficult to come up with a simple answer for your problem, this depends on wether you run it on iOS and Android. In general you need to adjust ( rotate and flip ) the resulting image based on the mirror and rotate value in the WebCamTexture.
There is a toolkit available that help you with solving some of these issues that you can take a look at. It's called Camera Capture Kit and is available on the assetstore ( https://www.assetstore.unity3d.com/en/#!/content/56673 ) - since the source is included for both iOS and Android it might be a good foundation for helping you tweak and solve your issue in your game or maybe it will just be a plug'n'play solution for your needs. It might let you save literally weeks in the long run since there is a lot of tweaking to get camera capturing right in Unity. Furthermore there is a functionality available to enable and disable flash light which might come in handy as well.
There is also a demo app included which is quite similar to what you have already been doing on your screens.
Cheers!

what is difference between AVCapture and camera default of iPhone

my app use AVCapture for capture image, this is my supervisor's ideal. But i research in internet and a can't get any information about the difference between AVCapture and default camera of iPhone or iPop (tab focus or camera quality...). please tell me what advance of AVFoundation framework ...
with the AVCaptureSession you can give your recorder a lot more functionality. You can customize nearly every aspect of the recording session. and you can ever get the raw data straight from the camera. the code can get quite complex however, and nothing is taken care of for you.
With the iOS default image capture controller you will be stuck with a few presets, and you will only have a little bit of camera functionality. But it is really simple to implement.
updated with link to apple code
If you want to see how to use the AVFoundation to do you camera recording you will probably like this app from apple.
Like I said, you will have to do everything manually. so be prepared for a handful of work.
AVCam demo app by Apple

iPhone/ iPad app development TV Out

HI,
I have just submitted my first application to iTunes for approval, however, there is one thing I really want to add to it ASAP.
I would like to code into an app that it can use the TV Out functions of both the iPhone and iPad? Ideally it would work in a similar way to how keynote works i.e. you see a bit more on the iPad itself than is projected on the TV, but even just mirroring the screen would be a step in the right direction.
I have searched all over for this and all I keep getting is about downloading jailbreaks for you iPhone to mirror the screen, which doesn't really help.
Thanks in advance,
If you just want to mirror, use my TVOutManager singleton. I've put up code to do this on github: https://github.com/robterrell/TVOutManager (Hmmm... I just noticed I haven't pushed the most recent code. I'll review and push new code asap.) I wrote up some detailed info about it at http://www.touchcentric.com/blog/archives/123 if you want to know the how's and why's.
Basically, just add the files to your project, and call:
[[TVOutManager sharedInstance] startTVOut];
If you want to do more than mirroring, read the docs on UIScreen. It's fairly trivial to create a UIWindow on the external screen (steal the bits from TVOutManager if you need to) and add subviews to it. This way you could have a Keynote-like controller on the device screen, while the main display is on the external display.
http://mattgemmell.com/2010/06/01/ipad-vga-output should get you started ...
Mirroring is not possible.
But to draw on an external display, just get the UIScreen object for the external display, then set the screen property of a UIWindow to it, (making sure to set the frame correctly etc) everything in that window should be drawn on the respective display.
Relative links:
developer.apple.com/library/ios/#documentation/uikit/reference/UIWindow_Class/UIWindowClassReference/UIWindowClassReference.html (look at screen property)
developer.apple.com/library/ios/#documentation/uikit/reference/UIScreen_Class/Reference/UIScreen.html (look at +screens)
(I don't have any reputation => can't post clickable links)
I think, you can't do this. You can only stream videos from iPod app.
But, if you have jailbreak on your device, try this (link) or take a look at this great YouTube video (link) showing exactly what you need.