Skip to content

Commit b5c6bd0

Browse files
author
Hamas
committed
Docs: Fix controller usage example
1 parent 32d82fd commit b5c6bd0

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

README.md

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,15 +48,19 @@ We utilize the device's native APIs (`MediaMuxer` on Android, `AVAssetExportSess
4848
```dart
4949
final controller = DlpController();
5050
51-
// Listen to status updates (Extracting -> Downloading -> Merging -> Completed)
51+
// 1. Get Video Data
52+
final videoData = await engine.extract('https://tiktok.com/...');
53+
54+
// 2. Start Download (Auto-Muxing handled internally)
5255
controller.state.listen((state) {
53-
print('[${state.status}] ${state.message}');
54-
if (state.status == DlpStatus.merging) {
55-
print('Merging Video & Audio streams...');
56+
if (state.status == DlpStatus.downloading) {
57+
print('Downloading... ${state.progress?.percentage.toStringAsFixed(1)}%');
58+
} else if (state.status == DlpStatus.completed) {
59+
print('Done! File at: ${state.message}');
5660
}
5761
});
5862
59-
// Start the Magic (Auto-Muxing included)
63+
await controller.startDownload(videoData, '/downloads/');
6064
final path = await controller.startDownload(videoData, '/storage/emulated/0/Download');
6165
print('Saved to: $path');
6266
```

0 commit comments

Comments
 (0)