تنظيم صفحاتك في مجموعات
يمكنك حفظ المحتوى وتصنيفه حسب إعداداتك المفضّلة.
يفترض هذا الدليل أنّ لديك تطبيق وسائط يشغّل الصوت على الهاتف وأنّ تطبيق الوسائط يتوافق مع بنية تطبيقات الوسائط على Android. ستتعرّف أيضًا على ما يحتاج إليه تطبيقك من MediaBrowserService وMediaSession ليعمل على Android Auto أو AAOS. بعد إكمال البنية الأساسية للوسائط، يمكنك إضافة توافق تطبيق الوسائط مع Android Auto وAAOS.
إذا كان تطبيقك يركّز على تشغيل الوسائط الصوتية، استخدِم الأدوات الموضّحة هنا. يمكنك إنشاء تطبيقات وسائط للسيارات بإحدى الطريقتَين التاليتَين:
استخدِم MediaBrowserService وMediaSession لإنشاء تطبيق يمكن ربطه بتطبيق Android Auto وAndroid Automotive OS. يتيح ذلك لواجهة شاشة نظام المعلومات والترفيه عرض واجهات المستخدم الخاصة بتصفّح الوسائط وتشغيلها، وهي واجهات محسَّنة للاستخدام داخل السيارة.
يفترض هذا الدليل أنّ لديك تطبيق وسائط يشغّل الصوت على الهاتف وأنّ تطبيق الوسائط يتوافق مع بنية تطبيق الوسائط في Android. يوضّح هذا الدليل المكوّنات المطلوبة MediaBrowserService وMediaSession التي يحتاجها تطبيقك ليكون متوافقًا مع Android Auto أو Android Automotive OS. بعد إكمال البنية الأساسية لتطبيق الوسائط، يمكنك إضافة إمكانية التشغيل على Android Auto وإضافة إمكانية التشغيل على Android Automotive OS إلى تطبيق الوسائط.
إنشاء تطبيقات وسائط فيديو
إذا كان المحتوى الأساسي الذي يوفّره تطبيقك هو الفيديو، يُرجى الاطّلاع على ما يلي:
تُستخدَم هذه المصطلحات في ما يتعلق بإنشاء تطبيقات وسائط للسيارات:
متصفّح الوسائط
واجهة برمجة تطبيقات تستخدمها تطبيقات الوسائط لاكتشاف خدمات متصفّح الوسائط وعرض محتواها. يستخدم كل من Android Auto وAAOS متصفّح وسائط للعثور على خدمة متصفّح الوسائط في تطبيقك.
ينظّم مستعرض الوسائط المحتوى في شجرة من عناصر MediaItem. يمكن أن يتضمّن عنصر الوسائط أحد هذين الخيارَين أو كليهما. يعمل عنصر الوسائط الذي يمكن تصفّحه وتشغيله مثل قائمة تشغيل. يمكنك اختيار العنصر لتشغيل جميع العناصر الفرعية، أو يمكنك تصفّح العناصر الفرعية.
يشير الرمز FLAG_PLAYABLE إلى أنّ العنصر هو ورقة في شجرة المحتوى.
يمثّل العنصر بثًا صوتيًا واحدًا، مثل أغنية في ألبوم أو فصل في كتاب صوتي أو حلقة من برنامج بودكاست.
يشير الرمز FLAG_BROWSABLE إلى أنّ العنصر هو عقدة في شجرة المحتوى ويتضمّن عناصر فرعية. على سبيل المثال، يمثّل العنصر ألبومًا، والعناصر التابعة له هي الأغاني الموجودة في الألبوم.
يخضع كل من المحتوى وعيّنات التعليمات البرمجية في هذه الصفحة للتراخيص الموضحّة في ترخيص استخدام المحتوى. إنّ Java وOpenJDK هما علامتان تجاريتان مسجَّلتان لشركة Oracle و/أو الشركات التابعة لها.
تاريخ التعديل الأخير: 2025-08-22 (حسب التوقيت العالمي المتفَّق عليه)
[null,null,["تاريخ التعديل الأخير: 2025-08-22 (حسب التوقيت العالمي المتفَّق عليه)"],[],[],null,["# Media apps for cars overview\n\nThis guide assumes you have a media app that plays audio on a phone and that\nyour media app conforms to Android media app architecture. You also learn what\nyour app needs from `MediaBrowserService` and `MediaSession` to run on Android\nAuto or AAOS. When you complete the core media infrastructure, you can add\nsupport for Android Auto and AAOS to your media app.\n| **Caution:** Google takes driver distraction seriously. Your app must meet specific design requirements before it can be listed on Google Play for Android Auto or AAOS. By adhering to these requirements, you can make it more straightforward to build and test your app. To learn more, see [Android app quality for cars](/docs/quality-guidelines/car-app-quality?category=media).\n\nContents\n--------\n\nThese pages detail how to work with the media apps:\n\n- [Configure the manifest file](/training/cars/media/configure-manifest)\n- [Enable playback controls](/training/cars/media/enable-playback)\n- [Support voice actions](/training/cars/media/voice-actions)\n- [Implement distraction safeguards](/training/cars/media/distraction-safeguards)\n- [Handle errors](/training/cars/media/errors)\n\nCreate audio media apps\n-----------------------\n\nIf your app focuses on playing audio media, use the tools described here. You\ncan create media apps for cars in one of two ways:\n\n1. Use `MediaBrowserService` and a `MediaSession` to create an app that Android\n Auto and AAOS can connect to. This allows the infotainment screen interface\n to render media browsing and playback user interfaces optimized for in-car\n use.\n\n *or*\n2. Use the [Cars App Library](/training/cars/apps) templates to build apps with a customized\n media browsing and playback experience, including custom actions. To learn\n more, see [Build a templated media app](/training/cars/apps/media).\n\n | **Note:** Templated media apps are supported only on Android Auto.\n\n| **Caution:** Aside from [voice guidance audio for navigation apps](/training/cars/apps/navigation#voice-guidance) and the media apps described here, in-app media playback while driving is **not** permitted.\n\nThis guide assumes you have a media app that plays audio on a phone and that\nyour media app conforms to Android [media app architecture](/guide/topics/media-apps/media-apps-overview). This guide\ndescribes the required components of a `MediaBrowserService` and `MediaSession`\nneeded by your app to be compatible with Android Auto or AAOS. After you\ncomplete the core media infrastructure, you can\n[add support for Android Auto](/training/cars/media/auto) and [add support for AAOS](/training/cars/media/automotive-os) to your media\napp.\n\nCreate video media apps\n-----------------------\n\nIf the primary content provided by your app is video, see:\n\n- [Build video apps for Android Automotive OS](/training/cars/parked/video)\n- [Build parked apps for cars](/training/cars/parked)\n\nBefore you start\n----------------\n\nBe sure to consult:\n\n- [Android media API documentation](/guide/topics/media-apps/media-apps-overview)\n- Design guidance: [Create media apps](https://developers.google.com/cars/design/create-apps/app-types/media)\n- Terminology: [Key terms and concepts](#terms-concepts)\n\nLearn key terms and concepts\n----------------------------\n\nThese terms are used in relation to building media apps for cars:\n\nMedia browser\n: An API used by media apps to discover media browser services and to display\n their content. Android Auto and AAOS use a media browser to\n find your app's media browser service.\n\nMedia browser service\n: An Android service implemented by your media app that complies with the\n [`MediaBrowserServiceCompat`](/reference/androidx/media/MediaBrowserServiceCompat) API. Your app uses this service to expose\n content. We also support [\\`MediaLibrarySerice'](/training/cars/media/configure-manifest).\n\nMedia item\n\n: The media browser organizes content in a tree of [`MediaItem`](/training/cars/parked/video) objects. A\n media item can have either or both of these flags. A media item that can\n be browsed for **and** played operates like a playlist. You can select the item\n to play all of its descendants, or you can browse its descendants.\n\n- `FLAG_PLAYABLE` indicates that the item is a leaf on the content tree.\n The item represents a single sound stream, such as a song on an album,\n a chapter in an audio book, or an episode of a podcast.\n\n- `FLAG_BROWSABLE` indicates that the item is a node on the content tree\n and has descendants. For example, the item represents an album, and its\n descendants are the songs on the album.\n\nSee additional resources\n------------------------\n\nFor additional information, see:\n\n- [Universal Media Player sample](//github.com/googlesamples/android-UniversalMusicPlayer)\n- [Audio app overview](/training/managing-audio)\n- [ExoPlayer overview](/guide/topics/media/exoplayer)"]]