MediaMetadata:album 属性
album
是 MediaMetadata
接口的一个属性,用于返回或设置包含要播放媒体的专辑或合集的名称。
值
包含专辑名称的 String
。
示例
以下示例检查浏览器兼容性并设置媒体会话的当前元数据。
js
if ("mediaSession" in navigator) {
navigator.mediaSession.metadata = new MediaMetadata({
title: "Unforgettable",
artist: "Nat King Cole",
album: "The Ultimate Collection (Remastered)",
artwork: [
{
src: "https://dummyimage.com/96x96",
sizes: "96x96",
type: "image/png",
},
{
src: "https://dummyimage.com/128x128",
sizes: "128x128",
type: "image/png",
},
{
src: "https://dummyimage.com/192x192",
sizes: "192x192",
type: "image/png",
},
{
src: "https://dummyimage.com/256x256",
sizes: "256x256",
type: "image/png",
},
{
src: "https://dummyimage.com/384x384",
sizes: "384x384",
type: "image/png",
},
{
src: "https://dummyimage.com/512x512",
sizes: "512x512",
type: "image/png",
},
],
});
}
规范
规范 |
---|
媒体会话 # dom-mediametadata-album |
浏览器兼容性
BCD 表格仅在启用 JavaScript 的浏览器中加载。