يوفّر الصف MobileAds إعدادات عامة لحزمة "SDK لعرض الإعلانات على الأجهزة الجوّالة".
التحكّم في مستوى صوت إعلان الفيديو
إذا كان تطبيقك يتضمّن عناصر تحكّم في مستوى الصوت (مثل مستويات مخصّصة للموسيقى أو المؤثرات الصوتية)، فإنّ الإفصاح عن مستوى الصوت في التطبيق لحزمة "SDK لإعلانات Google على الأجهزة الجوّالة" يتيح لإعلانات الفيديو مراعاة إعدادات مستوى الصوت في التطبيق. يضمن ذلك عرض إعلانات الفيديو للمستخدمين بمستوى الصوت المتوقّع.
يحدّد مستوى صوت الجهاز، الذي يتم التحكّم فيه من خلال أزرار مستوى الصوت أو شريط تمرير مستوى الصوت على مستوى نظام التشغيل، مستوى صوت إخراج الصوت من الجهاز. ومع ذلك، يمكن للتطبيقات ضبط مستويات الصوت بشكل مستقل بما يتناسب مع مستوى صوت الجهاز لتخصيص تجربة الصوت.
يمكنك إرسال مستوى صوت التطبيق النسبي إلى حزمة تطوير البرامج (SDK) لإعلانات Google على الأجهزة الجوّالة من خلال استدعاء الطريقة SetApplicationVolume(). تتراوح قيم مستوى صوت الإعلان الصالحة بين 0.0 (صامت) و1.0 (مستوى صوت الجهاز الحالي). في ما يلي مثال على كيفية إبلاغ حزمة SDK بمستوى صوت التطبيق النسبي:
// Set app volume to be half of current device volume.MobileAds.SetApplicationVolume(0.5f);
لإعلام حزمة SDK بأنّه تم كتم صوت التطبيق، استخدِم طريقة SetApplicationMuted():
// Set app to be muted.MobileAds.SetApplicationMuted(true);
يتم تلقائيًا ضبط مستوى صوت التطبيق على 1 (مستوى صوت الجهاز الحالي)، ولا يتم كتم صوت التطبيق.
تاريخ التعديل الأخير: 2025-09-02 (حسب التوقيت العالمي المتفَّق عليه)
[null,null,["تاريخ التعديل الأخير: 2025-09-02 (حسب التوقيت العالمي المتفَّق عليه)"],[[["\u003cp\u003eThe \u003ccode\u003eMobileAds\u003c/code\u003e class allows you to manage global settings for the Mobile Ads SDK, including video ad volume.\u003c/p\u003e\n"],["\u003cp\u003eYou can control the volume of video ads relative to your app's volume using \u003ccode\u003eSetApplicationVolume()\u003c/code\u003e for a better user experience.\u003c/p\u003e\n"],["\u003cp\u003eMuting or lowering app volume can impact video ad eligibility and potentially reduce ad revenue, so use volume controls judiciously and only when reflecting actual user preferences.\u003c/p\u003e\n"]]],["The `MobileAds` class allows control over video ad volume. Apps with custom volume controls can set the relative app volume using `SetApplicationVolume()` with values from `0.0` (silent) to `1.0` (device volume). Muting the app is possible via `SetApplicationMuted(true)`. Default app volume is `1`, and the app is not muted. Lowering volume or muting reduces video ad eligibility and may lower revenue, thus these APIs should only reflect user volume choices.\n"],null,["Select platform: [Android](/ad-manager/mobile-ads-sdk/android/global-settings \"View this page for the Android platform docs.\") [iOS](/ad-manager/mobile-ads-sdk/ios/global-settings \"View this page for the iOS platform docs.\") [Unity](/ad-manager/mobile-ads-sdk/unity/global-settings \"View this page for the Unity platform docs.\")\n\n\u003cbr /\u003e\n\nThe `MobileAds` class provides global settings for the Mobile Ads SDK.\n\nVideo ad volume control\n\nIf your app has its own volume controls (such as custom music or sound effect\nvolumes), disclosing app volume to the Google Mobile Ads SDK enables video ads\nto respect app volume settings. This ensures users receive video ads with the\nexpected audio volume.\n\nThe device volume, controlled through volume buttons or OS-level volume slider,\ndetermines the volume for device audio output. However, apps can independently\nadjust volume levels relative to the device volume to tailor the audio\nexperience.\n\nYou can report the relative app volume to the Google Mobile Ads SDK by calling\nthe `SetApplicationVolume()` method. Valid ad volume values range from `0.0`\n(silent) to `1.0` (current device volume). Here's an example of how to report\nthe relative app volume to the SDK: \n\n // Set app volume to be half of current device volume.\n MobileAds.SetApplicationVolume(0.5f);\n\n| **Warning:** Lowering your app's audio volume reduces video ad eligibility and might reduce your app's ad revenue. You should only utilize this API if your app provides custom volume controls to the user, and the user's volume is properly reflected in the API.\n\nTo inform the SDK that the app volume has been muted, use the\n`SetApplicationMuted()` method: \n\n // Set app to be muted.\n MobileAds.SetApplicationMuted(true);\n\nBy default, the app volume is set to `1` (the current device volume), and the\napp is not muted.\n| **Warning:** Muting your app reduces video ad eligibility and might reduce your app's ad revenue. You should only utilize this API if your app provides a custom mute control to the user, and the user's mute decision is properly reflected in the API."]]