Skip to main content
Participant
May 28, 2019
Question

How to access mobile front camera using Adobe AIR apps?

  • May 28, 2019
  • 1 reply
  • 462 views

Hey Team,

I am developing an e-learning project on Animate CC (AIR as3.0)  where e-course is running on users mobile. This course has assessment as well. Client wants some functionalities which are listed below:

1: This App should be capable of handling assessments and generate score. ( I did -- completed)

2: This App should send records to their database. (I did -- completed)

3: This App should have timer dependent activities. (I did -- completed)

4: This App should take picture of the participants and save to their database (PHP MYSQL structure) ... (I am unable to handle this task) -- NEED HELP HERE

I need a guidance to handle user's mobile camera to take his picture during course progress after certain intervals and that picture need to be stored in their database with date and time only.

I will be very thankful for your time guys. please help me out. 

Best regards

Prashant Dwivedi - INDIA

This topic has been closed for replies.

1 reply

Inspiring
May 28, 2019

it's fairly easy so I won't be posting code but here are the steps:

- Use the flash.media.Camera class to get a list of available (Camera.names) Cameras (permission required on mobile)

- Pick the camera you need > loop Camera.names > Camera.getCamera( name ) > camera.position

- Now you picked the correct camera > attach it to a flash.media.Video instance.

- You can now add your Video instance in display list.

- Take a screenshot of the camera > camera.drawToBitmapData(bitmapData);  < pass a valid BitmapData with the correct size

- Save screenshot > bitmapData.encode( .... ) < will give you binarydata that you can save in DB the way you see fit.

That's it. All those operations are described with examples in the AS3 Docs, use them.

Participant
May 30, 2019

Hi ASWC,

I am oblized for your reply. Thanks for your time. But still i couldn't make it possible. I will be very thankful if you can share codes for the same. I will never forget your help

best regards,

Prashant dwivedi