Firefox OS/Vaani/Music: Difference between revisions

no edit summary
No edit summary
Line 38: Line 38:


== Proposal 1: JSON-LD in manifest ==
== Proposal 1: JSON-LD in manifest ==
=== ListenAction ===


     "custom_commands": [{
     "custom_commands": [{
Line 51: Line 52:
         }
         }
       }]
       }]
=== StopAction ===


== Proposal 2: not JSON-LD ==
      "custom_commands": [{
        "@context": "http://url-to-extended-schema",
        "@type": "StopAction",
        "target": {
          "@type": "EntryPoint",
          "urlTemplate": “iac://music-controller",
          "actionApplication": {
            "@type": "SoftwareApplication",
            "operatingSystem": “Firefox OS"
          }
        }
      }]
 
=== SuspendAction ===
 
      "custom_commands": [{
        "@context": "http://schema.org",
        "@type": "SuspendAction",
        "target": {
          "@type": "EntryPoint",
          "urlTemplate": “iac://music-controller",
          "actionApplication": {
            "@type": "SoftwareApplication",
            "operatingSystem": “Firefox OS"
          }
        }
      }]


An app who supports custom command should put the following section in manifest.webapp
=== SkipBackwardAction ===


    "custom_commands": [{
      "custom_commands": [{
         "channel": "media-controller",
         "@context": "http://url-to-extended-schema",
         "(optional)name": "Music Player",
         "@type": "SkipBackwardAction",
         "(optional)description": "Control your music playing with voice",
         "target": {
        "launch-path": "index.html",
          "@type": "EntryPoint",
        "supported-action": ["PlayAction", "StopAction"]
          "urlTemplate": “iac://music-controller",
          "actionApplication": {
            "@type": "SoftwareApplication",
            "operatingSystem": “Firefox OS"
          }
        }
       }]
       }]


= Protocols for each command =
=== SkipForwardAction ===
 
      "custom_commands": [{
        "@context": "http://url-to-extended-schema",
        "@type": "SkipForwardAction",
        "target": {
          "@type": "EntryPoint",
          "urlTemplate": “iac://music-controller",
          "actionApplication": {
            "@type": "SoftwareApplication",
            "operatingSystem": “Firefox OS"
          }
        }
      }]


