ระบุอัตราบิตและรูปแบบสื่อ
จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
การตอบกลับด้วย VAST สามารถประกอบด้วยไฟล์สื่อหลายไฟล์ที่มี
และอยู่ในรูปแบบที่แตกต่างกัน SDK เลือกอัตราบิตที่เหมาะสม
ขึ้นอยู่กับสภาพเครือข่ายปัจจุบัน:
- สูงสุด 500 kbit/s สำหรับการเชื่อมต่อเครือข่ายมือถือ
- ไม่จำกัดสำหรับ Wi-Fi
หากคุณต้องการระบุรูปแบบวิดีโอและอัตราบิตที่ต้องการ ให้ใช้
AdsRenderingSettings
เพื่อส่งข้อมูลนี้ไปในตอนเริ่มต้น Ads Manager
function onAdsManagerLoaded(adsManagerLoadedEvent) {
const adsRenderingSettings = new google.ima.AdsRenderingSettings();
adsRenderingSettings.bitrate = 1024; //kbits
adsRenderingSettings.mimeTypes = [ 'video/mp4', 'video/webm’ ];
adsManager = adsManagerLoadedEvent.getAdsManager(
videoContent, adsRenderingSettings);
...
}
เนื้อหาของหน้าเว็บนี้ได้รับอนุญาตภายใต้ใบอนุญาตที่ต้องระบุที่มาของครีเอทีฟคอมมอนส์ 4.0 และตัวอย่างโค้ดได้รับอนุญาตภายใต้ใบอนุญาต Apache 2.0 เว้นแต่จะระบุไว้เป็นอย่างอื่น โปรดดูรายละเอียดที่นโยบายเว็บไซต์ Google Developers Java เป็นเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2025-08-31 UTC
[null,null,["อัปเดตล่าสุด 2025-08-31 UTC"],[[["\u003cp\u003eVAST responses may include multiple media files with varying bitrates and formats, with the SDK automatically selecting the optimal bitrate based on network conditions (500 kbit/s maximum for cellular and unlimited for WiFi).\u003c/p\u003e\n"],["\u003cp\u003eDevelopers can customize preferred video formats and bitrates by utilizing an \u003ccode\u003eAdsRenderingSettings\u003c/code\u003e instance during Ads Manager initialization to specify desired settings like bitrate and MIME types.\u003c/p\u003e\n"]]],[],null,["# Specify bitrate and media format\n\nVAST responses can contain multiple media files with different\nbitrates and in different formats. The SDK chooses the appropriate bitrate\nbased on the current network conditions:\n\n- max 500 kbit/s for cellular connection\n- unlimited for WiFi\n\nIf you want to specify preferred video formats and bitrate, use an\n[AdsRenderingSettings](/interactive-media-ads/docs/sdks/html5/client-side/reference/js/google.ima.AdsRenderingSettings)\ninstance to pass this information at the time of Ads Manager initialization. \n\n```gdscript\nfunction onAdsManagerLoaded(adsManagerLoadedEvent) {\n const adsRenderingSettings = new google.ima.AdsRenderingSettings();\n adsRenderingSettings.bitrate = 1024; //kbits\n adsRenderingSettings.mimeTypes = [ 'video/mp4', 'video/webm' ];\n adsManager = adsManagerLoadedEvent.getAdsManager(\n videoContent, adsRenderingSettings);\n ...\n}\n```"]]