Skip to content

Commit e88ae83

Browse files
committed
docs: fix README structure
1 parent d6df48b commit e88ae83

1 file changed

Lines changed: 155 additions & 155 deletions

File tree

README.md

Lines changed: 155 additions & 155 deletions
Original file line numberDiff line numberDiff line change
@@ -124,161 +124,6 @@ if (permissionStatus === FrameCapture.PermissionStatus.GRANTED) {
124124
}
125125
```
126126

127-
## API Reference
128-
129-
### Permission Management
130-
131-
#### `requestPermission()`
132-
133-
Requests **MediaProjection permission** (screen capture/screen sharing) from the user. This opens the Android system dialog asking the user to allow screen recording.
134-
135-
```typescript
136-
const status = await FrameCapture.requestPermission();
137-
```
138-
139-
**Permission:** `android.permission.SYSTEM_ALERT_WINDOW` (MediaProjection API)
140-
141-
**Returns:** `Promise<PermissionStatus>`
142-
143-
**Note:** This is a runtime permission that must be granted before starting capture. The permission dialog is shown by the Android system, not your app.
144-
145-
#### `checkPermission()`
146-
147-
Checks if MediaProjection permission (screen capture) has been previously granted without showing the permission dialog.
148-
149-
```typescript
150-
const status = await FrameCapture.checkPermission();
151-
```
152-
153-
**Returns:** `Promise<PermissionStatus>`
154-
155-
**Note:** Returns `NOT_DETERMINED` if permission was never requested, `GRANTED` if previously granted. MediaProjection permission cannot be checked programmatically on Android, so this only verifies if permission data exists from a previous grant.
156-
157-
#### `checkNotificationPermission()`
158-
159-
Checks if notification permission is granted (Android 13+).
160-
161-
```typescript
162-
const status = await FrameCapture.checkNotificationPermission();
163-
```
164-
165-
**Returns:** `Promise<PermissionStatus>`
166-
167-
### Capture Control
168-
169-
#### `startCapture(options)`
170-
171-
Starts screen capture with the specified options.
172-
173-
```typescript
174-
const session = await FrameCapture.startCapture({
175-
capture: {
176-
interval: 1000,
177-
},
178-
image: {
179-
quality: 80,
180-
format: 'jpeg',
181-
},
182-
});
183-
```
184-
185-
**Parameters:**
186-
187-
- `options` (optional): `Partial<CaptureOptions>` - Capture configuration
188-
189-
**Returns:** `Promise<CaptureSession>`
190-
191-
**Throws:** `CaptureError` if capture cannot be started
192-
193-
#### `stopCapture()`
194-
195-
Stops the active capture session.
196-
197-
```typescript
198-
await FrameCapture.stopCapture();
199-
```
200-
201-
**Returns:** `Promise<void>`
202-
203-
#### `pauseCapture()`
204-
205-
Pauses the active capture session.
206-
207-
```typescript
208-
await FrameCapture.pauseCapture();
209-
```
210-
211-
**Returns:** `Promise<void>`
212-
213-
#### `resumeCapture()`
214-
215-
Resumes a paused capture session.
216-
217-
```typescript
218-
await FrameCapture.resumeCapture();
219-
```
220-
221-
**Returns:** `Promise<void>`
222-
223-
#### `getCaptureStatus()`
224-
225-
Gets the current capture status.
226-
227-
```typescript
228-
const status = await FrameCapture.getCaptureStatus();
229-
console.log(status.state); // 'idle' | 'capturing' | 'paused'
230-
```
231-
232-
**Returns:** `Promise<CaptureStatus>`
233-
234-
### Utility Functions
235-
236-
#### `cleanupTempFrames()`
237-
238-
Manually cleans up all temporary frame files stored in the app's cache directory.
239-
240-
```typescript
241-
await FrameCapture.cleanupTempFrames();
242-
```
243-
244-
**Returns:** `Promise<void>`
245-
246-
**What it does:**
247-
248-
- Deletes all frames from the cache directory (`/data/data/[package]/cache/captured_frames/`)
249-
- Only affects temporary frames (when `saveFrames: false`)
250-
- Automatically called on app startup
251-
- Useful for freeing up storage space after processing frames
252-
253-
**When to use:**
254-
255-
- After uploading frames to a server
256-
- After processing frames in your app
257-
- When you want to free up cache storage manually
258-
259-
#### `addListener(eventType, callback)`
260-
261-
Adds an event listener for capture events.
262-
263-
```typescript
264-
const subscription = FrameCapture.addListener(
265-
FrameCapture.CaptureEventType.FRAME_CAPTURED,
266-
(event) => {
267-
console.log('Frame:', event.filePath);
268-
}
269-
);
270-
271-
// Remove listener when done
272-
subscription.remove();
273-
```
274-
275-
**Parameters:**
276-
277-
- `eventType`: `CaptureEventType` - Event type to listen for
278-
- `callback`: `CaptureEventCallback` - Function to call when event is emitted
279-
280-
**Returns:** `EventSubscription`
281-
282127
## Configuration
283128

284129
### CaptureOptions
@@ -906,6 +751,161 @@ if (Platform.Version >= 33) {
906751
- **Kotlin:** Native Android implementation
907752
- **TypeScript:** Type-safe JavaScript API
908753

754+
## API Reference
755+
756+
### Permission Management
757+
758+
#### `requestPermission()`
759+
760+
Requests **MediaProjection permission** (screen capture/screen sharing) from the user. This opens the Android system dialog asking the user to allow screen recording.
761+
762+
```typescript
763+
const status = await FrameCapture.requestPermission();
764+
```
765+
766+
**Permission:** `android.permission.SYSTEM_ALERT_WINDOW` (MediaProjection API)
767+
768+
**Returns:** `Promise<PermissionStatus>`
769+
770+
**Note:** This is a runtime permission that must be granted before starting capture. The permission dialog is shown by the Android system, not your app.
771+
772+
#### `checkPermission()`
773+
774+
Checks if MediaProjection permission (screen capture) has been previously granted without showing the permission dialog.
775+
776+
```typescript
777+
const status = await FrameCapture.checkPermission();
778+
```
779+
780+
**Returns:** `Promise<PermissionStatus>`
781+
782+
**Note:** Returns `NOT_DETERMINED` if permission was never requested, `GRANTED` if previously granted. MediaProjection permission cannot be checked programmatically on Android, so this only verifies if permission data exists from a previous grant.
783+
784+
#### `checkNotificationPermission()`
785+
786+
Checks if notification permission is granted (Android 13+).
787+
788+
```typescript
789+
const status = await FrameCapture.checkNotificationPermission();
790+
```
791+
792+
**Returns:** `Promise<PermissionStatus>`
793+
794+
### Capture Control
795+
796+
#### `startCapture(options)`
797+
798+
Starts screen capture with the specified options.
799+
800+
```typescript
801+
const session = await FrameCapture.startCapture({
802+
capture: {
803+
interval: 1000,
804+
},
805+
image: {
806+
quality: 80,
807+
format: 'jpeg',
808+
},
809+
});
810+
```
811+
812+
**Parameters:**
813+
814+
- `options` (optional): `Partial<CaptureOptions>` - Capture configuration
815+
816+
**Returns:** `Promise<CaptureSession>`
817+
818+
**Throws:** `CaptureError` if capture cannot be started
819+
820+
#### `stopCapture()`
821+
822+
Stops the active capture session.
823+
824+
```typescript
825+
await FrameCapture.stopCapture();
826+
```
827+
828+
**Returns:** `Promise<void>`
829+
830+
#### `pauseCapture()`
831+
832+
Pauses the active capture session.
833+
834+
```typescript
835+
await FrameCapture.pauseCapture();
836+
```
837+
838+
**Returns:** `Promise<void>`
839+
840+
#### `resumeCapture()`
841+
842+
Resumes a paused capture session.
843+
844+
```typescript
845+
await FrameCapture.resumeCapture();
846+
```
847+
848+
**Returns:** `Promise<void>`
849+
850+
#### `getCaptureStatus()`
851+
852+
Gets the current capture status.
853+
854+
```typescript
855+
const status = await FrameCapture.getCaptureStatus();
856+
console.log(status.state); // 'idle' | 'capturing' | 'paused'
857+
```
858+
859+
**Returns:** `Promise<CaptureStatus>`
860+
861+
### Utility Functions
862+
863+
#### `cleanupTempFrames()`
864+
865+
Manually cleans up all temporary frame files stored in the app's cache directory.
866+
867+
```typescript
868+
await FrameCapture.cleanupTempFrames();
869+
```
870+
871+
**Returns:** `Promise<void>`
872+
873+
**What it does:**
874+
875+
- Deletes all frames from the cache directory (`/data/data/[package]/cache/captured_frames/`)
876+
- Only affects temporary frames (when `saveFrames: false`)
877+
- Automatically called on app startup
878+
- Useful for freeing up storage space after processing frames
879+
880+
**When to use:**
881+
882+
- After uploading frames to a server
883+
- After processing frames in your app
884+
- When you want to free up cache storage manually
885+
886+
#### `addListener(eventType, callback)`
887+
888+
Adds an event listener for capture events.
889+
890+
```typescript
891+
const subscription = FrameCapture.addListener(
892+
FrameCapture.CaptureEventType.FRAME_CAPTURED,
893+
(event) => {
894+
console.log('Frame:', event.filePath);
895+
}
896+
);
897+
898+
// Remove listener when done
899+
subscription.remove();
900+
```
901+
902+
**Parameters:**
903+
904+
- `eventType`: `CaptureEventType` - Event type to listen for
905+
- `callback`: `CaptureEventCallback` - Function to call when event is emitted
906+
907+
**Returns:** `EventSubscription`
908+
909909
## Contributing
910910

911911
See the [contributing guide](CONTRIBUTING.md) to learn how to contribute to the repository and the development workflow.

0 commit comments

Comments
 (0)