├── .gitignore
├── docs
├── images
│ ├── logo.jpg
│ ├── expanded.gif
│ ├── collapsed.gif
│ ├── inherit-arrow.gif
│ ├── titleTableTop.jpg
│ ├── detailHeaderRule.jpg
│ ├── inheritedSummary.gif
│ ├── titleTableBottom.jpg
│ ├── titleTableMiddle.jpg
│ └── detailSectionHeader.jpg
├── ktu
│ ├── events
│ │ ├── class-list.html
│ │ └── package-detail.html
│ └── media
│ │ ├── class-list.html
│ │ ├── package-detail.html
│ │ └── CameraDetectionResult.html
├── com
│ └── gskinner
│ │ └── utils
│ │ ├── class-list.html
│ │ ├── package-detail.html
│ │ └── IDisposable.html
├── package-frame.html
├── class-list.html
├── mxml-tags.html
├── all-classes.html
├── package-list.html
├── index.html
├── index-list.html
├── appendixes.html
├── print.css
├── cookies.js
├── package-summary.html
├── package-detail.html
├── title-bar.html
├── MultiTest.html
├── Simple.html
├── MultiTestVerbose.html
├── class-summary.html
├── all-index-A.html
├── all-index-E.html
├── all-index-F.html
├── all-index-G.html
├── all-index-H.html
├── all-index-J.html
├── all-index-L.html
├── all-index-P.html
├── all-index-Q.html
├── all-index-U.html
├── all-index-V.html
├── all-index-W.html
└── all-index-X.html
├── CameraDetection Documentation.docproj
├── CameraDetection.lxml
├── src
├── ktu
│ ├── media
│ │ ├── CameraDetectionResult.as
│ │ ├── MediaPermissionsResult.as
│ │ ├── CameraDetectionLogger.as
│ │ └── CameraCheckerLogger.as
│ └── events
│ │ ├── MediaPermissionsEvent.as
│ │ └── CameraDetectionEvent.as
├── tests
│ ├── DialogArea.as
│ ├── PermissionTestAccordion.as
│ ├── Output.as
│ ├── TestWindow.as
│ └── TestData.as
├── Simple.as
└── PermissionsTest.as
├── readme.textile
├── CameraDetection.as3proj
└── MediaPermissionsTest.as3proj
/.gitignore:
--------------------------------------------------------------------------------
1 | /obj
2 | /bin
3 | *.lxml
--------------------------------------------------------------------------------
/docs/images/logo.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cataclysmicrewind/CameraDetection/HEAD/docs/images/logo.jpg
--------------------------------------------------------------------------------
/docs/images/expanded.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cataclysmicrewind/CameraDetection/HEAD/docs/images/expanded.gif
--------------------------------------------------------------------------------
/docs/images/collapsed.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cataclysmicrewind/CameraDetection/HEAD/docs/images/collapsed.gif
--------------------------------------------------------------------------------
/docs/images/inherit-arrow.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cataclysmicrewind/CameraDetection/HEAD/docs/images/inherit-arrow.gif
--------------------------------------------------------------------------------
/docs/images/titleTableTop.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cataclysmicrewind/CameraDetection/HEAD/docs/images/titleTableTop.jpg
--------------------------------------------------------------------------------
/docs/images/detailHeaderRule.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cataclysmicrewind/CameraDetection/HEAD/docs/images/detailHeaderRule.jpg
--------------------------------------------------------------------------------
/docs/images/inheritedSummary.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cataclysmicrewind/CameraDetection/HEAD/docs/images/inheritedSummary.gif
--------------------------------------------------------------------------------
/docs/images/titleTableBottom.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cataclysmicrewind/CameraDetection/HEAD/docs/images/titleTableBottom.jpg
--------------------------------------------------------------------------------
/docs/images/titleTableMiddle.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cataclysmicrewind/CameraDetection/HEAD/docs/images/titleTableMiddle.jpg
--------------------------------------------------------------------------------
/docs/images/detailSectionHeader.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cataclysmicrewind/CameraDetection/HEAD/docs/images/detailSectionHeader.jpg
--------------------------------------------------------------------------------
/CameraDetection Documentation.docproj:
--------------------------------------------------------------------------------
1 |
2 |
3 | CameraDetection Docs
4 | D:\ktu\git\CameraDetection\src
5 |
6 | D:\ktu\git\CameraDetection\docs
7 | 1
8 |
9 |
--------------------------------------------------------------------------------
/CameraDetection.lxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | false
6 | false
7 | false
8 | true
9 | false
10 | false
11 |
12 |
13 | None
14 |
--------------------------------------------------------------------------------
/docs/ktu/events/class-list.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
33 |
44 |
45 | This class is a test class to see how CameraDetection functions when an application tries to use the camera multiple times
46 |
47 | This is a document class.
48 |
49 |
50 |
51 |
52 |
53 |
74 |
75 |
76 |
77 |
82 |
83 | public function MultiTest()
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
--------------------------------------------------------------------------------
/src/tests/TestData.as:
--------------------------------------------------------------------------------
1 | package tests {
2 |
3 |
4 | /**
5 | * ...
6 | * @author ktu
7 | */
8 | public class TestData {
9 |
10 |
11 | static public var data:Array = [
12 | {
13 | title: "F - Q - A",
14 | description: "\"remember\" checkbox is NOT selected.\n\nuse the quick access dialog\n\nuser clicks allow\n\nmediaPermissions should return 'granted'",
15 | instructions: "click start\n\nselect allow",
16 | expectation: "granted",
17 | mode: "quickAccess"
18 | }, {
19 | title: "F - Q - D",
20 | description: "\"remember\" checkbox is NOT selected.\n\nuse the quick access dialog\n\nuser clicks deny\n\nmediaPermissions should return 'denied'",
21 | instructions: "click start\n\nselect deny",
22 | expectation: "denied",
23 | mode: "quickAccess"
24 | }, {
25 | title: "F - P - A",
26 | description: "\"remember\" checkbox is NOT selected.\n\nuse the privacy dialog\n\nuser clicks allow\n\nmediaPermissions should return 'granted'",
27 | instructions: "click start\n\nselect deny\n\nclick close",
28 | expectation: "denied",
29 | mode: "privacyDialog"
30 | }, {
31 | title: "F - P - D",
32 | description: "\"remember\" checkbox is NOT selected.\n\nuse the privacy dialog\n\nuser clicks deny\n\nmediaPermissions should return 'denied'",
33 | instructions: "click start\n\nselect deny\n\n click close",
34 | expectation: "denied",
35 | mode: "privacyDialog"
36 | }, {
37 | title: "F - P - C",
38 | description: "\"remember\" checkbox is NOT selected.\n\nuse the privacy dialog\n\nuser clicks close\n\nmediaPermissions should return 'denied'",
39 | instructions: "click start\n\nselect deny\n\n click close",
40 | expectation: "denied",
41 | mode: "privacyDialog"
42 | }, {
43 | title: "T(A) - Q - N/A",
44 | description: "\"remember\" checkbox IS selected with allow.\n\nuse the quick access dialog\n\nuser does nothing\n\nmediaPermissions should return 'granted'",
45 | instructions: "click start\n\ndo nothing",
46 | expectation: "granted",
47 | mode: "quickAccess"
48 | }, {
49 | title: "T(A) - P - A",
50 | description: "\"remember\" checkbox IS selected with allow.\n\nuse the privacy dialog\n\nuser clicks allow\n\nmediaPermissions should return 'granted'",
51 | instructions: "click start\n\nselect allow (even though already selected)",
52 | expectation: "granted",
53 | mode: "privacyDialog"
54 | }, {
55 | title: "T(A) - P - D",
56 | description: "\"remember\" checkbox IS selected with allow.\n\nuse the privacy dialog\n\nuser clicks allow\n\nmediaPermissions should return 'denied'",
57 | instructions: "click start\n\nclick deny",
58 | expectation: "denied",
59 | mode: "privacyDialog"
60 | }, {
61 | title: "T(A) - P - C",
62 | description: "\"remember\" checkbox IS selected with allow.\n\nuse the privacy dialog\n\nuser clicks close\n\nmediaPermissions should return 'granted'",
63 | instructions: "click start\n\nclick close",
64 | expectation: "granted",
65 | mode: "privacyDialog"
66 | }, {
67 | title: "T(D) - Q - N/A",
68 | description: "\"remember\" checkbox IS selected with deny.\n\nuse the quick access dialog\n\nuser does nothing\n\nmediaPermissions should return 'denied'",
69 | instructions: "click start\n\ndo nothing",
70 | expectation: "granted",
71 | mode: "quickAccess"
72 | }, {
73 | title: "T(D) - P - A",
74 | description: "\"remember\" checkbox IS selected with deny.\n\nuse the privacy dialog\n\nuser clicks allow\n\nmediaPermissions should return 'granted'",
75 | instructions: "click start\n\nselect allow (even though already selected)",
76 | expectation: "granted",
77 | mode: "privacyDialog"
78 | }, {
79 | title: "T(D) - P - D",
80 | description: "\"remember\" checkbox IS selected with deny.\n\nuse the privacy dialog\n\nuser clicks allow\n\nmediaPermissions should return 'denied'",
81 | instructions: "click start\n\nclick deny",
82 | expectation: "denied",
83 | mode: "privacyDialog"
84 | }, {
85 | title: "T(D) - P - C",
86 | description: "\"remember\" checkbox IS selected with deny.\n\nuse the privacy dialog\n\nuser clicks close\n\nmediaPermissions should return 'denied'",
87 | instructions: "click start\n\nclick close",
88 | expectation: "denied",
89 | mode: "privacyDialog"
90 | }
91 | ]
92 |
93 | }
94 |
95 | }
--------------------------------------------------------------------------------
/docs/com/gskinner/utils/IDisposable.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
33 |
44 |
45 | IDisposable by Grant Skinner. June 21, 2006
46 | Visit www.gskinner.com/blog for documentation, updates and more free code.
47 |
48 | You may distribute this class freely, provided it is not modified in any way (including
49 | removing this header or changing the package path).
50 |
51 | Please contact info[at]gskinner[dot]com prior to distributing modified versions of this class.
52 |
53 |
54 |
55 |
56 |
79 |
80 |
81 |
82 |
87 |
88 |
public function dispose():void
89 | implementation should perpare all objects for garbage collection
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
--------------------------------------------------------------------------------
/docs/Simple.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
33 |
44 |
45 | This class is a simple example of how to use CameraDetection
46 |
47 | This is a document class.
48 |
49 | Very simple.
50 | Create an instance
51 | var cd:CameraDetection = new CameraDetection(stage);
52 | Add the event listener
53 | cd.addEventListener (CameraDetectionEvent.RESOLVE, onCameraResolve);
54 | Write function onCameraResolve to handle the results
55 | function onCameraResolve (e:CameraDetectionEvent):void {
56 | switch (e.code) {
57 | case CameraDetectionResult.SUCCESS:
58 | case CameraDetectionResult.NO_PERMISSION:
59 | case CameraDetectionResult.NO_CAMERAS:
60 |
61 |
62 |
63 |
64 |
65 |
86 |
87 |
88 |
89 |
94 |
95 | public function Simple()
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
--------------------------------------------------------------------------------
/docs/MultiTestVerbose.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
33 |
44 |
45 | This class is a test class to see how CameraDetection functions when an application tries to use the camera multiple times
46 |
47 | This is a document class.
48 |
49 | This is verbose, with lots of output.
50 | I am currently trying to find out why its not working...
51 | Then, if waiting longer removes the blackout period.
52 | If not, then provide a way of solving that issue here.
53 |
54 |
55 |
56 |
57 |
85 |
86 |
87 |
88 |
93 |
94 | public function MultiTestVerbose()
95 |
96 |
97 |
98 |
99 |
104 |
105 |
public function output(str:String):voidParameters
106 |
107 |
108 | | str:String |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
--------------------------------------------------------------------------------
/src/PermissionsTest.as:
--------------------------------------------------------------------------------
1 | /**
2 | * author: ktu; [blog.cataclysmicrewind.com]
3 | * updated: 2012.10.06;
4 | *
5 | * This class is free to use and modify, however I request that the header (except example code),
6 | * and original package remain intact.
7 | * If you choose to modify it, please contact me before releasing the product.
8 | * [ktu_flash@cataclysmicrewind.com]
9 | *
10 | */
11 | package {
12 |
13 | import com.bit101.components.Accordion;
14 | import com.bit101.components.Style;
15 | import com.bit101.components.Text;
16 | import com.bit101.components.VScrollBar;
17 | import flash.display.Sprite;
18 | import flash.events.Event;
19 | import flash.events.MouseEvent;
20 | import flash.events.NetStatusEvent;
21 | import flash.geom.Rectangle;
22 | import flash.media.Camera;
23 | import flash.media.Microphone;
24 | import ktu.events.MediaPermissionsEvent;
25 | import ktu.media.MediaPermissions;
26 | import ktu.media.MediaPermissionsResult;
27 | import tests.DialogArea;
28 | import tests.Output;
29 | import tests.PermissionTestAccordion;
30 | import tests.TestData;
31 | import tests.TestWindow;
32 |
33 |
34 | /**
35 | * This Document class is designed to test that the MediaPermissions object works like it should.
36 | *
37 | *
38 | * cases:
39 | *
40 | * remembered? - popup - choice = result
41 | *
42 | * false - quick - allow = granted
43 | * false - quick - deny = denied
44 | * false - security - allow = granted
45 | * false - security - deny = denied
46 | * true(allow) - quick - n/a = granted
47 | * true(allow) - security - allow = granted
48 | * true(allow) - security - deny = denied
49 | * true(deny) - quick - n/a = denied
50 | * true(deny) - security - allow = allow
51 | * true(deny) - security - deny = denied
52 | * true(deny) - security - close = denied
53 | *
54 | *
55 | *
56 | *
57 | *
58 | *
59 | * @author ktu
60 | */
61 | public class PermissionsTest extends Sprite {
62 | private var output:Output;
63 | private var mediaPermissions:MediaPermissions;
64 |
65 | public function PermissionsTest(){
66 | if (stage)
67 | init();
68 | else
69 | addEventListener(Event.ADDED_TO_STAGE, init);
70 | }
71 |
72 | private function init(e:Event = null):void {
73 | removeEventListener(Event.ADDED_TO_STAGE, init);
74 | //
75 | //stage.addEventListener(MouseEvent.CLICK, onClick);
76 | Style.setStyle(Style.KTU);
77 |
78 |
79 |
80 | var accordion:PermissionTestAccordion = new PermissionTestAccordion(this, 20, 10);
81 | accordion.width = 170;
82 | accordion.height = 480;
83 | accordion.addEventListener("start", onStart);
84 |
85 | var accordionMask:Sprite = new Sprite();
86 | accordionMask.graphics.beginFill(0);
87 | accordionMask.graphics.drawRect(0, 0, 170, 360);
88 | accordionMask.x = 20;
89 | accordionMask.y = 10;
90 | accordion.mask = accordionMask;
91 |
92 | var accordionSlider:VScrollBar = new VScrollBar(this, 10, 10);
93 | accordionSlider.height = 360;
94 | accordionSlider.setThumbPercent(360 / accordion.height);
95 | accordionSlider.setSliderParams(0, 1, 0);
96 | accordionSlider.addEventListener(Event.CHANGE, function(e:Event):void {
97 | accordion.y = 10 - (120 * accordionSlider.value);
98 | });
99 |
100 | var dialogArea:DialogArea = new DialogArea(this, 200, 121);
101 | dialogArea.setSize(215, 138);
102 |
103 | output = new Output(this, 200, 121+138+10);
104 | output.setSize(215 + 190, 101);
105 |
106 | var accordionInstructions:Text = new Text(this, 200, 10, "legend:\nrememberd? False, True(Allow/Deny)\ndialog? Quick or Privacy\nUser Action? Allow/Deny/Close/n/a" );
107 | accordionInstructions.setSize(215, 91);
108 |
109 |
110 | }
111 |
112 | private function onStart(e:NetStatusEvent):void {
113 | output.log("start clicked");
114 | mediaPermissions = new MediaPermissions(stage);
115 | mediaPermissions.mode = e.info.mode;
116 | output.log("mode = MediaPermissions." + (mediaPermissions.mode == MediaPermissions.QUICK_ACCESS ? "QUICK_ACCESS" : "PRIVACY_DIALOG"));
117 | mediaPermissions.addEventListener(MediaPermissionsEvent.RESOLVE, onPermissionsResolve);
118 | mediaPermissions.addEventListener(MediaPermissionsEvent.DIALOG_STATUS, onDialogStatus);
119 | mediaPermissions.getPermission(Camera);
120 | }
121 |
122 | private function onPermissionsResolve(e:MediaPermissionsEvent):void {
123 | if (e.remembered) output.log("user 'remembered' their decision");
124 | var log:String = "MediaPermissionsResult.";
125 | switch (e.code) {
126 | case MediaPermissionsResult.GRANTED :
127 | log += "GRANTED";
128 | break;
129 | case MediaPermissionsResult.DENIED:
130 | log += "DENIED";
131 | break;
132 | case MediaPermissionsResult.NO_DEVICE:
133 | log += "NO_DEVICE";
134 | break;
135 | }
136 | output.log(log);
137 | }
138 | private function onDialogStatus(e:MediaPermissionsEvent):void {
139 | if (mediaPermissions.mode == MediaPermissions.QUICK_ACCESS) {
140 | if (e.code == MediaPermissionsResult.DIALOG_OPEN) {
141 | output.log("MediaPermissionsResult.DIALOG_OPEN - quick access");
142 | output.log("waiting for user input");
143 | } else {
144 | output.log("MediaPermissionsResult.DIALOG_CLOSED - quick access");
145 | }
146 | } else {
147 | if (e.code == MediaPermissionsResult.DIALOG_OPEN) {
148 | output.log("MediaPermissionsResult.DIALOG_OPEN - privacy dialog");
149 | output.log("waiting for user input");
150 | } else {
151 | output.log("MediaPermissionsResult.DIALOG_CLOSED - privacy dialog");
152 | }
153 | }
154 | }
155 | }
156 | }
--------------------------------------------------------------------------------
/docs/class-summary.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
32 |
33 |
Documentation for classes includes syntax, usage information, and code samples for methods, properties, and event handlers and listeners for those APIs that belong to a specific class in ActionScript. The classes are listed alphabetically. If you are not sure to which class a certain method or property belongs, you can look it up in the Index.
34 |
35 |
36 |
37 | | | Class | Package | Description |
38 |
39 |
40 | | | CameraDetection
41 |
42 | | ktu.media |
43 | CameraDetection searches all available Camera objects to find the first working Camera. |
44 |
45 |
46 | | | CameraDetectionEvent
47 |
48 | | ktu.events |
49 | A CameraDetection object dispatches a CameraDetectionEvent
50 | |
51 |
52 |
53 | | | CameraDetectionResult
54 |
55 | | ktu.media |
56 |
57 | Enumeration of possible results from using CameraDetection
58 |
59 | Used in conjunction with CameraDetectionEvent as the code property
60 |
61 |
62 | |
63 |
64 |
65 | | | CameraDetectionVerbose
66 |
67 | | ktu.media |
68 | CameraDetection searches all available Camera objects to find the first working Camera. |
69 |
70 |
71 | | | IDisposable
72 |
73 | | com.gskinner.utils |
74 | IDisposable by Grant Skinner. |
75 |
76 |
77 | | | MultiTest
78 |
79 | | Top Level |
80 | This class is a test class to see how CameraDetection functions when an application tries to use the camera multiple times
81 |
82 | This is a document class. |
83 |
84 |
85 | | | MultiTestVerbose
86 |
87 | | Top Level |
88 | This class is a test class to see how CameraDetection functions when an application tries to use the camera multiple times
89 |
90 | This is a document class. |
91 |
92 |
93 | | | Simple
94 |
95 | | Top Level |
96 | This class is a simple example of how to use CameraDetection
97 |
98 | This is a document class. |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
--------------------------------------------------------------------------------
/docs/ktu/media/CameraDetectionResult.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
33 |
41 |
42 |
43 | Enumeration of possible results from using CameraDetection
44 |
45 | Used in conjunction with CameraDetectionEvent as the code property
46 |
47 |
48 |
49 |
50 |
51 |
52 |
90 |
91 |
92 |
93 |
98 |
99 |
public static const NO_CAMERAS:String = "noCameras"
100 | code value for when no Cameras were found
101 |
102 |
103 |
108 |
109 |
public static const NO_PERMISSION:String = "noPermission"
110 | code value for when user denies permission to the Camera
111 |
112 |
113 |
118 |
119 |
public static const NO_SUCCESS:String = "noSuccess"
120 | code value for when at least one camera is found, but none work
121 |
122 |
123 |
128 |
129 |
public static const SUCCESS:String = "success"
130 | code value for when a Cameras was found that works
131 |
132 |
133 |
134 |
135 |
136 |
137 |
138 |
139 |
140 |
141 |
142 |
143 |
--------------------------------------------------------------------------------
/docs/all-index-A.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |