معاينة الكاميرا وعرض الوسائط
تنظيم صفحاتك في مجموعات
يمكنك حفظ المحتوى وتصنيفه حسب إعداداتك المفضّلة.

الفئة 3: تطبيقات متوافقة مع الشاشات الكبيرة
معاينة الكاميرا
"الكاميرا" هي أحد أهم تطبيقات Android. عدسة الكاميرا هي نافذة على التطبيق، وهي تمثيل لمخرجات أداة استشعار الكاميرا (معاينة الكاميرا).
تتميز أدوات استشعار الكاميرا بموقع ثابت ونسبة عرض إلى ارتفاع ثابتة، وعادةً ما تُخرج بيانات الصور في الوضع الأفقي. ومع ذلك، يجب أن يكون إطار العرض متوافقًا مع أوضاع الجهاز العمودية والأفقية، وحالات الأجهزة القابلة للطي في الوضعين المفتوح والمغلق، وأحجام النوافذ المختلفة في وضع "النوافذ المتعددة".
في وضع "النوافذ المتعددة" وعلى الأجهزة القابلة للطي، يمكن أن يكون إطار الكاميرا بالوضع العمودي على الأجهزة في الوضع الأفقي أو بالوضع الأفقي على الأجهزة في الوضع العمودي. غالبًا ما يجب أن تُدير تطبيقات الكاميرا معاينة الصورة لتتطابق مع اتجاه عدسة الكاميرا. وحتى عندما يكون عدسة الكاميرا ومستشعر الكاميرا في الاتجاه نفسه، يمكن أن تختلف نسبة العرض إلى الارتفاع.
يواجه تطبيقك تحديًا في ضبط اتجاه صورة كاميرا الاستشعار وتغيير حجمها لتتطابق مع اتجاه واجهة مستخدم التطبيق ونسبة العرض إلى الارتفاع، وذلك عندما تغيّر واجهة المستخدم الاتجاه والحجم.
للتعرّف على كيفية إدارة معاينة الكاميرا، اطّلِع على أدلة المطوّرين التالية:
تلتقط ميزة "إرسال الوسائط" محتوى شاشة جهاز أو نافذة تطبيق، وتعرض المحتوى الذي تم التقاطه على جهاز آخر، مثل التلفزيون.
يجب أن تسجِّل تطبيقات عرض الوسائط إذن خدمة وأن تدير موافقة المستخدم وأن تحدِّد اتجاه المحتوى الذي تم التقاطه وتحوِّله إلى الحجم المناسب ليلائم اتجاه الجهاز المستهدَف ونسبة العرض إلى الارتفاع، وأن تتيح تخصيص العرض.
لمعرفة تفاصيل التنفيذ، يُرجى الاطّلاع على عرض الوسائط.
يخضع كل من المحتوى وعيّنات التعليمات البرمجية في هذه الصفحة للتراخيص الموضحّة في ترخيص استخدام المحتوى. إنّ Java وOpenJDK هما علامتان تجاريتان مسجَّلتان لشركة Oracle و/أو الشركات التابعة لها.
تاريخ التعديل الأخير: 2025-07-27 (حسب التوقيت العالمي المتفَّق عليه)
[[["يسهُل فهم المحتوى.","easyToUnderstand","thumb-up"],["ساعَدني المحتوى في حلّ مشكلتي.","solvedMyProblem","thumb-up"],["غير ذلك","otherUp","thumb-up"]],[["لا يحتوي على المعلومات التي أحتاج إليها.","missingTheInformationINeed","thumb-down"],["الخطوات معقدة للغاية / كثيرة جدًا.","tooComplicatedTooManySteps","thumb-down"],["المحتوى قديم.","outOfDate","thumb-down"],["ثمة مشكلة في الترجمة.","translationIssue","thumb-down"],["مشكلة في العيّنات / التعليمات البرمجية","samplesCodeIssue","thumb-down"],["غير ذلك","otherDown","thumb-down"]],["تاريخ التعديل الأخير: 2025-07-27 (حسب التوقيت العالمي المتفَّق عليه)"],[],[],null,["# Camera preview and media projection\n\nTIER 3 --- Large screen ready\n| **Objective:** Make your app [large screen ready](/docs/quality-guidelines/large-screen-app-quality#large_screen_ready) by meeting the [LS-CM1](/docs/quality-guidelines/large-screen-app-quality#LS-CM1) camera preview and [LS-CM2](/docs/quality-guidelines/large-screen-app-quality#LS-CM2) media projection requirements of the [Large screen app quality](/docs/quality-guidelines/large-screen-app-quality) guidelines.\n\nCamera preview\n--------------\n\nCamera is one of the most important Android apps. The camera viewfinder is a window into the app, a rendering of the camera sensor output (the camera preview).\n\nCamera sensors have a fixed position and fixed aspect ratio and typically output their image data in landscape orientation. The viewfinder, however, must conform to portrait and landscape device orientations, folded and unfolded states of foldable devices, and different window sizes in multi‑window mode.\n\nIn multi‑window mode and on foldables, the viewfinder can be portrait on landscape devices or landscape on portrait devices. Camera apps often must rotate the image preview to match the orientation of the viewfinder. And even when the viewfinder and camera sensor are in the same orientation, their aspect ratios can differ.\n\nYour app has the challenge of orienting and scaling the camera sensor image to match the orientation and aspect ratio of the app's UI as the UI changes orientation and size.\n\nTo learn how to manage camera preview, see the following developer guides:\n\n- [Camera preview](/training/camera2/camera-preview)\n- [CameraX overview](/training/camerax)\n\nMedia projection\n----------------\n\nMedia projection captures the contents of a device screen or app window and displays the captured content on another device, such as a TV.\n\nMedia projection apps must register a service permission, manage user consent, orient and scale the captured content to match the orientation and aspect ratio of the target device, and enable customization of the projection.\n\nFor implementation details, see [Media projection](/media/grow/media-projection)."]]