问题
I have a live radio stream using HLS and I would like to display track / artist information when we're playing a song.
As far as I can understand from the API documentation and question Streams - hasOutOfBandMetadata and getStreamingMetadata should be called for HLS if we have hasOutOfBandMetadata set to true.
The mime type we return is "application/vnd.apple.mpegurl".
getMetaData returns a list of channels, where we build each channel with something like this
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"
}
};
And getMediaMetadata returns
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 }
}
};
With this configuration I cannot see any calls to getStreamingMetadata.
Thanks
回答1:
I think the issue here may be that in your getMetdata response you should actually be returning the streamMetadata (not just in the getMediaMetadata response). For example...
<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>
来源:https://stackoverflow.com/questions/35505712/sonos-player-not-calling-getstreamingmetadata