== Play music ==
=== SearchAction ===
For an app who wants to support '''Play music''', it should declare the following action at its JSON-LD data :


       "custom_commands": [{
       "custom_commands": [{
         "@context": "http://schema.org",
         "@context": "http://schema.org/",
         "@type": "ListenAction",
         "@type": "SearchAction",
        "object": ["MusicGroup", "MusicAlbum"],
         "target": {
         "target": {
           "@type": "EntryPoint",
           "@type": "EntryPoint",
Line 82: Line 128:
       }]
       }]


While handling it, music app will receive a ListenAction through IAC. The message may look like:
== Proposal 2: not JSON-LD ==
 
An app who supports custom command should put the following section in manifest.webapp
 
    "custom_commands": [{
        "channel": "media-controller",
        "(optional)name": "Music Player",
        "(optional)description": "Control your music playing with voice",
        "launch-path": "index.html",
        "supported-action": ["PlayAction", "StopAction"]
      }]
 
= Protocols for each command =
 
== Play music ==
For an app who wants to support '''Play music''', it should handle the '''ListenAction'''. Music app will receive a '''ListenAction''' through IAC. The message may look like:


       {
       {
Line 93: Line 154:
       {
       {
         "@context": "http://schema.org",
         "@context": "http://schema.org",
         "@type": "ListenAction"
         "@type": "ListenAction",
         "actionStatus": "CompletedActionStatus" | "FailedActionStatus"
         "actionStatus": "CompletedActionStatus" | "FailedActionStatus"
       }
       }


== Stop ==
== Stop ==
For an app who wants to support '''Stop''' command, it should declare the following action at its JSON-LD data :
For an app who wants to support '''Stop''', it should handle the '''StopAction'''. Music app will receive a '''StopAction''' through IAC. The message may look like:
 
      "custom_commands": [{
        "@context": "http://url-to-extended-schema",
        "@type": "StopAction",
        "target": {
          "@type": "EntryPoint",
          "urlTemplate": “iac://music-controller",
          "actionApplication": {
            "@type": "SoftwareApplication",
            "operatingSystem": “Firefox OS"
          }
        }
      }]
 
While handling it, music app will receive a StopAction through IAC. The message may look like:


       {
       {
Line 130: Line 176:


== Pause ==
== Pause ==
For an app who wants to support '''Pause''' command, it should declare the following action at its JSON-LD data :
For an app who wants to support '''Pause''', it should handle the '''SuspendAction'''. Music app will receive a '''SuspendAction''' through IAC. The message may look like:
 
      "custom_commands": [{
        "@context": "http://schema.org",
        "@type": "SuspendAction",
        "target": {
          "@type": "EntryPoint",
          "urlTemplate": “iac://music-controller",
          "actionApplication": {
            "@type": "SoftwareApplication",
            "operatingSystem": “Firefox OS"
          }
        }
      }]
 
While handling it, music app will receive a SuspendAction through IAC. The message may look like:


       {
       {
Line 162: Line 193:


== Previous ==
== Previous ==
For an app who wants to support '''Previous''' command, it should declare the following action at its JSON-LD data :
For an app who wants to support '''Previous''' command, it should handle the '''SkipBackwardAction'''. Music app will receive a '''SkipBackwardAction''' through IAC. The message may look like:
 
      "custom_commands": [{
        "@context": "http://url-to-extended-schema",
        "@type": "SkipBackwardAction",
        "target": {
          "@type": "EntryPoint",
          "urlTemplate": “iac://music-controller",
          "actionApplication": {
            "@type": "SoftwareApplication",
            "operatingSystem": “Firefox OS"
          }
        }
      }]
 
 
While handling it, music app will receive a SkipBackwardAction through IAC. The message may look like:


       {
       {
Line 195: Line 210:


== Next ==
== Next ==
For an app who wants to support '''Next''' command, it should declare the following action at its JSON-LD data :
For an app who wants to support '''Next''' command, it should handle the '''SkipForwardAction'''. Music app will receive a '''SkipForwardAction''' through IAC. The message may look like:
 
      "custom_commands": [{
        "@context": "http://url-to-extended-schema",
        "@type": "SkipForwardAction",
        "target": {
          "@type": "EntryPoint",
          "urlTemplate": “iac://music-controller",
          "actionApplication": {
            "@type": "SoftwareApplication",
            "operatingSystem": “Firefox OS"
          }
        }
      }]
 
 
While handling it, music app will receive a SkipForwardAction through IAC. The message may look like:


       {
       {
Line 223: Line 222:
       {
       {
         "@context": "http://schema.org",
         "@context": "http://schema.org",
         "@type": "SkipForwardAction"
         "@type": "SkipForwardAction",
         "actionStatus": "CompletedActionStatus" | "FailedActionStatus"
         "actionStatus": "CompletedActionStatus" | "FailedActionStatus"
       }
       }
Line 230: Line 229:


If we want to query "Who is the artist", we may send a '''SearchAction''' with object equal to '''MusicGroup''' and without query to query the artist of current playing. If we want to query "What album is this", we may send a '''SearchAction''' with object equal to '''MusicAlbum''' and without query to query the album of current playing.
If we want to query "Who is the artist", we may send a '''SearchAction''' with object equal to '''MusicGroup''' and without query to query the artist of current playing. If we want to query "What album is this", we may send a '''SearchAction''' with object equal to '''MusicAlbum''' and without query to query the album of current playing.
      "custom_commands": [{
        "@context": "http://schema.org/",
        "@type": "SearchAction",
        "object": ["MusicGroup", "MusicAlbum"],
        "target": {
          "@type": "EntryPoint",
          "urlTemplate": “iac://music-controller",
          "actionApplication": {
            "@type": "SoftwareApplication",
            "operatingSystem": “Firefox OS"
          }
        }
      }]


While handling it, music app will receive a SearchAction through IAC. The message may look like:
While handling it, music app will receive a SearchAction through IAC. The message may look like:
Line 259: Line 243:
         "@context": "http://schema.org",
         "@context": "http://schema.org",
         "@type": "SearchAction"
         "@type": "SearchAction"
         "actionStatus": CompletedActionStatus | FailedActionStatus
         "actionStatus": "CompletedActionStatus" | "FailedActionStatus",
         "result": [{
         "result": [{
             @type: "MusicGroup",
             @type: "MusicGroup",
110

edits