GithubHelp home page GithubHelp logo

sewonist / flashlight Goto Github PK

View Code? Open in Web Editor NEW
13.0 5.0 6.0 638 KB

FlashLight is ANE about using light or torch for iOS and Android.

ActionScript 6.06% Java 15.86% Objective-C 14.02% C 64.05%

flashlight's Introduction

FlashLight

FlashLight is ANE about using light or torch for iOS and Android.

Installation

On Android:

  • you need to enable the following permissions (otherwise the returned state will always be not connected):

    <android>
        <manifestAdditions><![CDATA[
            <manifest android:installLocation="auto">
                
                ...
    
                <uses-permission android:name="android.permission.CAMERA" />
    			<uses-permission android:name="android.permission.FLASHLIGHT" />
                
                ...
    
            </manifest>
        ]]></manifestAdditions>
    </android>

Usage

if( Flashlight.getInstance().isSupported ){
	Flashlight.getInstance().on(); // turn on
	Flashlight.getInstance().off(); // turn off
	var mode:Boolean = Flashlight.getInstance().mode; // get torch mode
}

flashlight's People

Contributors

sewonist avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

flashlight's Issues

Typo in Usage section

For the readme, under usage, it says Flashlight. However, to actually use the code, it needs to be misspelled FlashLight.

AIR16/64bit Support

After upgrading to AIR16 and iOS 8.1, the extension stopped working.
You have to add the 64bit support, please! :)

Samsung Galaxy S5 Problem

I tried to use the flashlight on two different Galaxy S5 phones. One from T-Mobile and the other was a Sprint phone. Neither turned the flashlight on. I am wondering if it is the new Android OS update to the torch or permissions. Works great on my galaxy s4.

Publish example file error using Flash CS6 Professinol

Thanks for you give me example.
I already test your example in the Flash CS6 Professinol, but I have also problem about publish.
I am trying to run the library output using AIR3.2 for IOS.

The problem is like this
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Error creating files.

Id warning unexpected srelocation type 9
Id warning unexpected srelocation type 9
Id warning unexpected srelocation type 9
Id warning unexpected srelocation type 9
...
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

The code is like this
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
import com.itpointlab.ane.FlashLight;
var light:FlashLight;
light = FlashLight.getInstance();
txt_isSupported.text = String(light.isSupported);
txt_mode.text = String(light.mode);
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

I also test your swc file. But the isSupported and mode are false.
So if it is possible, can you make AS file input example?
Last, really thank u so much for guiding me here.

Static Instance Problem

I actually have some problem here. The following is my plan.
I am trying to run the library output to ios phone 5, using Actionscript that you providing here. but i got some static instance problem or some come which might incorrect where need your help and guide at here. Thanks

My code in Flash cs6 Pro/ Ios 7 (iphone5)

import com.itpointlab.ane.FlashLight;
var Flashlight:FlashLight =new FlashLight();

if( Flashlight.getInstance().isSupported ){
Flashlight.getInstance().on(); // turn on
Flashlight.getInstance().off(); // turn off
var mode:Boolean = Flashlight.getInstance().mode; // get torch mode
}

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Error Problem

Frame 1, Line 4 1061: Call to a possibly undefined method getInstance through a reference with static type com.itpointlab.ane:FlashLight.
Frame 1, Line 5 1061: Call to a possibly undefined method getInstance through a reference with static type com.itpointlab.ane:FlashLight.
Frame 1, Line 6 1061: Call to a possibly undefined method getInstance through a reference with static type com.itpointlab.ane:FlashLight.
Frame 1, Line 7 1061: Call to a possibly undefined method getInstance through a reference with static type com.itpointlab.ane:FlashLight.

Last, really thank u so much for guiding me here.

Android 4.1.2 (light never turns off)

In Galaxy S3, Android 4.1.2 after switching on the light it never switches off, turnOn=false does nothing and light still on. I'm not sure if this might be related with the isOn flag, if(_isOn == value || _isSupported==false) return; where in Android the onStatusContext is not dispatched and as consequence _isOn is always false so setting the turnOn property to false doesn't really call _context.call("turnLightOn", _turnOn);

Camera is never released

I'm using this ane https://github.com/saumitrabhave/qr-zbar-ane for barcode scanning.
That ane doesn't have flashlight capabilities (when scanning) and I'm trying to do that with Flashlight ane. That doesn't work - it seems the Camera is never released...
Both ane's are working great alone but not together.
Can you look at this issue?
Thank you!

Error while camera is already on (for android)

Thank you for the ANE (speed up my progress),
however I found that once I instantiated a FlashLight instance I couldn't use my camera object, and vice versa

I took the liberty of looking at your android source code and I see that you open the camera like so:

public FlashLightContext()
{
FlashLightContext.camera = Camera.open();
FlashLightContext.parameters = FlashLightContext.camera.getParameters();
}

From what I understand from here http://developer.android.com/training/camera/cameradirect.html,
there is a need to check if the camera is already activated by something else...
which leads me to ask:
Can you add the flash to an already running camera?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.