Alexa.PlaybackStateReporterインターフェース
Alexa.PlaybackStateReporter
インターフェースはプロパティを定義し、オーディオまたはビデオコンテンツの再生状態をレポートするメッセージを提供します。このインターフェースは具体的にディレクティブやイベントを定義しませんが、playbackState
が変化したときやAlexaがエンドポイントの現在の状態をリクエストしたときに、エンドポイントの状態を出力します。詳細については、ビデオスキルの状態レポートを参照してください。
PlaybackStateReporter
インターフェースでサポートされているロケールについては、機能インターフェースの一覧を参照してください。
検出
検出応答でplaybackState
にproactivelyReported
とretrievable
を指定する必要があります。
例: Discover.Response
{
"event": {
"header": {
"namespace":"Alexa.Discovery",
"name":"Discover.Response",
"payloadVersion":"3",
"messageId":"abc-123-def-456"
},
"payload":{
"endpoints":[
{
"endpointId":"uniqueIdOfEndpoint",
"friendlyName":"リビングルームのTV",
"description":"ユーザーに表示される説明です",
"displayCategories": [ "TV" ],
"cookie": {
},
"capabilities": [
{
"type": "AlexaInterface",
"interface": "Alexa.PlaybackStateReporter",
"version": "1.0",
"properties": {
"supported": [
{
"name": "playbackState"
}
],
"proactivelyReported": true,
"retrievable": true
}
}
]
}
]
}
}
}
ディレクティブ
このインターフェースはディレクティブを定義しませんが、Alexaのエンドポイント状態リクエストに応答します。
ReportState
ReportState
ディレクティブは、エンドポイントの状態をリクエストするために送信されます。
ReportStateリクエストの例
以下の例は、IDがappliance-001
のエンドポイントに関する現在の状態のリクエストを表しています。
{
"directive": {
"header": {
"messageId": "abc-123-def-456",
"correlationToken": "abcdef-123456",
"namespace": "Alexa",
"name": "ReportState",
"payloadVersion": "3"
},
"endpoint": {
"endpointId": "appliance-001",
"cookie": {},
"scope":{
"type":"BearerToken",
"token":"access-token-from-skill"
}
},
"payload": {
}
}
}
プロパティとイベント
プロパティ
プロパティ名 | タイプ | 説明 |
---|---|---|
playbackState |
PlaybackState | コンテンツの状態(PLAYING、PAUSED、STOPPEDのいずれか)を示します。 |
StateReportイベント
StateReport
イベントは、ReportStateディレクティブへの応答でエンドポイントのすべてのプロパティの値をレポートするために使用します。
例: StateReport
以下の例は、powerState
とplaybackState
の値を出力するStateReport
を示しています。
{
"context": {
"properties": [{
"namespace": "Alexa.PowerController",
"name": "powerState",
"value": "ON",
"timeOfSample": "2017-02-03T16:20:50.52Z",
"uncertaintyInMilliseconds": 0
},
{
"namespace": "Alexa.PlaybackStateReporter",
"name": "playbackState",
"value": {
"state": "PLAYING"
},
"timeOfSample": "2017-02-03T16:20:50.52Z",
"uncertaintyInMilliseconds": 0
}
]
},
"event": {
"header": {
"messageId": "abc-123-def-456",
"correlationToken": "abcdef-123456",
"namespace": "Alexa",
"name": "StateReport",
"payloadVersion": "3"
},
"endpoint": {
"endpointId": "appliance-001",
"cookie": {}
},
"payload": {}
}
}
ChangeReportイベント
ChangeReport
イベントは、エンドポイントのプロパティのいずれかの値が何らかの理由で変更された場合にその値をレポートするために使用されます。そのほかの変化していないプロパティ値は、メッセージのコンテキストに出力されます。ChangeReport
イベントは、Alexaイベントゲートウェイに送信します。この方法の詳細については、イベントゲートウェイにイベントを送信するを参照してください。
例: ChangeReport
以下の例は、playbackState
が変化した場合のChangeReport
を示しています。powerState
は変わっていません。
{
"context": {}
"properties": [{
"namespace": "Alexa.PowerController",
"name": "powerState",
"value": "ON",
"timeOfSample": "2017-02-03T16:20:50.52Z",
"uncertaintyInMilliseconds": 0
}]
},
"event": {
"header": {
"messageId": "abc-123-def-456",
"namespace": "Alexa",
"name": "ChangeReport",
"payloadVersion": "3"
},
"endpoint": {
"scope": {
"type": "BearerToken",
"token": "token-from-Amazon"
},
"endpointId": "endpoint-001"
},
"payload": {
"change": {
"cause": {
"type": "PHYSICAL_INTERACTION"
},
"properties": [{
"namespace": "Alexa.PlaybackStateReporter",
"name": "playbackState",
"value": {
"state": "PLAYING"
},
"timeOfSample": "2017-02-03T16:20:50.52Z",
"uncertaintyInMilliseconds": 0
}]
}
}
}
}
関連インターフェース
インターフェース | 説明 |
---|---|
Alexa.PlaybackController | メディア再生の再生、一時停止、停止のディレクティブを提供します。 |