重要事項:本文件不適用於您目前選取的格式 電子郵件!
amp-o2-player
說明
顯示 AOL O2Player。
必要指令碼
<script async custom-element="amp-o2-player" src="https://cdn.ampproject.org/v0/amp-o2-player-0.1.js"></script>
範例
width
和 height
屬性決定以回應式版面配置內嵌播放器的長寬比。
範例
<amp-o2-player data-pid="12345" data-bcid="5678" data-bid="54321" data-vid="98765" layout="responsive" width="480" height="270" > </amp-o2-player>
屬性
data-pid (必要) | O2Player 的播放器 ID。 |
data-bcid (必要) | O2Player 的買方公司 ID (bcid)。 |
data-bid | O2Player 的播放清單 ID (bid)。 |
data-vid | O2Player 的影片 ID (vid)。 |
data-macros | O2Player 的巨集。 |
通用屬性 | 此元素包含擴充至 AMP 元件的通用屬性。 |
驗證
請參閱 AMP 驗證器規格中的 amp-o2-player 規則。
以下列出 amp-o2-player
標籤特有的驗證錯誤
驗證錯誤 | 說明 |
---|---|
「example1」標籤遺失或不正確,但「example2」需要此標籤。 | 當必要的 amp-o2-player 擴充功能 .js 指令碼標籤遺失或不正確時,就會擲回此錯誤。 |
標籤「example2」不支援隱含版面配置「example1」。 | 當隱含版面配置設定為 CONTAINER 時擲回的錯誤;不支援此版面配置類型。 |
標籤「example2」不支援指定的版面配置「example1」。 | 當指定的版面配置設定為 CONTAINER 時擲回的錯誤;不支援此版面配置類型。 |
標籤「example3」中屬性「example2」的屬性「example1」設定為無效值「example4」。 | 當屬性 height 或 width 的值無效時擲回的錯誤。例如,除了 NODISPLAY 以外,所有支援的版面配置類型若設定 height=auto 都會觸發此錯誤。 |
同意聲明資料
如果 amp-o2-player
父層頁面上有 CMP,amp-o2-player
內部的 Iframe 可以傳送訊息以接收同意聲明資料。
從 Iframe 要求同意聲明資料的範例請求
window.parent.postMessage( { sentinel: 'amp', type: 'send-consent-data', }, '*' );
接收同意聲明資料的回應範例
function isAmpMessage(event, type) {
return (
event.source == window.parent &&
event.origin != window.location.origin &&
event.data &&
event.data.sentinel == 'amp' &&
event.data.type == type
);
}
window.addEventListener('message', function (event) {
if (!isAmpMessage(event, 'consent-data')) {
return;
}
console.log(event.data.consentData);
});
需要更多協助嗎?
您已閱讀本文件許多次,但內容似乎並未涵蓋您的所有問題?或許其他人也有相同感受:請在 Stack Overflow 上與他們交流。
前往 Stack Overflow 發現錯誤或缺少功能?AMP 專案大力鼓勵您的參與和貢獻!我們希望您能成為我們開放原始碼社群的長期參與者,同時也歡迎您針對特別感興趣的問題做出一次性的貢獻。
前往 GitHub