सर्वोत्तम अभ्यास
AIBuds features में Bluetooth commands, device-hosted Wi-Fi workflows, AI services, media processing और optional diagnostic modules शामिल हैं। भरोसेमंद integration हर SDK call को अलग request मानने के बजाय इन boundaries को स्पष्ट रखता है।
Module की सीमाएँ स्पष्ट रखें
AIBudsFoundationमें shared models, capabilities और value types हैं।AIBudsdevice discovery, connection और device-facing feature protocols संभालता है।- AI modules provider configuration और AI session lifecycles संभालते हैं।
- Logging, AI Dashboard, Live Streaming, Crash Reporter और Video Stabilization optional operational या media modules हैं।
- पूरा suite जानबूझकर अपनाने वाले product के लिए
AIBudsAllInOneउपयुक्त है; modular products केवल वही जोड़ें जिसका वे उपयोग करते हैं।
Product policy को SDK layer से बाहर रखें। UI controllers काम coordinator को दें और वह owner पूरा होने तक active device, callbacks, player, importer या AI session को retain करे।
एक SDK Owner तय करें
Application lifecycle में चुने modules केवल एक बार initialize करें। Configuration, delegates, provider selection और optional plugin registration एक जगह रखें। Initialization के authoritative source के रूप में Configuration उपयोग करें; feature pages को alternate initialization paths न बनाएँ।
Readiness और Capability जाँचें
Connected device जरूरी नहीं कि हर feature implement करे। Operation call करने से पहले:
- पुष्टि करें कि target device अभी भी active और ready है।
DeviceInfoAPIयाLiveStreamingAPIजैसे feature protocol की conformance जाँचें।- Feature-specific capability property उपलब्ध हो तो उसे जाँचें।
- Command failure को capability detection की तरह उपयोग करने के बजाय unavailable state दिखाएँ।
Reconnect या device switch होने के बाद ये conditions दोबारा जाँचें। Capabilities को account-wide product settings की तरह cache न करें।
Acceptance और Completion अलग रखें
कई callbacks बड़े operation का केवल एक चरण बताते हैं। OTA शुरू होना, device mode में जाना, RTSP address मिलना और media download पूरा होना अलग milestones हैं।
idle -> preparing -> active/progress -> finishing -> completed | failed | cancelledअंतिम परिणाम केवल documented terminal callback से तय करें। Successful start callback, 100% progress या intermediate URL को end-to-end success न दिखाएँ। यह OTA, Camera OTA, Media File Import, Live Streaming, AI recording, simultaneous interpretation और explicit start/stop features में विशेष रूप से महत्वपूर्ण है।
Cleanup को Idempotent बनाएँ
हर long-running workflow को एक owner और ऐसा cleanup path दें जो success, failure, cancellation, navigation away, disconnect या backgrounding के बाद भी सुरक्षित हो। Cleanup में सामान्यतः शामिल हैं:
- Support होने पर device-facing session बंद करना;
- Local player, streamer, recorder या processor बंद और release करना;
- Subscriptions cancel और observers remove करना;
- Pending UI work invalidate करना;
- Callbacks और temporary files साफ करना;
- Terminal result के अनुसार UI restore करना।
View गायब होने को middleware या device work बंद होने का संकेत न मानें।
Callback Queue को Unspecified मानें
API स्पष्ट queue guarantee न दे तो UIKit updates main queue पर dispatch करें और decoding, file I/O, parsing तथा अन्य भारी काम उससे दूर रखें। दूसरे SDK callback की synchronous प्रतीक्षा करते हुए SDK callback को कभी block न करें।
Network बदलाव के लिए तैयार रहें
Media File Import, Camera OTA और RTSP Live Streaming device hotspot से जुड़ सकते हैं। iPhone का internet route बदल सकता है और hotspot loss Bluetooth state से अलग है। Current stage दिखाएँ, पहला actionable error सुरक्षित रखें और केवल documented safe boundary से restart करें।
संवेदनशील डेटा सोच-समझकर संभालें
AI transcripts, recordings, translations, reports, logs, crash reports, media और dashboard pages में user data हो सकता है।
- Retention और deletion policies तय करें।
- Diagnostic tooling केवल निर्धारित builds और networks तक सीमित रखें।
- Logs से credentials और identifiers redact करें।
- केवल enabled features के लिए आवश्यक permissions माँगें।
- Product privacy design में uploads और external AI processing स्पष्ट दिखाएँ।
- Temporary SDK output को गलती से long-lived storage में न रखें।
Authoritative Output और Fallback सुरक्षित रखें
Workflow original और processed output बनाए तो derivative verify होने तक original सुरक्षित रखें। उदाहरण के लिए, video stabilization failure से downloaded source file जरूरी नहीं कि invalid हो जाए।
Public result models और terminal callbacks को authoritative state मानें। Demo labels, inferred status codes और UI progress केवल presentation evidence हैं, SDK contract का विकल्प नहीं।
इंटीग्रेशन समीक्षा सूची
- Initialization और optional plugin registration का एक owner है।
- हर feature readiness, protocol conformance और capability जाँचता है।
- Intermediate callbacks और terminal outcomes अलग हैं।
- UIKit changes main queue पर चलते हैं।
- Long-running workflows में idempotent cleanup है।
- UX में hotspot और internet-route changes दिखते हैं।
- Optional processing fail होने पर original media सुरक्षित रहता है।
- Diagnostic data product privacy policy का पालन करता है।
- Physical-device tests interruption, disconnect, retry और navigation away को cover करते हैं।
- हर SDK update के बाद API Reference और feature guide दोबारा जाँचे जाते हैं।