指定位元率和媒體格式
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
VAST 回應可包含多個
和其他格式SDK 會選擇適當的位元率
選擇不同的連線方式:
- 行動網路連線最高 500 KB/秒
- Wi-Fi 無限制
如要指定偏好的影片格式和位元率,請使用
AdsRenderingSettings
例項,在 Google 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);
...
}
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2025-08-31 (世界標準時間)。
[null,null,["上次更新時間:2025-08-31 (世界標準時間)。"],[[["\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```"]]