Skip to content

Latest commit

 

History

5 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Appcelerator Titanium Appcelerator Alloy License

ts.camera

Uniform wrapper for iOS com.mfogg.squarecamera and Android pw.custom.androidcamera modules. All icons are provided by Ionicons font; Refer to their documentation to find which icon is available.

Previews

screenshot

How to use

tiapp.xml

...
<android xmlns:android="http://schemas.android.com/apk/res/android">
    <manifest>
        <!-- Camera Permissions -->
        <uses-permission android:name="android.permission.CAMERA"/>
        <uses-feature android:name="android.hardware.camera"/>
        <uses-feature android:name="android.hardware.camera.autofocus"/>
    </manifest>
</android>
...

index.xml

<Alloy>
    <Window id="container">
        <Widget id="camera" src="ts.camera" onPictureTaken="onPictureTaken" />
    </Window>
</Alloy>

index.tss

"#camera": { // styles for the camera
    top: 64,
    width: '100%', // default value is the width of the screen
    height: '100%' // default value is the same value of the width
},

index.js

function onPictureTaken(e) {
    console.log(e.image); // the taken photo
}

Methods

Both platforms share the same API:

Function Parameters Usage
snapPicture Take a photo
switchCamera Switch the camera front or back
switchFlash Turn on or off the flashlight

Events

Event Usage
pictureTaken Will fire when a picture is taken

Changelog

  • 1.0
    • Initial version

wearesmiths

Releases

Packages

Contributors

Languages