我有一个使用HLS的直播电台流,我想在播放歌曲时显示曲目/艺术家信息。
根据API文档我可以理解,如果我们将hasOutOfBandMetadata设置为true,则应该为HLS调用问题Streams - hasOutOfBandMetadata and getStreamingMetadata。
我们返回的mime类型是" application / vnd.apple.mpegurl"。
getMetaData返回一个频道列表,我们用这样的东西构建每个频道
return new mediaMetadata
{
id = string.Format("{0}:{1}", Prefix, (string)channel["id"]),
title = (string)channel["title"],
itemType = itemType.stream,
mimeType = "application/vnd.apple.mpegurl",
onDemand = false,
liveNow = true,
Item = new streamMetadata
{
currentShow = "Test title",
currentHost = "Someone"
}
};
getMediaMetadata返回
return new getMediaMetadataResponse
{
getMediaMetadataResult = new getMediaMetadataResponseGetMediaMetadataResult
{
Items = new object[] {
new streamMetadata
{
title = (string)mediaElement["title"],
hasOutOfBandMetadata = true,
currentShow = "Test",
currentShowId = "MKDF24444",
description = "this is the description",
hasOutOfBandMetadataSpecified = true
}
},
ItemsElementName = new[] { ItemsChoiceType.streamMetadata }
}
};
使用此配置,我看不到对getStreamingMetadata的任何调用。
由于
答案 0 :(得分:0)
我认为这里的问题可能是你的getMetdata响应中你应该实际返回streamMetadata(不仅仅是在getMediaMetadata响应中)。例如......
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<getMetadataResponse xmlns="http://www.sonos.com/Services/1.1">
<getMetadataResult>
<index>0</index>
<count>3</count>
<total>3</total>
<mediaMetadata>
<id>sta00001</id>
<title>LIVE!!!! In NYC!!!!!!!!</title>
<mimeType>audio/x-scpls</mimeType>
<itemType>stream</itemType>
<streamMetadata>
<logo>http://example.com/sta00003.png</logo>
<currentHost>Donna Summer</currentHost>
<currentShow>Advanced D&D</currentShow>
</streamMetadata>
</mediaMetadata>
<mediaMetadata>
<id>sta00002</id>
<title>The Cheap Seats</title>
<mimeType>audio/x-mpegurl </mimeType>
<itemType>stream</itemType>
<streamMetadata>
<currentShow>The New Afternoon Show</currentShow>
</streamMetadata>
</mediaMetadata>
<mediaMetadata>
<id>sta00003</id>
<title>Carol Burnett: The 'Fresh Air' Interview</title>
<mimeType>audio/x-ms-wma</mimeType>
<itemType>stream</itemType>
<streamMetadata>
<currentHost>Terry Gross</currentHost>
<currentShow>Fresh Air</currentShow>
<logo>http://example.com/sta00003.png</logo>
</streamMetadata>
</mediaMetadata>
</getMetadataResult>
</getMetadataResponse>
</soap:Body>
</soap:Envelope>